diff --git a/Spigot-Server-Patches/0001-POM-Changes.patch b/Spigot-Server-Patches/0001-POM-Changes.patch index cf5cf2cc32..bc114ceb5f 100644 --- a/Spigot-Server-Patches/0001-POM-Changes.patch +++ b/Spigot-Server-Patches/0001-POM-Changes.patch @@ -5,7 +5,7 @@ Subject: [PATCH] POM Changes diff --git a/pom.xml b/pom.xml -index 8b6cb74b255017dced20347c9fd97bbf4d834f9e..b89112912a5b70fb0d77645e4b140f3ee6e6c55a 100644 +index a31f1513a90c753deba35320a6698a933bc9782f..2559c83c1b811177ade56537aeab1982ac53ee67 100644 --- a/pom.xml +++ b/pom.xml @@ -1,15 +1,14 @@ @@ -186,7 +186,7 @@ index 8b6cb74b255017dced20347c9fd97bbf4d834f9e..b89112912a5b70fb0d77645e4b140f3e org.apache.commons.codec org.bukkit.craftbukkit.libs.org.apache.commons.codec -@@ -252,10 +268,6 @@ +@@ -258,10 +274,6 @@ org.apache.maven.plugins maven-compiler-plugin 3.8.1 diff --git a/Spigot-Server-Patches/0002-Paper-config-files.patch b/Spigot-Server-Patches/0002-Paper-config-files.patch index cefbd67068..3a78e5473d 100644 --- a/Spigot-Server-Patches/0002-Paper-config-files.patch +++ b/Spigot-Server-Patches/0002-Paper-config-files.patch @@ -7,7 +7,7 @@ Loads each yml file for early init too so it can be used for early options diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java new file mode 100644 -index 0000000000000000000000000000000000000000..ed7e4220199f9c57d0ffe67f552027c0bade3af1 +index 0000000000000000000000000000000000000000..68cd4134cb6a00c1768100462f8e9e94f3fa6279 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -0,0 +1,286 @@ @@ -19,13 +19,13 @@ index 0000000000000000000000000000000000000000..ed7e4220199f9c57d0ffe67f552027c0 +import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; +import com.google.common.collect.Maps; -+import net.minecraft.server.ChunkCoordIntPair; -+import net.minecraft.server.ChunkProviderServer; -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MinecraftKey; ++import net.minecraft.resources.MinecraftKey; +import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.WorldServer; ++import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.server.level.WorldServer; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.entity.EntityTypes; ++import net.minecraft.world.level.ChunkCoordIntPair; +import org.apache.commons.lang3.tuple.MutablePair; +import org.apache.commons.lang3.tuple.Pair; +import org.bukkit.Bukkit; @@ -562,78 +562,11 @@ index 0000000000000000000000000000000000000000..b31109d2dadd29e8852468c19265066b + return config.getString("world-settings." + worldName + "." + path, config.getString("world-settings.default." + path)); + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index d1051f05933be093fa598504e169e5cfdaa1b0e3..056e1fced00dff1d6507a90c13f2448a04ca0558 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -281,15 +281,15 @@ public class ChunkProviderServer extends IChunkProvider { - } - } - -- @Override -- public boolean a(Entity entity) { -+ public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER -+ @Override public boolean a(Entity entity) { - long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); - - return this.a(i, (Function>>) PlayerChunk::b); // CraftBukkit - decompile error - } - -- @Override -- public boolean a(ChunkCoordIntPair chunkcoordintpair) { -+ public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER -+ @Override public boolean a(ChunkCoordIntPair chunkcoordintpair) { - return this.a(chunkcoordintpair.pair(), (Function>>) PlayerChunk::b); // CraftBukkit - decompile error - } - -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index bb06a7e3f3f9e4740cf6b874586e44f479d99cc4..d91b029c95b6380300db81e7c0fb172ff57958a1 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -148,6 +148,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); - org.spigotmc.SpigotConfig.registerCommands(); - // Spigot end -+ // Paper start -+ try { -+ com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); -+ } catch (Exception e) { -+ DedicatedServer.LOGGER.error("Unable to load server configuration", e); -+ return false; -+ } -+ com.destroystokyo.paper.PaperConfig.registerCommands(); -+ // Paper end - - this.setPVP(dedicatedserverproperties.pvp); - this.setAllowFlight(dedicatedserverproperties.allowFlight); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 18f510c2be4f6630c25b3f404234f3843ece817b..a314ed0106cbf4359dd1920bb4b3c6095b2550ee 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -2,6 +2,7 @@ package net.minecraft.server; - - import com.google.common.collect.ImmutableSet; - import java.util.Optional; -+import java.util.Set; // Paper - import java.util.UUID; - import java.util.function.Function; - import java.util.stream.Stream; -@@ -469,4 +470,10 @@ public class EntityTypes { - return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); - } - } -+ -+ // Paper start -+ public static Set getEntityNameList() { -+ return IRegistry.ENTITY_TYPE.keySet(); -+ } -+ // Paper end - } diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 6d1012cc652780189a5d849125abe09b27b88422..d8c8bf2466be362b424fde611fe42b73fea42ef9 100644 +index b746e30e6fc5ea0c17465b510d737316f1ab7004..89db31061fcc3420bc8e668533a4051cdbd12253 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -64,6 +64,12 @@ public class Main { +@@ -103,6 +103,12 @@ public class Main { DedicatedServerSettings dedicatedserversettings = new DedicatedServerSettings(iregistrycustom_dimension, optionset); // CraftBukkit - CLI argument support dedicatedserversettings.save(); @@ -646,7 +579,7 @@ index 6d1012cc652780189a5d849125abe09b27b88422..d8c8bf2466be362b424fde611fe42b73 java.nio.file.Path java_nio_file_path1 = Paths.get("eula.txt"); EULA eula = new EULA(java_nio_file_path1); -@@ -205,6 +211,20 @@ public class Main { +@@ -244,6 +250,20 @@ public class Main { } @@ -667,11 +600,78 @@ index 6d1012cc652780189a5d849125abe09b27b88422..d8c8bf2466be362b424fde611fe42b73 public static void convertWorld(Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, boolean flag, BooleanSupplier booleansupplier, ImmutableSet> immutableset) { // CraftBukkit Main.LOGGER.info("Forcing world upgrade! {}", convertable_conversionsession.getLevelName()); // CraftBukkit WorldUpgrader worldupgrader = new WorldUpgrader(convertable_conversionsession, datafixer, immutableset, flag); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4c5683bcb45ea500adb0775fc81f296bb2583f80..1606a7b4727fffef27d6bb08633b652b7e7fe588 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -77,6 +77,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index d5628a0197125506f7aaeb89bab7bd8a811b3ad5..8e2e415a022ccd486465f19d9bbf1f287b21fb95 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -187,6 +187,15 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer + org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); + org.spigotmc.SpigotConfig.registerCommands(); + // Spigot end ++ // Paper start ++ try { ++ com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); ++ } catch (Exception e) { ++ DedicatedServer.LOGGER.error("Unable to load server configuration", e); ++ return false; ++ } ++ com.destroystokyo.paper.PaperConfig.registerCommands(); ++ // Paper end + + this.setPVP(dedicatedserverproperties.pvp); + this.setAllowFlight(dedicatedserverproperties.allowFlight); +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index e95f516756b2613972f20636443b3ff753342917..7fd6893c30fbb34367181620aa159ed79b803455 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -306,15 +306,15 @@ public class ChunkProviderServer extends IChunkProvider { + } + } + +- @Override +- public boolean a(Entity entity) { ++ public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER ++ @Override public boolean a(Entity entity) { + long i = ChunkCoordIntPair.pair(MathHelper.floor(entity.locX()) >> 4, MathHelper.floor(entity.locZ()) >> 4); + + return this.a(i, (Function>>) PlayerChunk::b); // CraftBukkit - decompile error + } + +- @Override +- public boolean a(ChunkCoordIntPair chunkcoordintpair) { ++ public final boolean isEntityTickingChunk(ChunkCoordIntPair chunkcoordintpair) { return this.a(chunkcoordintpair); } // Paper - OBFHELPER ++ @Override public boolean a(ChunkCoordIntPair chunkcoordintpair) { + return this.a(chunkcoordintpair.pair(), (Function>>) PlayerChunk::b); // CraftBukkit - decompile error + } + +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index 4b0b782ab19a6cea4412b5e9d8c0524aee1402e4..a32bc63ff1960bdb874d546ee42633063834da24 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -2,6 +2,7 @@ package net.minecraft.world.entity; + + import com.google.common.collect.ImmutableSet; + import java.util.Optional; ++import java.util.Set; // Paper + import java.util.UUID; + import java.util.function.Function; + import java.util.stream.Stream; +@@ -599,4 +600,10 @@ public class EntityTypes { + return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); + } + } ++ ++ // Paper start ++ public static Set getEntityNameList() { ++ return IRegistry.ENTITY_TYPE.keySet(); ++ } ++ // Paper end + } +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 344b7f52e85af3e543da0bb1dd14b68eb41ebb84..f794113e7cc5809d1da0c85648fb7311fb633f40 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -129,6 +129,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot @@ -680,16 +680,16 @@ index 4c5683bcb45ea500adb0775fc81f296bb2583f80..1606a7b4727fffef27d6bb08633b652b public final SpigotTimings.WorldTimingsHandler timings; // Spigot public static BlockPosition lastPhysicsProblem; // Spigot private org.spigotmc.TickLimiter entityLimiter; -@@ -97,6 +99,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -149,6 +151,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot -+ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName()); // Spigot ++ this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper this.generator = gen; this.world = new CraftWorld((WorldServer) this, gen, env); this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 7c52aa2eabbf1eb09a3749f71fdaf2430e75a225..9b3f9b11abe89cabb3044766dda60a8842c149f4 100644 +index 20a5e136a8967311026111b4c246c200596cd019..bd62288b6951c6b5962497a3c93989cab5d66ad4 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -808,6 +808,7 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch index 185a1d6796..e80a530731 100644 --- a/Spigot-Server-Patches/0003-MC-Dev-fixes.patch +++ b/Spigot-Server-Patches/0003-MC-Dev-fixes.patch @@ -4,10 +4,278 @@ Date: Wed, 30 Mar 2016 19:36:20 -0400 Subject: [PATCH] MC Dev fixes -diff --git a/src/main/java/net/minecraft/server/ArraySetSorted.java b/src/main/java/net/minecraft/server/ArraySetSorted.java -index a3afe60b0d85cf90bf7a170dc0a0b61a796381a7..85f799a713db0c822d46b689010f9f6bd43f5280 100644 ---- a/src/main/java/net/minecraft/server/ArraySetSorted.java -+++ b/src/main/java/net/minecraft/server/ArraySetSorted.java +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java +index 14b1a51b9b675aa175c32990402551fa43ec1599..bc7757b929ecce998094ddcdf51a4703e165a6d6 100644 +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -65,8 +65,8 @@ public class SystemUtils { + return Collectors.toMap(Entry::getKey, Entry::getValue); + } + +- public static > String a(IBlockState iblockstate, Object object) { +- return iblockstate.a((Comparable) object); ++ public static > String a(IBlockState iblockstate, T object) { // Paper - decompile fix ++ return iblockstate.a(object); // Paper - decompile fix + } + + public static String a(String s, @Nullable MinecraftKey minecraftkey) { +@@ -234,8 +234,8 @@ public class SystemUtils { + public static T b(Iterable iterable, @Nullable T t0) { + Iterator iterator = iterable.iterator(); + +- Object object; +- Object object1; ++ T object; // Paper - decompile fix ++ T object1; // Paper - decompile fix + + for (object1 = null; iterator.hasNext(); object1 = object) { + object = iterator.next(); +@@ -260,7 +260,7 @@ public class SystemUtils { + } + + public static Strategy k() { +- return SystemUtils.IdentityHashingStrategy.INSTANCE; ++ return (Strategy) SystemUtils.IdentityHashingStrategy.INSTANCE; // Paper - decompile fix + } + + public static CompletableFuture> b(List> list) { +@@ -271,7 +271,7 @@ public class SystemUtils { + list.forEach((completablefuture1) -> { + int i = list1.size(); + +- list1.add((Object) null); ++ list1.add(null); // Paper - decompile fix + acompletablefuture[i] = completablefuture1.whenComplete((object, throwable) -> { + if (throwable != null) { + completablefuture.completeExceptionally(throwable); +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index f85889a232998520761731a17f3d293d3360fe2c..76675ad1633dbaebb180842b9914fac18741c62e 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -241,8 +241,8 @@ public class BlockPosition extends BaseBlockPosition { + }; + } + +- public static Iterable a(BlockPosition blockposition, int i, int j, int k) { +- int l = i + j + k; ++ public static Iterable a(BlockPosition blockposition, int p_i, int p_j, int p_k) { // Paper - decompile issues - variable name conflicts to inner class field refs ++ int l_decompiled = p_i + p_j + p_k; // Paper - decompile issues + int i1 = blockposition.getX(); + int j1 = blockposition.getY(); + int k1 = blockposition.getZ(); +@@ -270,15 +270,15 @@ public class BlockPosition extends BaseBlockPosition { + ++this.l; + if (this.l > this.j) { + ++this.i; +- if (this.i > l) { ++ if (this.i > l_decompiled) { // Paper - use proper l above (first line of this method) + return (BlockPosition) this.endOfData(); + } + +- this.j = Math.min(i, this.i); ++ this.j = Math.min(p_i, this.i); // Paper - decompile issues + this.l = -this.j; + } + +- this.k = Math.min(j, this.i - Math.abs(this.l)); ++ this.k = Math.min(p_j, this.i - Math.abs(this.l)); // Paper - decompile issues + this.m = -this.k; + } + +@@ -286,7 +286,7 @@ public class BlockPosition extends BaseBlockPosition { + int i2 = this.m; + int j2 = this.i - Math.abs(l1) - Math.abs(i2); + +- if (j2 <= k) { ++ if (j2 <= p_k) { // Paper - decompile issues + this.n = j2 != 0; + blockposition_mutableblockposition = this.h.d(i1 + l1, j1 + i2, k1 + j2); + } +@@ -355,13 +355,13 @@ public class BlockPosition extends BaseBlockPosition { + }; + } + +- public static Iterable a(BlockPosition blockposition, int i, EnumDirection enumdirection, EnumDirection enumdirection1) { ++ public static Iterable a(BlockPosition blockposition, int I, EnumDirection enumdirection, EnumDirection enumdirection1) { // Paper - decompile fix + Validate.validState(enumdirection.n() != enumdirection1.n(), "The two directions cannot be on the same axis", new Object[0]); + return () -> { + return new AbstractIterator() { + private final EnumDirection[] e = new EnumDirection[]{enumdirection, enumdirection1, enumdirection.opposite(), enumdirection1.opposite()}; + private final BlockPosition.MutableBlockPosition f = blockposition.i().c(enumdirection1); +- private final int g = 4 * i; ++ private final int g = 4 * I; + private int h = -1; + private int i; + private int j; +diff --git a/src/main/java/net/minecraft/core/RegistryBlockID.java b/src/main/java/net/minecraft/core/RegistryBlockID.java +index b173ed8a6abeee41ce48e03f6403f2eb4978155b..e543b6927280a14e1d1220534758289934e31282 100644 +--- a/src/main/java/net/minecraft/core/RegistryBlockID.java ++++ b/src/main/java/net/minecraft/core/RegistryBlockID.java +@@ -27,7 +27,7 @@ public class RegistryBlockID implements Registry { + this.b.put(t0, i); + + while (this.c.size() <= i) { +- this.c.add((Object) null); ++ this.c.add(null); // Paper - decompile fix + } + + this.c.set(i, t0); +@@ -41,6 +41,13 @@ public class RegistryBlockID implements Registry { + this.a(t0, this.a); + } + ++ // Paper start - decompile fix ++ @Override ++ public int a(T t) { ++ return getId(t); ++ } ++ // Paper end ++ + public int getId(T t0) { + Integer integer = (Integer) this.b.get(t0); + +diff --git a/src/main/java/net/minecraft/nbt/NBTBase.java b/src/main/java/net/minecraft/nbt/NBTBase.java +index 170a65cb13e7b87f64cd28331431ba55d53702cd..d6e51f82f6df2d7058806f3e483766e18398af77 100644 +--- a/src/main/java/net/minecraft/nbt/NBTBase.java ++++ b/src/main/java/net/minecraft/nbt/NBTBase.java +@@ -20,7 +20,7 @@ public interface NBTBase { + + NBTTagType b(); + +- NBTBase clone(); ++ public NBTBase clone(); // Paper - decompile fix + + default String asString() { + return this.toString(); +diff --git a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java +index 020c041461aaf771d5ec35a9afc6c4b914966d64..f792ac1639e16522695082caed754b1c2cb333b9 100644 +--- a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java +@@ -17,6 +17,7 @@ import java.util.zip.GZIPOutputStream; + import net.minecraft.CrashReport; + import net.minecraft.CrashReportSystemDetails; + import net.minecraft.ReportedException; ++import io.netty.buffer.ByteBufInputStream; // Paper + + public class NBTCompressedStreamTools { + +@@ -136,7 +137,7 @@ public class NBTCompressedStreamTools { + + public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { + // Spigot start +- if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) ++ if ( datainput instanceof ByteBufInputStream) // Paper + { + datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); + } +diff --git a/src/main/java/net/minecraft/nbt/NBTTagList.java b/src/main/java/net/minecraft/nbt/NBTTagList.java +index 35cca76fb7c7aa736e64185b44016e65cfaef6cd..4f6f6f51f9807bafa88482c0fe776c8b163107d7 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagList.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagList.java +@@ -53,7 +53,7 @@ public class NBTTagList extends NBTList { + return "TAG_List"; + } + }; +- private static final ByteSet b = new ByteOpenHashSet(Arrays.asList(1, 2, 3, 4, 5, 6)); ++ private static final ByteSet b = new ByteOpenHashSet(Arrays.asList((byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6)); // Paper - decompiler fix + private final List list; + private byte type; + +diff --git a/src/main/java/net/minecraft/network/EnumProtocol.java b/src/main/java/net/minecraft/network/EnumProtocol.java +index ab08336043d4f558434ed1f38d25cc555ace1ac0..539084d087bc6bd38d333066d3f8238cf2b08900 100644 +--- a/src/main/java/net/minecraft/network/EnumProtocol.java ++++ b/src/main/java/net/minecraft/network/EnumProtocol.java +@@ -163,7 +163,8 @@ import org.apache.logging.log4j.LogManager; + + public enum EnumProtocol { + +- HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeSettings.class, PacketPlayInRecipeSettings::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); ++ // Paper - fix decompile error - add generic names to < > like PacketListenerPlayOut ++ HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeSettings.class, PacketPlayInRecipeSettings::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); + + private static final EnumProtocol[] e = new EnumProtocol[4]; + private static final Map>, EnumProtocol> f = Maps.newHashMap(); +@@ -248,7 +249,7 @@ public enum EnumProtocol { + private final List>> b; + + private a() { +- this.a = (Object2IntMap) SystemUtils.a((Object) (new Object2IntOpenHashMap()), (object2intopenhashmap) -> { ++ this.a = (Object2IntMap) SystemUtils.a(new Object2IntOpenHashMap(), (object2intopenhashmap) -> { // Paper - fix decompile error + object2intopenhashmap.defaultReturnValue(-1); + }); + this.b = Lists.newArrayList(); +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index e4fae57da4ee232a818e608912f021694bcea0f2..76d880e05bbc1534343a105dd7121bddd729b8a2 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1665,9 +1665,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrantmap(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error + }, this).thenCompose((immutablelist) -> { +- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); ++ return DataPackResources.a((List) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error + }).thenAcceptAsync((datapackresources) -> { + this.dataPackResources.close(); + this.dataPackResources = datapackresources; +diff --git a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java +index 5a51f47f747382ec2a30bb47bcb1f7c61dd4c369..e066848127cb9a42e8c39422691cc65132cac6bb 100644 +--- a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java ++++ b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java +@@ -179,7 +179,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { + + public void queueUpdate() { + if ((!this.c.isEmpty() || super.a()) && this.g.compareAndSet(false, true)) { +- this.b.a((Object) (() -> { ++ this.b.a((() -> { // Paper - decompile error + this.b(); + this.g.set(false); + })); +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java +index 1c500e1193296f92f03a94e2cf085b215daaad6c..51ef4adf66c1e21093e63ab46fa47e66c2425fdb 100644 +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java +@@ -23,7 +23,7 @@ public final class Ticket implements Comparable> { + } else { + int j = Integer.compare(System.identityHashCode(this.a), System.identityHashCode(ticket.a)); + +- return j != 0 ? j : this.a.a().compare(this.identifier, ticket.identifier); ++ return j != 0 ? j : this.a.a().compare(this.identifier, (T)ticket.identifier); // Paper - decompile fix + } + } + +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index d1e11c1b3300ebc324ad88d05170d4b1232f2ddb..b88b0890cb5b5b0c4c2c35456fdffb02e8cfcf91 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1918,7 +1918,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + // CraftBukkit - decompile error +- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { ++ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { // Paper - decompile fix + return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue(); + }).collect(Collectors.joining(",")); + } catch (Exception exception) { +diff --git a/src/main/java/net/minecraft/stats/ServerStatisticManager.java b/src/main/java/net/minecraft/stats/ServerStatisticManager.java +index a920e1de04a3b3d2f794c1490075f32072f48fb2..de87ed44e09b61f6d2e6a93d770a7c37b9f95fa1 100644 +--- a/src/main/java/net/minecraft/stats/ServerStatisticManager.java ++++ b/src/main/java/net/minecraft/stats/ServerStatisticManager.java +@@ -203,7 +203,7 @@ public class ServerStatisticManager extends StatisticManager { + ObjectIterator objectiterator = this.a.object2IntEntrySet().iterator(); + + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); ++ Object2IntMap.Entry> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + Statistic statistic = (Statistic) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey(); + + ((JsonObject) map.computeIfAbsent(statistic.getWrapper(), (statisticwrapper) -> { +diff --git a/src/main/java/net/minecraft/util/ArraySetSorted.java b/src/main/java/net/minecraft/util/ArraySetSorted.java +index e56b8e172d96c5508457fcf3f5a0cf0d2d2d8d7c..427daa94322f47b4eaf881d85a01fed239db549a 100644 +--- a/src/main/java/net/minecraft/util/ArraySetSorted.java ++++ b/src/main/java/net/minecraft/util/ArraySetSorted.java @@ -23,11 +23,11 @@ public class ArraySetSorted extends AbstractSet { } @@ -49,178 +317,47 @@ index a3afe60b0d85cf90bf7a170dc0a0b61a796381a7..85f799a713db0c822d46b689010f9f6b } else { System.arraycopy(this.b, 0, au, 0, this.c); if (au.length > this.c) { -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 3b374fb7d55de67ef8a5fb6d6ed1081e7c644a77..260fd033c1017389a6f28447a6017b0ca15514d8 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -20,8 +20,15 @@ import org.apache.logging.log4j.Logger; - public final class BiomeBase { +diff --git a/src/main/java/net/minecraft/util/RegistryID.java b/src/main/java/net/minecraft/util/RegistryID.java +index d88e55c64f80707b4a9b1e271714c2dbdee9a38a..6150f7a5c5004ac79414ab22dbaa3439dc8afdb4 100644 +--- a/src/main/java/net/minecraft/util/RegistryID.java ++++ b/src/main/java/net/minecraft/util/RegistryID.java +@@ -18,11 +18,18 @@ public class RegistryID implements Registry { - public static final Logger LOGGER = LogManager.getLogger(); -+ // Paper start -+ private static class dProxy extends BiomeBase.d { -+ private dProxy(Precipitation biomebase_precipitation, float f, TemperatureModifier biomebase_temperaturemodifier, float f1) { -+ super(biomebase_precipitation, f, biomebase_temperaturemodifier, f1); -+ } -+ }; + public RegistryID(int i) { + i = (int) ((float) i / 0.8F); +- this.b = (Object[]) (new Object[i]); ++ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.c = new int[i]; +- this.d = (Object[]) (new Object[i]); ++ this.d = (K[]) (new Object[i]); // Paper - decompile fix + } + ++ // Paper start - decompile fix ++ @Override ++ public int a(K k) { ++ return getId(k); ++ } + // Paper end - public static final Codec b = RecordCodecBuilder.create((instance) -> { -- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { -+ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper - return biomebase.j; - }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { - return biomebase.o; -@@ -38,7 +45,7 @@ public final class BiomeBase { - })).apply(instance, BiomeBase::new); - }); - public static final Codec c = RecordCodecBuilder.create((instance) -> { -- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { -+ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper - return biomebase.j; - }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { - return biomebase.o; -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 420863ca190f72dd8b534859f620fd0ebeb29d70..1b2f415e3ed7f6dca12d13cd098cb4ec3af54020 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -235,8 +235,8 @@ public class BlockPosition extends BaseBlockPosition { - }; ++ + public int getId(@Nullable K k0) { + return this.c(this.b(k0, this.d(k0))); } +@@ -56,9 +63,9 @@ public class RegistryID implements Registry { + K[] ak = this.b; + int[] aint = this.c; -- public static Iterable a(BlockPosition blockposition, int i, int j, int k) { -- int l = i + j + k; -+ public static Iterable a(BlockPosition blockposition, int p_i, int p_j, int p_k) { // Paper - decompile issues - variable name conflicts to inner class field refs -+ int l_decompiled = p_i + p_j + p_k; // Paper - decompile issues - int i1 = blockposition.getX(); - int j1 = blockposition.getY(); - int k1 = blockposition.getZ(); -@@ -264,15 +264,15 @@ public class BlockPosition extends BaseBlockPosition { - ++this.l; - if (this.l > this.j) { - ++this.i; -- if (this.i > l) { -+ if (this.i > l_decompiled) { // Paper - use proper l above (first line of this method) - return (BlockPosition) this.endOfData(); - } +- this.b = (Object[]) (new Object[i]); ++ this.b = (K[]) (new Object[i]); // Paper - decompile fix + this.c = new int[i]; +- this.d = (Object[]) (new Object[i]); ++ this.d = (K[]) (new Object[i]); // Paper - decompile fix + this.e = 0; + this.f = 0; -- this.j = Math.min(i, this.i); -+ this.j = Math.min(p_i, this.i); // Paper - decompile issues - this.l = -this.j; - } - -- this.k = Math.min(j, this.i - Math.abs(this.l)); -+ this.k = Math.min(p_j, this.i - Math.abs(this.l)); // Paper - decompile issues - this.m = -this.k; - } - -@@ -280,7 +280,7 @@ public class BlockPosition extends BaseBlockPosition { - int i2 = this.m; - int j2 = this.i - Math.abs(l1) - Math.abs(i2); - -- if (j2 <= k) { -+ if (j2 <= p_k) { // Paper - decompile issues - this.n = j2 != 0; - blockposition_mutableblockposition = this.h.d(i1 + l1, j1 + i2, k1 + j2); - } -@@ -349,13 +349,13 @@ public class BlockPosition extends BaseBlockPosition { - }; - } - -- public static Iterable a(BlockPosition blockposition, int i, EnumDirection enumdirection, EnumDirection enumdirection1) { -+ public static Iterable a(BlockPosition blockposition, int I, EnumDirection enumdirection, EnumDirection enumdirection1) { // Paper - decompile fix - Validate.validState(enumdirection.n() != enumdirection1.n(), "The two directions cannot be on the same axis", new Object[0]); - return () -> { - return new AbstractIterator() { - private final EnumDirection[] e = new EnumDirection[]{enumdirection, enumdirection1, enumdirection.opposite(), enumdirection1.opposite()}; - private final BlockPosition.MutableBlockPosition f = blockposition.i().c(enumdirection1); -- private final int g = 4 * i; -+ private final int g = 4 * I; - private int h = -1; - private int i; - private int j; -diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java -index 771841e08591955e61c7bcc5b09c8457652c1b9c..8162c11d14b8e88c2b572f9ddf6b7a15977047f8 100644 ---- a/src/main/java/net/minecraft/server/BlockStateEnum.java -+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java -@@ -20,10 +20,10 @@ public class BlockStateEnum & INamable> extends IBlockState - protected BlockStateEnum(String s, Class oclass, Collection collection) { - super(s, oclass); - this.a = ImmutableSet.copyOf(collection); -- Iterator iterator = collection.iterator(); -+ Iterator iterator = collection.iterator(); // Paper - decompile fix - - while (iterator.hasNext()) { -- T t0 = (Enum) iterator.next(); -+ T t0 = iterator.next(); // Paper - Decompile fix - String s1 = ((INamable) t0).getName(); - - if (this.b.containsKey(s1)) { -diff --git a/src/main/java/net/minecraft/server/CraftingManager.java b/src/main/java/net/minecraft/server/CraftingManager.java -index fdb7d96cf20b37cb7bec83f5489402167bd842d5..58ecbe1e20581dc9e78cdd2f4ece29cfa014da8a 100644 ---- a/src/main/java/net/minecraft/server/CraftingManager.java -+++ b/src/main/java/net/minecraft/server/CraftingManager.java -@@ -64,7 +64,7 @@ public class CraftingManager extends ResourceDataJson { - } - - this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { -- return (entry1.getValue()); // CraftBukkit -+ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* - })); - CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); - } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index 96d6c55c9a2fbb9f93d369eadaacf00b7e64b79e..e77634bb4d33716ed41468722187080ae7243f3d 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -388,7 +388,7 @@ public class EnderDragonBattle { - } - } - -- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); -+ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // Paper - decompile fix - } - - private EntityEnderDragon o() { -diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index a3c885b070336295cc059a8c525848c8405ef89f..b358070215477bcd33dcd440472db4489017135a 100644 ---- a/src/main/java/net/minecraft/server/EntityVindicator.java -+++ b/src/main/java/net/minecraft/server/EntityVindicator.java -@@ -25,7 +25,7 @@ public class EntityVindicator extends EntityIllagerAbstract { - this.goalSelector.a(2, new EntityIllagerAbstract.b(this)); - this.goalSelector.a(3, new EntityRaider.a(this, 10.0F)); - this.goalSelector.a(4, new EntityVindicator.c(this)); -- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a()); -+ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // Paper - decompile fix - this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); - this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); -diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java -index 1de8c7eaeb08c645058dbe1da7ca8ef91958abda..32f5470baa88c3dc80db1bb547e1c982ac90237d 100644 ---- a/src/main/java/net/minecraft/server/EnumProtocol.java -+++ b/src/main/java/net/minecraft/server/EnumProtocol.java -@@ -13,7 +13,8 @@ import org.apache.logging.log4j.LogManager; - - public enum EnumProtocol { - -- HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeSettings.class, PacketPlayInRecipeSettings::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a<>()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a<>()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); -+ // Paper - fix decompile error - add generic names to < > like PacketListenerPlayOut -+ HANDSHAKING(-1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketHandshakingInSetProtocol.class, PacketHandshakingInSetProtocol::new))), PLAY(0, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketPlayOutSpawnEntity.class, PacketPlayOutSpawnEntity::new).a(PacketPlayOutSpawnEntityExperienceOrb.class, PacketPlayOutSpawnEntityExperienceOrb::new).a(PacketPlayOutSpawnEntityLiving.class, PacketPlayOutSpawnEntityLiving::new).a(PacketPlayOutSpawnEntityPainting.class, PacketPlayOutSpawnEntityPainting::new).a(PacketPlayOutNamedEntitySpawn.class, PacketPlayOutNamedEntitySpawn::new).a(PacketPlayOutAnimation.class, PacketPlayOutAnimation::new).a(PacketPlayOutStatistic.class, PacketPlayOutStatistic::new).a(PacketPlayOutBlockBreak.class, PacketPlayOutBlockBreak::new).a(PacketPlayOutBlockBreakAnimation.class, PacketPlayOutBlockBreakAnimation::new).a(PacketPlayOutTileEntityData.class, PacketPlayOutTileEntityData::new).a(PacketPlayOutBlockAction.class, PacketPlayOutBlockAction::new).a(PacketPlayOutBlockChange.class, PacketPlayOutBlockChange::new).a(PacketPlayOutBoss.class, PacketPlayOutBoss::new).a(PacketPlayOutServerDifficulty.class, PacketPlayOutServerDifficulty::new).a(PacketPlayOutChat.class, PacketPlayOutChat::new).a(PacketPlayOutTabComplete.class, PacketPlayOutTabComplete::new).a(PacketPlayOutCommands.class, PacketPlayOutCommands::new).a(PacketPlayOutTransaction.class, PacketPlayOutTransaction::new).a(PacketPlayOutCloseWindow.class, PacketPlayOutCloseWindow::new).a(PacketPlayOutWindowItems.class, PacketPlayOutWindowItems::new).a(PacketPlayOutWindowData.class, PacketPlayOutWindowData::new).a(PacketPlayOutSetSlot.class, PacketPlayOutSetSlot::new).a(PacketPlayOutSetCooldown.class, PacketPlayOutSetCooldown::new).a(PacketPlayOutCustomPayload.class, PacketPlayOutCustomPayload::new).a(PacketPlayOutCustomSoundEffect.class, PacketPlayOutCustomSoundEffect::new).a(PacketPlayOutKickDisconnect.class, PacketPlayOutKickDisconnect::new).a(PacketPlayOutEntityStatus.class, PacketPlayOutEntityStatus::new).a(PacketPlayOutExplosion.class, PacketPlayOutExplosion::new).a(PacketPlayOutUnloadChunk.class, PacketPlayOutUnloadChunk::new).a(PacketPlayOutGameStateChange.class, PacketPlayOutGameStateChange::new).a(PacketPlayOutOpenWindowHorse.class, PacketPlayOutOpenWindowHorse::new).a(PacketPlayOutKeepAlive.class, PacketPlayOutKeepAlive::new).a(PacketPlayOutMapChunk.class, PacketPlayOutMapChunk::new).a(PacketPlayOutWorldEvent.class, PacketPlayOutWorldEvent::new).a(PacketPlayOutWorldParticles.class, PacketPlayOutWorldParticles::new).a(PacketPlayOutLightUpdate.class, PacketPlayOutLightUpdate::new).a(PacketPlayOutLogin.class, PacketPlayOutLogin::new).a(PacketPlayOutMap.class, PacketPlayOutMap::new).a(PacketPlayOutOpenWindowMerchant.class, PacketPlayOutOpenWindowMerchant::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMove.class, PacketPlayOutEntity.PacketPlayOutRelEntityMove::new).a(PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook.class, PacketPlayOutEntity.PacketPlayOutRelEntityMoveLook::new).a(PacketPlayOutEntity.PacketPlayOutEntityLook.class, PacketPlayOutEntity.PacketPlayOutEntityLook::new).a(PacketPlayOutEntity.class, PacketPlayOutEntity::new).a(PacketPlayOutVehicleMove.class, PacketPlayOutVehicleMove::new).a(PacketPlayOutOpenBook.class, PacketPlayOutOpenBook::new).a(PacketPlayOutOpenWindow.class, PacketPlayOutOpenWindow::new).a(PacketPlayOutOpenSignEditor.class, PacketPlayOutOpenSignEditor::new).a(PacketPlayOutAutoRecipe.class, PacketPlayOutAutoRecipe::new).a(PacketPlayOutAbilities.class, PacketPlayOutAbilities::new).a(PacketPlayOutCombatEvent.class, PacketPlayOutCombatEvent::new).a(PacketPlayOutPlayerInfo.class, PacketPlayOutPlayerInfo::new).a(PacketPlayOutLookAt.class, PacketPlayOutLookAt::new).a(PacketPlayOutPosition.class, PacketPlayOutPosition::new).a(PacketPlayOutRecipes.class, PacketPlayOutRecipes::new).a(PacketPlayOutEntityDestroy.class, PacketPlayOutEntityDestroy::new).a(PacketPlayOutRemoveEntityEffect.class, PacketPlayOutRemoveEntityEffect::new).a(PacketPlayOutResourcePackSend.class, PacketPlayOutResourcePackSend::new).a(PacketPlayOutRespawn.class, PacketPlayOutRespawn::new).a(PacketPlayOutEntityHeadRotation.class, PacketPlayOutEntityHeadRotation::new).a(PacketPlayOutMultiBlockChange.class, PacketPlayOutMultiBlockChange::new).a(PacketPlayOutSelectAdvancementTab.class, PacketPlayOutSelectAdvancementTab::new).a(PacketPlayOutWorldBorder.class, PacketPlayOutWorldBorder::new).a(PacketPlayOutCamera.class, PacketPlayOutCamera::new).a(PacketPlayOutHeldItemSlot.class, PacketPlayOutHeldItemSlot::new).a(PacketPlayOutViewCentre.class, PacketPlayOutViewCentre::new).a(PacketPlayOutViewDistance.class, PacketPlayOutViewDistance::new).a(PacketPlayOutSpawnPosition.class, PacketPlayOutSpawnPosition::new).a(PacketPlayOutScoreboardDisplayObjective.class, PacketPlayOutScoreboardDisplayObjective::new).a(PacketPlayOutEntityMetadata.class, PacketPlayOutEntityMetadata::new).a(PacketPlayOutAttachEntity.class, PacketPlayOutAttachEntity::new).a(PacketPlayOutEntityVelocity.class, PacketPlayOutEntityVelocity::new).a(PacketPlayOutEntityEquipment.class, PacketPlayOutEntityEquipment::new).a(PacketPlayOutExperience.class, PacketPlayOutExperience::new).a(PacketPlayOutUpdateHealth.class, PacketPlayOutUpdateHealth::new).a(PacketPlayOutScoreboardObjective.class, PacketPlayOutScoreboardObjective::new).a(PacketPlayOutMount.class, PacketPlayOutMount::new).a(PacketPlayOutScoreboardTeam.class, PacketPlayOutScoreboardTeam::new).a(PacketPlayOutScoreboardScore.class, PacketPlayOutScoreboardScore::new).a(PacketPlayOutUpdateTime.class, PacketPlayOutUpdateTime::new).a(PacketPlayOutTitle.class, PacketPlayOutTitle::new).a(PacketPlayOutEntitySound.class, PacketPlayOutEntitySound::new).a(PacketPlayOutNamedSoundEffect.class, PacketPlayOutNamedSoundEffect::new).a(PacketPlayOutStopSound.class, PacketPlayOutStopSound::new).a(PacketPlayOutPlayerListHeaderFooter.class, PacketPlayOutPlayerListHeaderFooter::new).a(PacketPlayOutNBTQuery.class, PacketPlayOutNBTQuery::new).a(PacketPlayOutCollect.class, PacketPlayOutCollect::new).a(PacketPlayOutEntityTeleport.class, PacketPlayOutEntityTeleport::new).a(PacketPlayOutAdvancements.class, PacketPlayOutAdvancements::new).a(PacketPlayOutUpdateAttributes.class, PacketPlayOutUpdateAttributes::new).a(PacketPlayOutEntityEffect.class, PacketPlayOutEntityEffect::new).a(PacketPlayOutRecipeUpdate.class, PacketPlayOutRecipeUpdate::new).a(PacketPlayOutTags.class, PacketPlayOutTags::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketPlayInTeleportAccept.class, PacketPlayInTeleportAccept::new).a(PacketPlayInTileNBTQuery.class, PacketPlayInTileNBTQuery::new).a(PacketPlayInDifficultyChange.class, PacketPlayInDifficultyChange::new).a(PacketPlayInChat.class, PacketPlayInChat::new).a(PacketPlayInClientCommand.class, PacketPlayInClientCommand::new).a(PacketPlayInSettings.class, PacketPlayInSettings::new).a(PacketPlayInTabComplete.class, PacketPlayInTabComplete::new).a(PacketPlayInTransaction.class, PacketPlayInTransaction::new).a(PacketPlayInEnchantItem.class, PacketPlayInEnchantItem::new).a(PacketPlayInWindowClick.class, PacketPlayInWindowClick::new).a(PacketPlayInCloseWindow.class, PacketPlayInCloseWindow::new).a(PacketPlayInCustomPayload.class, PacketPlayInCustomPayload::new).a(PacketPlayInBEdit.class, PacketPlayInBEdit::new).a(PacketPlayInEntityNBTQuery.class, PacketPlayInEntityNBTQuery::new).a(PacketPlayInUseEntity.class, PacketPlayInUseEntity::new).a(PacketPlayInJigsawGenerate.class, PacketPlayInJigsawGenerate::new).a(PacketPlayInKeepAlive.class, PacketPlayInKeepAlive::new).a(PacketPlayInDifficultyLock.class, PacketPlayInDifficultyLock::new).a(PacketPlayInFlying.PacketPlayInPosition.class, PacketPlayInFlying.PacketPlayInPosition::new).a(PacketPlayInFlying.PacketPlayInPositionLook.class, PacketPlayInFlying.PacketPlayInPositionLook::new).a(PacketPlayInFlying.PacketPlayInLook.class, PacketPlayInFlying.PacketPlayInLook::new).a(PacketPlayInFlying.class, PacketPlayInFlying::new).a(PacketPlayInVehicleMove.class, PacketPlayInVehicleMove::new).a(PacketPlayInBoatMove.class, PacketPlayInBoatMove::new).a(PacketPlayInPickItem.class, PacketPlayInPickItem::new).a(PacketPlayInAutoRecipe.class, PacketPlayInAutoRecipe::new).a(PacketPlayInAbilities.class, PacketPlayInAbilities::new).a(PacketPlayInBlockDig.class, PacketPlayInBlockDig::new).a(PacketPlayInEntityAction.class, PacketPlayInEntityAction::new).a(PacketPlayInSteerVehicle.class, PacketPlayInSteerVehicle::new).a(PacketPlayInRecipeSettings.class, PacketPlayInRecipeSettings::new).a(PacketPlayInRecipeDisplayed.class, PacketPlayInRecipeDisplayed::new).a(PacketPlayInItemName.class, PacketPlayInItemName::new).a(PacketPlayInResourcePackStatus.class, PacketPlayInResourcePackStatus::new).a(PacketPlayInAdvancements.class, PacketPlayInAdvancements::new).a(PacketPlayInTrSel.class, PacketPlayInTrSel::new).a(PacketPlayInBeacon.class, PacketPlayInBeacon::new).a(PacketPlayInHeldItemSlot.class, PacketPlayInHeldItemSlot::new).a(PacketPlayInSetCommandBlock.class, PacketPlayInSetCommandBlock::new).a(PacketPlayInSetCommandMinecart.class, PacketPlayInSetCommandMinecart::new).a(PacketPlayInSetCreativeSlot.class, PacketPlayInSetCreativeSlot::new).a(PacketPlayInSetJigsaw.class, PacketPlayInSetJigsaw::new).a(PacketPlayInStruct.class, PacketPlayInStruct::new).a(PacketPlayInUpdateSign.class, PacketPlayInUpdateSign::new).a(PacketPlayInArmAnimation.class, PacketPlayInArmAnimation::new).a(PacketPlayInSpectate.class, PacketPlayInSpectate::new).a(PacketPlayInUseItem.class, PacketPlayInUseItem::new).a(PacketPlayInBlockPlace.class, PacketPlayInBlockPlace::new))), STATUS(1, b().a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketStatusInStart.class, PacketStatusInStart::new).a(PacketStatusInPing.class, PacketStatusInPing::new)).a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketStatusOutServerInfo.class, PacketStatusOutServerInfo::new).a(PacketStatusOutPong.class, PacketStatusOutPong::new))), LOGIN(2, b().a(EnumProtocolDirection.CLIENTBOUND, (new EnumProtocol.a()).a(PacketLoginOutDisconnect.class, PacketLoginOutDisconnect::new).a(PacketLoginOutEncryptionBegin.class, PacketLoginOutEncryptionBegin::new).a(PacketLoginOutSuccess.class, PacketLoginOutSuccess::new).a(PacketLoginOutSetCompression.class, PacketLoginOutSetCompression::new).a(PacketLoginOutCustomPayload.class, PacketLoginOutCustomPayload::new)).a(EnumProtocolDirection.SERVERBOUND, (new EnumProtocol.a()).a(PacketLoginInStart.class, PacketLoginInStart::new).a(PacketLoginInEncryptionBegin.class, PacketLoginInEncryptionBegin::new).a(PacketLoginInCustomPayload.class, PacketLoginInCustomPayload::new))); - - private static final EnumProtocol[] e = new EnumProtocol[4]; - private static final Map>, EnumProtocol> f = Maps.newHashMap(); -@@ -98,7 +99,7 @@ public enum EnumProtocol { - private final List>> b; - - private a() { -- this.a = (Object2IntMap) SystemUtils.a((Object) (new Object2IntOpenHashMap()), (object2intopenhashmap) -> { -+ this.a = (Object2IntMap) SystemUtils.a(new Object2IntOpenHashMap(), (object2intopenhashmap) -> { // Paper - fix decompile error - object2intopenhashmap.defaultReturnValue(-1); - }); - this.b = Lists.newArrayList(); -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index eeb45fb34b1a989f850049bf4fd59d585c79ab6d..ac2f4354e8c442a20b842f315a76a3abdcfec4dc 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +index 6abf1459cc97c261daf3c116521574d31a77a338..2b2c03ab62816f3d21ef953c4a45f55e3997cca6 100644 +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java @@ -55,7 +55,7 @@ public abstract class IAsyncTaskHandler implements Mailbox { - } else { - IBlockState iblockstate = (IBlockState) entry.getKey(); +diff --git a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java +index e872e5c9157ca499491042040f0cc0f14f7d2946..2efca1fe92b2e93dcbf5337eea8855b1b2b9a564 100644 +--- a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java ++++ b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java +@@ -100,7 +100,7 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { -- return iblockstate.getName() + "=" + this.a(iblockstate, (Comparable) entry.getValue()); -+ return iblockstate.getName() + "=" + this.a((IBlockState) iblockstate, (Comparable) entry.getValue()); // Paper - decompile fix - } + public void run() { + try { +- this.a((i) -> { ++ this.a((int i) -> { // Paper - decompile fix + return i == 0; + }); + } finally { +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +index fe5dcce3873ca2724ac9d416d6f5d3c65d0fdafe..aa1d948e6aebef25f0f4c4c07f5131d2e8387e59 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +@@ -191,9 +191,9 @@ public class VillagePlace extends RegionFileSection { + } + + private static boolean a(ChunkSection chunksection) { +- Set set = VillagePlaceType.x; ++ Set set = VillagePlaceType.x; // Paper - decompile error + +- set.getClass(); ++ //set.getClass(); // Paper - decompile error + return chunksection.a(set::contains); + } + +@@ -211,7 +211,7 @@ public class VillagePlace extends RegionFileSection { + SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> { + return Pair.of(sectionposition, this.d(sectionposition.s())); + }).filter((pair) -> { +- return !(Boolean) ((Optional) pair.getSecond()).map(VillagePlaceSection::a).orElse(false); ++ return !(Boolean) (pair.getSecond()).map(VillagePlaceSection::a).orElse(false); // Paper - decompile fix + }).map((pair) -> { + return ((SectionPosition) pair.getFirst()).r(); + }).filter((chunkcoordintpair) -> { +@@ -263,7 +263,7 @@ public class VillagePlace extends RegionFileSection { + + private final Predicate d; + +- private Occupancy(Predicate predicate) { ++ private Occupancy(Predicate predicate) { // Paper - decompile fix + this.d = predicate; } -- private > String a(IBlockState iblockstate, Comparable comparable) { -+ private > String a(IBlockState iblockstate, T comparable) { // Paper - decompile error - return iblockstate.a(comparable); +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +index fc1f0cd4b70cdd0dda538d8867fab4cb8443120e..c181d5f5e6108ade54fc97c665897d1db5e90719 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +@@ -65,7 +65,7 @@ public class EntityVindicator extends EntityIllagerAbstract { + this.goalSelector.a(2, new EntityIllagerAbstract.b(this)); + this.goalSelector.a(3, new EntityRaider.a(this, 10.0F)); + this.goalSelector.a(4, new EntityVindicator.c(this)); +- this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a()); ++ this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityRaider.class})).a(new Class[0])); // Paper - decompile fix + this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, true)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, true)); + this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, true)); +diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +index fe1dde99f758daa730acacc78237d92aa443ab6d..764ff5d9ffb541a356a6bc8b321e619849dde747 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java ++++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +@@ -47,12 +47,12 @@ import net.minecraft.world.level.saveddata.maps.WorldMap; + + public class VillagerTrades { + +- public static final Map> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { ++ public static final Map> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix + hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHEAT, 20, 16, 2), new VillagerTrades.b(Items.POTATO, 26, 16, 2), new VillagerTrades.b(Items.CARROT, 22, 16, 2), new VillagerTrades.b(Items.BEETROOT, 15, 16, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.PUMPKIN, 6, 12, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 12, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Blocks.CAKE, 1, 1, 12, 15), new VillagerTrades.i(MobEffects.NIGHT_VISION, 100, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)}))); +- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); ++ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // Paper - add to ImmutableMap..builder() + hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 16, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHITE_DYE, 12, 16, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 16, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 16, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.YELLOW_DYE, 12, 16, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 16, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 16, 20), new VillagerTrades.b(Items.RED_DYE, 12, 16, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 16, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BROWN_DYE, 12, 16, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 16, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 16, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 16, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 16, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 16, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 12, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.PAINTING, 2, 3, 30)}))); + hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.es, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); +- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); ++ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - add to ImmutableMap..builder() + hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dP, 11, 16, 10), new VillagerTrades.k(13, StructureGenerator.MONUMENT, MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, StructureGenerator.MANSION, MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); + hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 16, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.GOLD_INGOT, 3, 12, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.RABBIT_FOOT, 2, 12, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SCUTE, 4, 12, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 12, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.NETHER_WART, 22, 12, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)}))); + hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.rj), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); +diff --git a/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java b/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java +index 54a636a3d5fdd0107cd0a41167ab1626469fe042..5ba58bf1a47c696235e6e7a4a6815104bc23de80 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java ++++ b/src/main/java/net/minecraft/world/item/crafting/CraftingManager.java +@@ -75,7 +75,7 @@ public class CraftingManager extends ResourceDataJson { } - }; -@@ -47,11 +47,11 @@ public abstract class IBlockDataHolder { + + this.recipes = (Map) map1.entrySet().stream().collect(ImmutableMap.toImmutableMap(Entry::getKey, (entry1) -> { +- return (entry1.getValue()); // CraftBukkit ++ return entry1.getValue(); // CraftBukkit // Paper - decompile fix - *shrugs internally* + })); + CraftingManager.LOGGER.info("Loaded {} recipes", map1.size()); } - - public > S a(IBlockState iblockstate) { -- return this.set(iblockstate, (Comparable) a(iblockstate.getValues(), (Object) this.get(iblockstate))); -+ return this.set(iblockstate, a(iblockstate.getValues(), this.get(iblockstate))); // Paper - decompile error - } - - protected static T a(Collection collection, T t0) { -- Iterator iterator = collection.iterator(); -+ Iterator iterator = collection.iterator(); // Paper - - do { - if (!iterator.hasNext()) { -@@ -93,7 +93,7 @@ public abstract class IBlockDataHolder { - if (comparable == null) { - throw new IllegalArgumentException("Cannot get property " + iblockstate + " as it does not exist in " + this.c); - } else { -- return (Comparable) iblockstate.getType().cast(comparable); -+ return iblockstate.getType().cast(comparable); // Paper - decompile error - } - } - -@@ -109,7 +109,7 @@ public abstract class IBlockDataHolder { - if (comparable == null) { - throw new IllegalArgumentException("Cannot set property " + iblockstate + " as it does not exist in " + this.c); - } else if (comparable == v0) { -- return this; -+ return (S) this; // Paper - decompile error - } else { - S s0 = this.e.get(iblockstate, v0); - -@@ -161,7 +161,7 @@ public abstract class IBlockDataHolder { - return codec.dispatch("Name", (iblockdataholder) -> { - return iblockdataholder.c; - }, (object) -> { -- S s0 = (IBlockDataHolder) function.apply(object); -+ S s0 = function.apply(object); // Paper - decompile error - - return s0.getStateMap().isEmpty() ? Codec.unit(s0) : s0.d.fieldOf("Properties").codec(); - }); -diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java -index 88f1f201240ef0479c4f0f93f4caca454bbe7e9e..d63a4e4916ed5f5d901be0f4dd2c13cf66239055 100644 ---- a/src/main/java/net/minecraft/server/IBlockState.java -+++ b/src/main/java/net/minecraft/server/IBlockState.java -@@ -16,12 +16,10 @@ public abstract class IBlockState> { - private final Codec> e; - - protected IBlockState(String s, Class oclass) { -- this.d = Codec.STRING.comapFlatMap((s1) -> { -- return (DataResult) this.b(s1).map(DataResult::success).orElseGet(() -> { -- return DataResult.error("Unable to read property: " + this + " with value: " + s1); -- }); -- }, this::a); -- this.e = this.d.xmap(this::b, IBlockState.a::b); -+ this.d = Codec.STRING.comapFlatMap((s1) -> this.b(s1).map(DataResult::success).orElseGet(() -> { // Paper - decompile error -+ return DataResult.error("Unable to read property: " + this + " with value: " + s1); -+ }), this::a); -+ this.e = this.d.xmap(this::b, (IBlockState.a param) -> param.b()); // Paper - decompile fix - this.a = oclass; - this.b = s; - } -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 931959013cf017ce622fb9f8516c5bf604eb8a69..f433e1f6e6d430bd35a0fb54ee85295ea06f53bd 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -158,22 +158,22 @@ public interface IEntityAccess { +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index d24f97593777d6929271520f7501a800f1aadaa6..4ece69851e7b05016f52c291ce911eb791cf3a23 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java +@@ -167,22 +167,22 @@ public interface IEntityAccess { @Nullable default T a(Class oclass, PathfinderTargetCondition pathfindertargetcondition, @Nullable EntityLiving entityliving, double d0, double d1, double d2, AxisAlignedBB axisalignedbb) { @@ -358,7 +508,7 @@ index 931959013cf017ce622fb9f8516c5bf604eb8a69..f433e1f6e6d430bd35a0fb54ee85295e if (pathfindertargetcondition.a(entityliving, t1)) { double d4 = t1.h(d0, d1, d2); -@@ -206,10 +206,10 @@ public interface IEntityAccess { +@@ -215,10 +215,10 @@ public interface IEntityAccess { default List a(Class oclass, PathfinderTargetCondition pathfindertargetcondition, EntityLiving entityliving, AxisAlignedBB axisalignedbb) { List list = this.a(oclass, axisalignedbb, (Predicate) null); List list1 = Lists.newArrayList(); @@ -371,187 +521,11 @@ index 931959013cf017ce622fb9f8516c5bf604eb8a69..f433e1f6e6d430bd35a0fb54ee85295e if (pathfindertargetcondition.a(entityliving, t0)) { list1.add(t0); -diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java -index c5a95f51ba43b94fd07f8df6576f45c3dd0216a3..38ccfd78639a85abcefb915c5c231be5881cebc1 100644 ---- a/src/main/java/net/minecraft/server/IOWorker.java -+++ b/src/main/java/net/minecraft/server/IOWorker.java -@@ -83,7 +83,7 @@ public class IOWorker implements AutoCloseable { - return this.a(() -> { - try { - this.d.a(); -- return Either.left((Object) null); -+ return Either.left(null); // Paper - decompile error - } catch (Exception exception) { - IOWorker.LOGGER.warn("Failed to synchronized chunks", exception); - return Either.right(exception); -@@ -117,13 +117,13 @@ public class IOWorker implements AutoCloseable { - } - - private void c() { -- this.c.a((Object) (new PairedQueue.b(IOWorker.Priority.LOW.ordinal(), this::b))); -+ this.c.a((new PairedQueue.b(IOWorker.Priority.LOW.ordinal(), this::b))); // Paper - decompile error - } - - private void a(ChunkCoordIntPair chunkcoordintpair, IOWorker.a ioworker_a) { - try { - this.d.write(chunkcoordintpair, ioworker_a.a); -- ioworker_a.b.complete((Object) null); -+ ioworker_a.b.complete(null); // Paper - decompile fix - } catch (Exception exception) { - IOWorker.LOGGER.error("Failed to store chunk {}", chunkcoordintpair, exception); - ioworker_a.b.completeExceptionally(exception); -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -index 1e1f7ec6e6e6fc698a8a5118ce21321d104dc5eb..75d9065b32731dc635d9d09c48fb9643172381a9 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -@@ -28,10 +28,10 @@ public class LightEngineStorageSky extends LightEngineStorage= l) { -diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java -index 144279f278b363725bd0e2f8844f13a5ea1bb39d..f8c2b957bb5b38f05251cccf5137a9c23262c3d6 100644 ---- a/src/main/java/net/minecraft/server/LightEngineThreaded.java -+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java -@@ -167,7 +167,7 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { - - public void queueUpdate() { - if ((!this.c.isEmpty() || super.a()) && this.g.compareAndSet(false, true)) { -- this.b.a((Object) (() -> { -+ this.b.a((() -> { // Paper - decompile error - this.b(); - this.g.set(false); - })); -diff --git a/src/main/java/net/minecraft/server/LootEntryAbstract.java b/src/main/java/net/minecraft/server/LootEntryAbstract.java -index 8cc8c60d3297a4ed98f3950a3971d83499ad1dfa..788078c209b8bcbd551cf0a52eb6172928d7b5f9 100644 ---- a/src/main/java/net/minecraft/server/LootEntryAbstract.java -+++ b/src/main/java/net/minecraft/server/LootEntryAbstract.java -@@ -36,7 +36,7 @@ public abstract class LootEntryAbstract implements LootEntryChildren { - - // CraftBukkit start - @Override -- public final void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { -+ public void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { // Paper - remove final - if (!org.apache.commons.lang3.ArrayUtils.isEmpty(t0.d)) { - jsonobject.add("conditions", jsonserializationcontext.serialize(t0.d)); - } -diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -index 90da3e630355a127451c99ad9405829116e2c8f2..37ebc9f511479778c131e02b6852b27f63e75bdd 100644 ---- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -+++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -@@ -73,7 +73,7 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional - public b() {} - - public void a(JsonObject jsonobject, LootItemFunctionExplorationMap lootitemfunctionexplorationmap, JsonSerializationContext jsonserializationcontext) { -- super.a(jsonobject, (LootItemFunctionConditional) lootitemfunctionexplorationmap, jsonserializationcontext); -+ super.a(jsonobject, lootitemfunctionexplorationmap, jsonserializationcontext); // Paper - decompile fix - if (!lootitemfunctionexplorationmap.e.equals(LootItemFunctionExplorationMap.a)) { - jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.e.i())); - } -diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index 998101592723abb26c91d1f92e98be1cf24c954d..ee9069c744df63cbb7f21dd9d28d6d554593674c 100644 ---- a/src/main/java/net/minecraft/server/LootSelectorEntry.java -+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java -@@ -123,7 +123,7 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { - @Override - public T b(LootItemFunction.a lootitemfunction_a) { - this.c.add(lootitemfunction_a.b()); -- return (LootSelectorEntry.a) this.d(); -+ return this.d(); // Paper - decompile fix - } - - protected LootItemFunction[] a() { -@@ -132,12 +132,12 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { - - public T a(int i) { - this.a = i; -- return (LootSelectorEntry.a) this.d(); -+ return this.d(); // Paper - decompile fix - } - - public T b(int i) { - this.b = i; -- return (LootSelectorEntry.a) this.d(); -+ return this.d(); // Paper - decompile fix - } - } - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5ead0146ca3c11c53875d323ffd22fe8e055fa7f..2c8674fbdb76a03e87f94779c30e871962de1f4c 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1558,9 +1558,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrantmap(resourcepackrepository::a).filter(Objects::nonNull).map(ResourcePackLoader::d).collect(ImmutableList.toImmutableList()); // CraftBukkit - decompile error // Paper - decompile error - }, this).thenCompose((immutablelist) -> { -- return DataPackResources.a(immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); -+ return DataPackResources.a((List) immutablelist, this.j() ? CommandDispatcher.ServerType.DEDICATED : CommandDispatcher.ServerType.INTEGRATED, this.h(), this.executorService, this); // Paper - decompile error - }).thenAcceptAsync((datapackresources) -> { - this.dataPackResources.close(); - this.dataPackResources = datapackresources; -diff --git a/src/main/java/net/minecraft/server/NBTBase.java b/src/main/java/net/minecraft/server/NBTBase.java -index 829a7ae0a2b77205fb8e8c5754d0d4333afa224d..8b9e47b4c7f5dc464fa617a59583df9e30a54045 100644 ---- a/src/main/java/net/minecraft/server/NBTBase.java -+++ b/src/main/java/net/minecraft/server/NBTBase.java -@@ -18,7 +18,7 @@ public interface NBTBase { - - NBTTagType b(); - -- NBTBase clone(); -+ public NBTBase clone(); // Paper - decompile fix - - default String asString() { - return this.toString(); -diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index 641d4a69cb2747417d483c56d460d12d1c6165d2..f9738fb0df2704251af0a45b56e34cc005c6ec37 100644 ---- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -14,6 +14,7 @@ import java.io.InputStream; - import java.io.OutputStream; - import java.util.zip.GZIPInputStream; - import java.util.zip.GZIPOutputStream; -+import io.netty.buffer.ByteBufInputStream; // Paper - - public class NBTCompressedStreamTools { - -@@ -133,7 +134,7 @@ public class NBTCompressedStreamTools { - - public static NBTTagCompound a(DataInput datainput, NBTReadLimiter nbtreadlimiter) throws IOException { - // Spigot start -- if ( datainput instanceof io.netty.buffer.ByteBufInputStream ) -+ if ( datainput instanceof ByteBufInputStream) // Paper - { - datainput = new DataInputStream(new org.spigotmc.LimitStream((InputStream) datainput, nbtreadlimiter)); - } -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index b8bb5027ecccfc9b664145a1bfe3755f1a8af3eb..ad8a506bb430b26fe147a657a2f826daf9bf4d45 100644 ---- a/src/main/java/net/minecraft/server/NBTTagList.java -+++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -51,7 +51,7 @@ public class NBTTagList extends NBTList { - return "TAG_List"; - } - }; -- private static final ByteSet b = new ByteOpenHashSet(Arrays.asList(1, 2, 3, 4, 5, 6)); -+ private static final ByteSet b = new ByteOpenHashSet(Arrays.asList((byte) 1, (byte) 2, (byte) 3, (byte) 4, (byte) 5, (byte) 6)); // Paper - decompiler fix - private final List list; - private byte type; - -diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java -index 8471920b8b92f0bbd0d3ee827e1b0a120f405f6c..e9c405fb5376c5733b9b0191cd5309173f4021e8 100644 ---- a/src/main/java/net/minecraft/server/NextTickListEntry.java -+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java -@@ -37,13 +37,13 @@ public class NextTickListEntry { +diff --git a/src/main/java/net/minecraft/world/level/NextTickListEntry.java b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +index 116a5e4ded3ccf935fd143f2512098c22ec2ad76..f3bcb96232d18abbcd86b079a7c5830bb30d75d2 100644 +--- a/src/main/java/net/minecraft/world/level/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +@@ -38,13 +38,13 @@ public class NextTickListEntry { return this.a.hashCode(); } @@ -569,88 +543,193 @@ index 8471920b8b92f0bbd0d3ee827e1b0a120f405f6c..e9c405fb5376c5733b9b0191cd530917 }); } -diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 7f89562e90ede1bdd06b71c0798d986ccbb7886e..06ea0c3bfcb54a5f6a42363f633800c687b6f19d 100644 ---- a/src/main/java/net/minecraft/server/RegistryBlockID.java -+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -27,7 +27,7 @@ public class RegistryBlockID implements Registry { - this.b.put(t0, i); +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +index 6672d74426d6a334d52f641c48d3a352c2bb6605..7147cdda756ccb3d4f6880802128f68601783883 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +@@ -49,8 +49,15 @@ import org.apache.logging.log4j.Logger; + public final class BiomeBase { - while (this.c.size() <= i) { -- this.c.add((Object) null); -+ this.c.add(null); // Paper - decompile fix + public static final Logger LOGGER = LogManager.getLogger(); ++ // Paper start ++ private static class dProxy extends BiomeBase.d { ++ private dProxy(Precipitation biomebase_precipitation, float f, TemperatureModifier biomebase_temperaturemodifier, float f1) { ++ super(biomebase_precipitation, f, biomebase_temperaturemodifier, f1); ++ } ++ }; ++ // Paper end + public static final Codec b = RecordCodecBuilder.create((instance) -> { +- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { ++ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper + return biomebase.j; + }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { + return biomebase.o; +@@ -67,7 +74,7 @@ public final class BiomeBase { + })).apply(instance, BiomeBase::new); + }); + public static final Codec c = RecordCodecBuilder.create((instance) -> { +- return instance.group(BiomeBase.d.a.forGetter((biomebase) -> { ++ return instance.group(dProxy.a.forGetter((biomebase) -> { // Paper + return biomebase.j; + }), BiomeBase.Geography.r.fieldOf("category").forGetter((biomebase) -> { + return biomebase.o; +diff --git a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +index a549195e67236c0146861b896fb9e4907073af58..8d13e60f40e1b760e9e69969dc3f37bc6c70dbe9 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +@@ -160,7 +160,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { + private static void a(EnumDirection enumdirection, Entity entity, double d0, EnumDirection enumdirection1) { + TileEntityPiston.h.set(enumdirection); + entity.move(EnumMoveType.PISTON, new Vec3D(d0 * (double) enumdirection1.getAdjacentX(), d0 * (double) enumdirection1.getAdjacentY(), d0 * (double) enumdirection1.getAdjacentZ())); +- TileEntityPiston.h.set((Object) null); ++ TileEntityPiston.h.set(null); // Paper - decompile fix + } + + private void g(float f) { +diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +index 074bd5f060c6bb80568b72d23ce84c27ba774578..e4b59a85ee9b435b2e86d4c7d78b7224773f6967 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java ++++ b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +@@ -28,11 +28,11 @@ public abstract class IBlockDataHolder { + } else { + IBlockState iblockstate = (IBlockState) entry.getKey(); + +- return iblockstate.getName() + "=" + this.a(iblockstate, (Comparable) entry.getValue()); ++ return iblockstate.getName() + "=" + this.a((IBlockState) iblockstate, (Comparable) entry.getValue()); // Paper - decompile fix + } } - this.c.set(i, t0); -@@ -41,6 +41,13 @@ public class RegistryBlockID implements Registry { - this.a(t0, this.a); +- private > String a(IBlockState iblockstate, Comparable comparable) { ++ private > String a(IBlockState iblockstate, T comparable) { // Paper - decompile error + return iblockstate.a(comparable); + } + }; +@@ -48,11 +48,11 @@ public abstract class IBlockDataHolder { } -+ // Paper start - decompile fix -+ @Override -+ public int a(T t) { -+ return getId(t); -+ } -+ // Paper end -+ - public int getId(T t0) { - Integer integer = (Integer) this.b.get(t0); - -diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index e11deed00abc10d1a9490234830803649209dfb4..5078a5ce391b445b64b2a16b123a3e3d5841619b 100644 ---- a/src/main/java/net/minecraft/server/RegistryID.java -+++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -17,11 +17,18 @@ public class RegistryID implements Registry { - - public RegistryID(int i) { - i = (int) ((float) i / 0.8F); -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix - this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix + public > S a(IBlockState iblockstate) { +- return this.set(iblockstate, (Comparable) a(iblockstate.getValues(), (Object) this.get(iblockstate))); ++ return this.set(iblockstate, a(iblockstate.getValues(), this.get(iblockstate))); // Paper - decompile error } -+ // Paper start - decompile fix -+ @Override -+ public int a(K k) { -+ return getId(k); -+ } -+ // Paper end -+ - public int getId(@Nullable K k0) { - return this.c(this.b(k0, this.d(k0))); + protected static T a(Collection collection, T t0) { +- Iterator iterator = collection.iterator(); ++ Iterator iterator = collection.iterator(); // Paper + + do { + if (!iterator.hasNext()) { +@@ -94,7 +94,7 @@ public abstract class IBlockDataHolder { + if (comparable == null) { + throw new IllegalArgumentException("Cannot get property " + iblockstate + " as it does not exist in " + this.c); + } else { +- return (Comparable) iblockstate.getType().cast(comparable); ++ return iblockstate.getType().cast(comparable); // Paper - decompile error + } } -@@ -55,9 +62,9 @@ public class RegistryID implements Registry { - K[] ak = this.b; - int[] aint = this.c; -- this.b = (Object[]) (new Object[i]); -+ this.b = (K[]) (new Object[i]); // Paper - decompile fix - this.c = new int[i]; -- this.d = (Object[]) (new Object[i]); -+ this.d = (K[]) (new Object[i]); // Paper - decompile fix - this.e = 0; - this.f = 0; +@@ -110,7 +110,7 @@ public abstract class IBlockDataHolder { + if (comparable == null) { + throw new IllegalArgumentException("Cannot set property " + iblockstate + " as it does not exist in " + this.c); + } else if (comparable == v0) { +- return this; ++ return (S) this; // Paper - decompile error + } else { + S s0 = this.e.get(iblockstate, v0); -diff --git a/src/main/java/net/minecraft/server/ServerStatisticManager.java b/src/main/java/net/minecraft/server/ServerStatisticManager.java -index b9def4d603f469aa2db8c9399b5634a313aa7e44..6ee2f5ba23d573414e31ed2be228adf87e5bf46a 100644 ---- a/src/main/java/net/minecraft/server/ServerStatisticManager.java -+++ b/src/main/java/net/minecraft/server/ServerStatisticManager.java -@@ -191,7 +191,7 @@ public class ServerStatisticManager extends StatisticManager { - ObjectIterator objectiterator = this.a.object2IntEntrySet().iterator(); +@@ -162,7 +162,7 @@ public abstract class IBlockDataHolder { + return codec.dispatch("Name", (iblockdataholder) -> { + return iblockdataholder.c; + }, (object) -> { +- S s0 = (IBlockDataHolder) function.apply(object); ++ S s0 = function.apply(object); // Paper - decompile error - while (objectiterator.hasNext()) { -- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry> it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); -+ Object2IntMap.Entry> it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix - Statistic statistic = (Statistic) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey(); + return s0.getStateMap().isEmpty() ? Codec.unit(s0) : s0.d.fieldOf("Properties").codec(); + }); +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java +index a6aaf0efed5a9c5e458ca04a80a7a5e71a31d886..de85894beae7ee7d276cf2af3daa77377ce131c3 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java +@@ -21,10 +21,10 @@ public class BlockStateEnum & INamable> extends IBlockState + protected BlockStateEnum(String s, Class oclass, Collection collection) { + super(s, oclass); + this.a = ImmutableSet.copyOf(collection); +- Iterator iterator = collection.iterator(); ++ Iterator iterator = collection.iterator(); // Paper - decompile fix - ((JsonObject) map.computeIfAbsent(statistic.getWrapper(), (statisticwrapper) -> { -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index e0e1a133e16b52732963df202202c50a63aa34a1..a8e3bbd18e08678e55aa88b09a9f7feb37ab4761 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -38,13 +38,13 @@ public abstract class StructureGenerator + while (iterator.hasNext()) { +- T t0 = (Enum) iterator.next(); ++ T t0 = iterator.next(); // Paper - Decompile fix + String s1 = ((INamable) t0).getName(); + + if (this.b.containsKey(s1)) { +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java +index 3e6ba74027685c6190426c825736e84cda87ca63..e3969bad5be64bb41e2973751605d6820c16f021 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java +@@ -17,12 +17,10 @@ public abstract class IBlockState> { + private final Codec> e; + + protected IBlockState(String s, Class oclass) { +- this.d = Codec.STRING.comapFlatMap((s1) -> { +- return (DataResult) this.b(s1).map(DataResult::success).orElseGet(() -> { +- return DataResult.error("Unable to read property: " + this + " with value: " + s1); +- }); +- }, this::a); +- this.e = this.d.xmap(this::b, IBlockState.a::b); ++ this.d = Codec.STRING.comapFlatMap((s1) -> this.b(s1).map(DataResult::success).orElseGet(() -> { // Paper - decompile error ++ return DataResult.error("Unable to read property: " + this + " with value: " + s1); ++ }), this::a); ++ this.e = this.d.xmap(this::b, (IBlockState.a param) -> param.b()); // Paper - decompile fix + this.a = oclass; + this.b = s; + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java +index 88c2643a18165bd7a9e6e056b926d6e894ff60d4..859561a5dccba6548967b685b20e8fcfc296db2a 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java +@@ -89,7 +89,7 @@ public class IOWorker implements AutoCloseable { + return this.a(() -> { + try { + this.d.a(); +- return Either.left((Object) null); ++ return Either.left(null); // Paper - decompile error + } catch (Exception exception) { + IOWorker.LOGGER.warn("Failed to synchronized chunks", exception); + return Either.right(exception); +@@ -123,13 +123,13 @@ public class IOWorker implements AutoCloseable { + } + + private void c() { +- this.c.a((Object) (new PairedQueue.b(IOWorker.Priority.LOW.ordinal(), this::b))); ++ this.c.a((new PairedQueue.b(IOWorker.Priority.LOW.ordinal(), this::b))); // Paper - decompile error + } + + private void a(ChunkCoordIntPair chunkcoordintpair, IOWorker.a ioworker_a) { + try { + this.d.write(chunkcoordintpair, ioworker_a.a); +- ioworker_a.b.complete((Object) null); ++ ioworker_a.b.complete(null); // Paper - decompile fix + } catch (Exception exception) { + IOWorker.LOGGER.error("Failed to store chunk {}", chunkcoordintpair, exception); + ioworker_a.b.completeExceptionally(exception); +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +index 6fb0c92e7cb6117d919af613dae87fa4e99f5081..f727cc456bd23816c4e70be83c395d1d8ca7d876 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -430,7 +430,7 @@ public class EnderDragonBattle { + } + } + +- worldgenendtrophy.b((WorldGenFeatureConfiguration) WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); ++ worldgenendtrophy.b(WorldGenFeatureConfiguration.k).a(this.world, this.world.getChunkProvider().getChunkGenerator(), new Random(), this.exitPortalLocation); // Paper - decompile fix + } + + private EntityEnderDragon o() { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +index 44ad3fb2551f681b58b82e7c4f56bbc5a3b4486e..6724927be178cb9a358a9276d01894a63154b7b3 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +@@ -71,13 +71,13 @@ public abstract class StructureGenerator public static final StructureGenerator BASTION_REMNANT = a("Bastion_Remnant", new WorldGenFeatureBastionRemnant(WorldGenFeatureVillageConfiguration.a), WorldGenStage.Decoration.SURFACE_STRUCTURES); public static final List> t = ImmutableList.of(StructureGenerator.PILLAGER_OUTPOST, StructureGenerator.VILLAGE, StructureGenerator.NETHER_FOSSIL); private static final MinecraftKey w = new MinecraftKey("jigsaw"); @@ -666,147 +745,112 @@ index e0e1a133e16b52732963df202202c50a63aa34a1..a8e3bbd18e08678e55aa88b09a9f7feb } public StructureGenerator(Codec codec) { -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 7b17c95ff7b529a62be60e9599149a7880d60ac5..5f3a960b3303c48b039630b39975d6ef549a4dbe 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -59,8 +59,8 @@ public class SystemUtils { - return Collectors.toMap(Entry::getKey, Entry::getValue); - } +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +index 52564cce4146f49a906729b3ed9488a7a829ea3f..befc8f846c772d58ee687ad427bb71206b4dc43e 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +@@ -34,10 +34,10 @@ public class LightEngineStorageSky extends LightEngineStorage> String a(IBlockState iblockstate, Object object) { -- return iblockstate.a((Comparable) object); -+ public static > String a(IBlockState iblockstate, T object) { // Paper - decompile fix -+ return iblockstate.a(object); // Paper - decompile fix - } + if (l != lightenginestoragesky_a.b && k < l) { +- NibbleArray nibblearray = this.a((LightEngineStorageArray) lightenginestoragesky_a, j); ++ NibbleArray nibblearray = this.a(lightenginestoragesky_a, j); // Paper - decompile fix - public static String a(String s, @Nullable MinecraftKey minecraftkey) { -@@ -228,8 +228,8 @@ public class SystemUtils { - public static T b(Iterable iterable, @Nullable T t0) { - Iterator iterator = iterable.iterator(); - -- Object object; -- Object object1; -+ T object; // Paper - decompile fix -+ T object1; // Paper - decompile fix - - for (object1 = null; iterator.hasNext(); object1 = object) { - object = iterator.next(); -@@ -254,7 +254,7 @@ public class SystemUtils { - } - - public static Strategy k() { -- return SystemUtils.IdentityHashingStrategy.INSTANCE; -+ return (Strategy) SystemUtils.IdentityHashingStrategy.INSTANCE; // Paper - decompile fix - } - - public static CompletableFuture> b(List> list) { -@@ -265,7 +265,7 @@ public class SystemUtils { - list.forEach((completablefuture1) -> { - int i = list1.size(); - -- list1.add((Object) null); -+ list1.add(null); // Paper - decompile fix - acompletablefuture[i] = completablefuture1.whenComplete((object, throwable) -> { - if (throwable != null) { - completablefuture.completeExceptionally(throwable); -diff --git a/src/main/java/net/minecraft/server/ThreadedMailbox.java b/src/main/java/net/minecraft/server/ThreadedMailbox.java -index 1b2aa8f74a424c0d313de7d71e691d5c2a963b0b..b7af235dc2841dc9c8296805624f6ee763b86dfb 100644 ---- a/src/main/java/net/minecraft/server/ThreadedMailbox.java -+++ b/src/main/java/net/minecraft/server/ThreadedMailbox.java -@@ -99,7 +99,7 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { - - public void run() { - try { -- this.a((i) -> { -+ this.a((int i) -> { // Paper - decompile fix - return i == 0; - }); - } finally { -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index ee2059cf8ef0a0372e02b91a4bf6fa8a0ab31bca..77bb6b092a0763ff27f90f0401a8a81b15aebb8c 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java -@@ -23,7 +23,7 @@ public final class Ticket implements Comparable> { + if (nibblearray == null) { +- for (i = BlockPosition.f(i); nibblearray == null; nibblearray = this.a((LightEngineStorageArray) lightenginestoragesky_a, j)) { ++ for (i = BlockPosition.f(i); nibblearray == null; nibblearray = this.a(lightenginestoragesky_a, j)) { // Paper - decompile fix + j = SectionPosition.a(j, EnumDirection.UP); + ++k; + if (k >= l) { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java +index 45c1d79e0bb2fcffea31513c3d003d28140146b9..3910daeaa177639fa8055301304634c2014dc20f 100644 +--- a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java +@@ -44,7 +44,7 @@ public class WorldPersistentData { + if (t0 != null) { + return t0; } else { - int j = Integer.compare(System.identityHashCode(this.a), System.identityHashCode(ticket.a)); +- T t1 = (PersistentBase) supplier.get(); ++ T t1 = supplier.get(); // Paper - decompile fix -- return j != 0 ? j : this.a.a().compare(this.identifier, ticket.identifier); -+ return j != 0 ? j : this.a.a().compare(this.identifier, (T)ticket.identifier); // Paper - decompile fix + this.a(t1); + return t1; +@@ -53,7 +53,7 @@ public class WorldPersistentData { + + @Nullable + public T b(Supplier supplier, String s) { +- PersistentBase persistentbase = (PersistentBase) this.data.get(s); ++ T persistentbase = (T) this.data.get(s); // Paper - decompile fix + + if (persistentbase == null && !this.data.containsKey(s)) { + persistentbase = this.c(supplier, s); +@@ -69,7 +69,7 @@ public class WorldPersistentData { + File file = this.a(s); + + if (file.exists()) { +- T t0 = (PersistentBase) supplier.get(); ++ T t0 = supplier.get(); // Paper - decompile fix + NBTTagCompound nbttagcompound = this.a(s, SharedConstants.getGameVersion().getWorldVersion()); + + t0.a(nbttagcompound.getCompound("data")); +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java +index 9421e175fffab7014461aa02e7e36d719837ec11..b6abbe9f1de66cd8e9d2e7127813ce56a0446faf 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootEntryAbstract.java +@@ -43,7 +43,7 @@ public abstract class LootEntryAbstract implements LootEntryChildren { + + // CraftBukkit start + @Override +- public final void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { ++ public void a(JsonObject jsonobject, T t0, JsonSerializationContext jsonserializationcontext) { // Paper - remove final + if (!org.apache.commons.lang3.ArrayUtils.isEmpty(t0.d)) { + jsonobject.add("conditions", jsonserializationcontext.serialize(t0.d)); + } +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java +index 0e3fe138fc11bd7e648296922c651cecaab8e71e..ceb9a1e1b1d55a0a8cd74189450f356b9ad4c46c 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java +@@ -132,7 +132,7 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { + @Override + public T b(LootItemFunction.a lootitemfunction_a) { + this.c.add(lootitemfunction_a.b()); +- return (LootSelectorEntry.a) this.d(); ++ return this.d(); // Paper - decompile fix + } + + protected LootItemFunction[] a() { +@@ -141,12 +141,12 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { + + public T a(int i) { + this.a = i; +- return (LootSelectorEntry.a) this.d(); ++ return this.d(); // Paper - decompile fix + } + + public T b(int i) { + this.b = i; +- return (LootSelectorEntry.a) this.d(); ++ return this.d(); // Paper - decompile fix } } -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index d11d94405c8a6581c632e23ae98eb23e0e43e994..8b2758377b70aaf7a9d21a28d4bbe16389f22403 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -137,7 +137,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { - private static void a(EnumDirection enumdirection, Entity entity, double d0, EnumDirection enumdirection1) { - TileEntityPiston.h.set(enumdirection); - entity.move(EnumMoveType.PISTON, new Vec3D(d0 * (double) enumdirection1.getAdjacentX(), d0 * (double) enumdirection1.getAdjacentY(), d0 * (double) enumdirection1.getAdjacentZ())); -- TileEntityPiston.h.set((Object) null); -+ TileEntityPiston.h.set(null); // Paper - decompile fix - } +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +index f516e7440ed306b1ace9b35ae82f70ca69df51f3..38125a60bad4830db9de3580ab6d85fd122a0689 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +@@ -89,7 +89,7 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional + public b() {} - private void g(float f) { -diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index fffdc4392cbcbdd51c0437b0b783aab5a34183f8..d6aca683465c6898536507fab9e6888fef2e77e5 100644 ---- a/src/main/java/net/minecraft/server/VillagePlace.java -+++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -180,9 +180,9 @@ public class VillagePlace extends RegionFileSection { - } - - private static boolean a(ChunkSection chunksection) { -- Set set = VillagePlaceType.x; -+ Set set = VillagePlaceType.x; // Paper - decompile error - -- set.getClass(); -+ //set.getClass(); // Paper - decompile error - return chunksection.a(set::contains); - } - -@@ -200,7 +200,7 @@ public class VillagePlace extends RegionFileSection { - SectionPosition.b(new ChunkCoordIntPair(blockposition), Math.floorDiv(i, 16)).map((sectionposition) -> { - return Pair.of(sectionposition, this.d(sectionposition.s())); - }).filter((pair) -> { -- return !(Boolean) ((Optional) pair.getSecond()).map(VillagePlaceSection::a).orElse(false); -+ return !(Boolean) (pair.getSecond()).map(VillagePlaceSection::a).orElse(false); // Paper - decompile fix - }).map((pair) -> { - return ((SectionPosition) pair.getFirst()).r(); - }).filter((chunkcoordintpair) -> { -@@ -252,7 +252,7 @@ public class VillagePlace extends RegionFileSection { - - private final Predicate d; - -- private Occupancy(Predicate predicate) { -+ private Occupancy(Predicate predicate) { // Paper - decompile fix - this.d = predicate; - } - -diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java -index a047e8f54e2e1960f4d8be8a05255c774ac2c221..4f7944d7fdaf02bae40ee71a18bd1c9bb4eb891b 100644 ---- a/src/main/java/net/minecraft/server/VillagerTrades.java -+++ b/src/main/java/net/minecraft/server/VillagerTrades.java -@@ -14,12 +14,12 @@ import javax.annotation.Nullable; - - public class VillagerTrades { - -- public static final Map> a = (Map) SystemUtils.a((Object) Maps.newHashMap(), (hashmap) -> { -+ public static final Map> a = SystemUtils.a(Maps.newHashMap(), (hashmap) -> { // Paper - decompile fix - hashmap.put(VillagerProfession.FARMER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHEAT, 20, 16, 2), new VillagerTrades.b(Items.POTATO, 26, 16, 2), new VillagerTrades.b(Items.CARROT, 22, 16, 2), new VillagerTrades.b(Items.BEETROOT, 15, 16, 2), new VillagerTrades.h(Items.BREAD, 1, 6, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.PUMPKIN, 6, 12, 10), new VillagerTrades.h(Items.PUMPKIN_PIE, 1, 4, 5), new VillagerTrades.h(Items.APPLE, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.COOKIE, 3, 18, 10), new VillagerTrades.b(Blocks.MELON, 4, 12, 20)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Blocks.CAKE, 1, 1, 12, 15), new VillagerTrades.i(MobEffects.NIGHT_VISION, 100, 15), new VillagerTrades.i(MobEffects.JUMP, 160, 15), new VillagerTrades.i(MobEffects.WEAKNESS, 140, 15), new VillagerTrades.i(MobEffects.BLINDNESS, 120, 15), new VillagerTrades.i(MobEffects.POISON, 280, 15), new VillagerTrades.i(MobEffects.SATURATION, 7, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GOLDEN_CARROT, 3, 3, 30), new VillagerTrades.h(Items.GLISTERING_MELON_SLICE, 4, 3, 30)}))); -- hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); -+ hashmap.put(VillagerProfession.FISHERMAN, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 20, 16, 2), new VillagerTrades.b(Items.COAL, 10, 16, 2), new VillagerTrades.g(Items.COD, 6, Items.COOKED_COD, 6, 16, 1), new VillagerTrades.h(Items.COD_BUCKET, 3, 1, 16, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COD, 15, 16, 10), new VillagerTrades.g(Items.SALMON, 6, Items.COOKED_SALMON, 6, 16, 5), new VillagerTrades.h(Items.rn, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SALMON, 13, 16, 20), new VillagerTrades.e(Items.FISHING_ROD, 3, 3, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.TROPICAL_FISH, 6, 12, 30)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PUFFERFISH, 4, 12, 30), new VillagerTrades.c(1, 12, 30, ImmutableMap.builder().put(VillagerType.PLAINS, Items.OAK_BOAT).put(VillagerType.TAIGA, Items.SPRUCE_BOAT).put(VillagerType.SNOW, Items.SPRUCE_BOAT).put(VillagerType.DESERT, Items.JUNGLE_BOAT).put(VillagerType.JUNGLE, Items.JUNGLE_BOAT).put(VillagerType.SAVANNA, Items.ACACIA_BOAT).put(VillagerType.SWAMP, Items.DARK_OAK_BOAT).build())}))); // Paper - add to ImmutableMap..builder() - hashmap.put(VillagerProfession.SHEPHERD, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Blocks.WHITE_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BROWN_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.BLACK_WOOL, 18, 16, 2), new VillagerTrades.b(Blocks.GRAY_WOOL, 18, 16, 2), new VillagerTrades.h(Items.SHEARS, 2, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WHITE_DYE, 12, 16, 10), new VillagerTrades.b(Items.GRAY_DYE, 12, 16, 10), new VillagerTrades.b(Items.BLACK_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIGHT_BLUE_DYE, 12, 16, 10), new VillagerTrades.b(Items.LIME_DYE, 12, 16, 10), new VillagerTrades.h(Blocks.WHITE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.ORANGE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.YELLOW_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIME_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PINK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.CYAN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.PURPLE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLUE_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BROWN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.GREEN_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.RED_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.BLACK_WOOL, 1, 1, 16, 5), new VillagerTrades.h(Blocks.WHITE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.ORANGE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.MAGENTA_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.YELLOW_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIME_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PINK_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.LIGHT_GRAY_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.CYAN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.PURPLE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLUE_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BROWN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.GREEN_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.RED_CARPET, 1, 4, 16, 5), new VillagerTrades.h(Blocks.BLACK_CARPET, 1, 4, 16, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.YELLOW_DYE, 12, 16, 20), new VillagerTrades.b(Items.LIGHT_GRAY_DYE, 12, 16, 20), new VillagerTrades.b(Items.ORANGE_DYE, 12, 16, 20), new VillagerTrades.b(Items.RED_DYE, 12, 16, 20), new VillagerTrades.b(Items.PINK_DYE, 12, 16, 20), new VillagerTrades.h(Blocks.WHITE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.YELLOW_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.RED_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLACK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.BROWN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.CYAN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.GREEN_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_BLUE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIGHT_GRAY_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.LIME_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.MAGENTA_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.ORANGE_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PINK_BED, 3, 1, 12, 10), new VillagerTrades.h(Blocks.PURPLE_BED, 3, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BROWN_DYE, 12, 16, 30), new VillagerTrades.b(Items.PURPLE_DYE, 12, 16, 30), new VillagerTrades.b(Items.BLUE_DYE, 12, 16, 30), new VillagerTrades.b(Items.GREEN_DYE, 12, 16, 30), new VillagerTrades.b(Items.MAGENTA_DYE, 12, 16, 30), new VillagerTrades.b(Items.CYAN_DYE, 12, 16, 30), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 12, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 12, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.PAINTING, 2, 3, 30)}))); - hashmap.put(VillagerProfession.FLETCHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STICK, 32, 16, 2), new VillagerTrades.h(Items.ARROW, 1, 16, 1), new VillagerTrades.g(Blocks.GRAVEL, 10, Items.FLINT, 10, 12, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FLINT, 26, 12, 10), new VillagerTrades.h(Items.BOW, 2, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.STRING, 14, 16, 20), new VillagerTrades.h(Items.CROSSBOW, 3, 1, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.FEATHER, 24, 16, 30), new VillagerTrades.e(Items.BOW, 2, 3, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.es, 8, 12, 30), new VillagerTrades.e(Items.CROSSBOW, 3, 3, 15), new VillagerTrades.j(Items.ARROW, 5, Items.TIPPED_ARROW, 5, 2, 12, 30)}))); -- hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); -+ hashmap.put(VillagerProfession.LIBRARIAN, a(ImmutableMap.builder().put(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.d(1), new VillagerTrades.h(Blocks.BOOKSHELF, 9, 1, 12, 1)}).put(2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.BOOK, 4, 12, 10), new VillagerTrades.d(5), new VillagerTrades.h(Items.rk, 1, 1, 5)}).put(3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.INK_SAC, 5, 12, 20), new VillagerTrades.d(10), new VillagerTrades.h(Items.az, 1, 4, 10)}).put(4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.WRITABLE_BOOK, 2, 12, 30), new VillagerTrades.d(15), new VillagerTrades.h(Items.CLOCK, 5, 1, 15), new VillagerTrades.h(Items.COMPASS, 4, 1, 15)}).put(5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.NAME_TAG, 20, 1, 30)}).build())); // Paper - add to ImmutableMap..builder() - hashmap.put(VillagerProfession.CARTOGRAPHER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.PAPER, 24, 16, 2), new VillagerTrades.h(Items.MAP, 7, 1, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.dP, 11, 16, 10), new VillagerTrades.k(13, StructureGenerator.MONUMENT, MapIcon.Type.MONUMENT, 12, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COMPASS, 1, 12, 20), new VillagerTrades.k(14, StructureGenerator.MANSION, MapIcon.Type.MANSION, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.ITEM_FRAME, 7, 1, 15), new VillagerTrades.h(Items.WHITE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_BLUE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.RED_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PINK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GREEN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIME_BANNER, 3, 1, 15), new VillagerTrades.h(Items.GRAY_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BLACK_BANNER, 3, 1, 15), new VillagerTrades.h(Items.PURPLE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.MAGENTA_BANNER, 3, 1, 15), new VillagerTrades.h(Items.CYAN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.BROWN_BANNER, 3, 1, 15), new VillagerTrades.h(Items.YELLOW_BANNER, 3, 1, 15), new VillagerTrades.h(Items.ORANGE_BANNER, 3, 1, 15), new VillagerTrades.h(Items.LIGHT_GRAY_BANNER, 3, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.h(Items.GLOBE_BANNER_PATTERN, 8, 1, 30)}))); - hashmap.put(VillagerProfession.CLERIC, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.ROTTEN_FLESH, 32, 16, 2), new VillagerTrades.h(Items.REDSTONE, 1, 2, 1)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.GOLD_INGOT, 3, 12, 10), new VillagerTrades.h(Items.LAPIS_LAZULI, 1, 1, 5)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.RABBIT_FOOT, 2, 12, 20), new VillagerTrades.h(Blocks.GLOWSTONE, 4, 1, 12, 10)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.SCUTE, 4, 12, 30), new VillagerTrades.b(Items.GLASS_BOTTLE, 9, 12, 30), new VillagerTrades.h(Items.ENDER_PEARL, 5, 1, 15)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.NETHER_WART, 22, 12, 30), new VillagerTrades.h(Items.EXPERIENCE_BOTTLE, 3, 1, 30)}))); - hashmap.put(VillagerProfession.ARMORER, a(ImmutableMap.of(1, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.COAL, 15, 16, 2), new VillagerTrades.h(new ItemStack(Items.IRON_LEGGINGS), 7, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_BOOTS), 4, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_HELMET), 5, 1, 12, 1, 0.2F), new VillagerTrades.h(new ItemStack(Items.IRON_CHESTPLATE), 9, 1, 12, 1, 0.2F)}, 2, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.IRON_INGOT, 4, 12, 10), new VillagerTrades.h(new ItemStack(Items.rj), 36, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_BOOTS), 1, 1, 12, 5, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_LEGGINGS), 3, 1, 12, 5, 0.2F)}, 3, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.b(Items.LAVA_BUCKET, 1, 12, 20), new VillagerTrades.b(Items.DIAMOND, 1, 12, 20), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_HELMET), 1, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.CHAINMAIL_CHESTPLATE), 4, 1, 12, 10, 0.2F), new VillagerTrades.h(new ItemStack(Items.SHIELD), 5, 1, 12, 10, 0.2F)}, 4, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_LEGGINGS, 14, 3, 15, 0.2F), new VillagerTrades.e(Items.DIAMOND_BOOTS, 8, 3, 15, 0.2F)}, 5, new VillagerTrades.IMerchantRecipeOption[]{new VillagerTrades.e(Items.DIAMOND_HELMET, 8, 3, 30, 0.2F), new VillagerTrades.e(Items.DIAMOND_CHESTPLATE, 16, 3, 30, 0.2F)}))); -diff --git a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -index e8daa74986f07163fd5318f431398b4f0efde6e8..71d2ae2a9c5a05351241b5a313e66ca15b0624ef 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java + public void a(JsonObject jsonobject, LootItemFunctionExplorationMap lootitemfunctionexplorationmap, JsonSerializationContext jsonserializationcontext) { +- super.a(jsonobject, (LootItemFunctionConditional) lootitemfunctionexplorationmap, jsonserializationcontext); ++ super.a(jsonobject, lootitemfunctionexplorationmap, jsonserializationcontext); // Paper - decompile fix + if (!lootitemfunctionexplorationmap.e.equals(LootItemFunctionExplorationMap.a)) { + jsonobject.add("destination", jsonserializationcontext.serialize(lootitemfunctionexplorationmap.e.i())); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java +index afd30320da51bf467d66e94f682936ed8db96d90..c58d380b96e81d65d7c254a9e53017e5157769b0 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java @@ -38,7 +38,7 @@ public final class VoxelShapeMergerList implements VoxelShapeMerger { double d1 = flag4 ? doublelist.getDouble(i++) : doublelist1.getDouble(j++); @@ -816,47 +860,3 @@ index e8daa74986f07163fd5318f431398b4f0efde6e8..71d2ae2a9c5a05351241b5a313e66ca1 this.b.add(i - 1); this.c.add(j - 1); this.a.add(d1); -diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java -index 83d799bec90693e0fbbf8a7f3bc4f569b5c0ead9..141a8e31151010e5a0bd8d4661033f109f6a2e67 100644 ---- a/src/main/java/net/minecraft/server/WorldPersistentData.java -+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java -@@ -38,7 +38,7 @@ public class WorldPersistentData { - if (t0 != null) { - return t0; - } else { -- T t1 = (PersistentBase) supplier.get(); -+ T t1 = supplier.get(); // Paper - decompile fix - - this.a(t1); - return t1; -@@ -47,7 +47,7 @@ public class WorldPersistentData { - - @Nullable - public T b(Supplier supplier, String s) { -- PersistentBase persistentbase = (PersistentBase) this.data.get(s); -+ T persistentbase = (T) this.data.get(s); // Paper - decompile fix - - if (persistentbase == null && !this.data.containsKey(s)) { - persistentbase = this.c(supplier, s); -@@ -63,7 +63,7 @@ public class WorldPersistentData { - File file = this.a(s); - - if (file.exists()) { -- T t0 = (PersistentBase) supplier.get(); -+ T t0 = supplier.get(); // Paper - decompile fix - NBTTagCompound nbttagcompound = this.a(s, SharedConstants.getGameVersion().getWorldVersion()); - - t0.a(nbttagcompound.getCompound("data")); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 4955ec276c389158727fb98710dd700145c31be8..f1c206b6b506aff09c484730dd2d5ce796c3c2ab 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1809,7 +1809,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - - // CraftBukkit - decompile error -- return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(it.unimi.dsi.fastutil.objects.Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { -+ return (String) object2intopenhashmap.object2IntEntrySet().stream().sorted(Comparator.comparing(Object2IntMap.Entry::getIntValue).reversed()).limit(5L).map((it_unimi_dsi_fastutil_objects_object2intmap_entry) -> { // Paper - decompile fix - return it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey() + ":" + it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue(); - }).collect(Collectors.joining(",")); - } catch (Exception exception) { diff --git a/Spigot-Server-Patches/0004-MC-Utils.patch b/Spigot-Server-Patches/0004-MC-Utils.patch index 269428c435..1149614460 100644 --- a/Spigot-Server-Patches/0004-MC-Utils.patch +++ b/Spigot-Server-Patches/0004-MC-Utils.patch @@ -456,15 +456,14 @@ index 0000000000000000000000000000000000000000..7bab31a312463cc963d9621cdc543a28 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java new file mode 100644 -index 0000000000000000000000000000000000000000..4eac0577862450e0e3299f5579f9ff6759b0256d +index 0000000000000000000000000000000000000000..bf63a0e87f8c9529e473269c0626051c81bb04ea --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/ChunkList.java -@@ -0,0 +1,129 @@ +@@ -0,0 +1,128 @@ +package com.destroystokyo.paper.util.maplist; + +import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; -+import net.minecraft.server.Chunk; -+import net.minecraft.server.MCUtil; ++import net.minecraft.world.level.chunk.Chunk; +import java.util.Arrays; +import java.util.Iterator; +import java.util.NoSuchElementException; @@ -591,14 +590,14 @@ index 0000000000000000000000000000000000000000..4eac0577862450e0e3299f5579f9ff67 +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java new file mode 100644 -index 0000000000000000000000000000000000000000..cdda74564ced196ae577a64782236c2bfe36e433 +index 0000000000000000000000000000000000000000..0133ea6feb1ab88f021f66855669f58367e7420b --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/EntityList.java @@ -0,0 +1,128 @@ +package com.destroystokyo.paper.util.maplist; + +import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; -+import net.minecraft.server.Entity; ++import net.minecraft.world.entity.Entity; +import java.util.Arrays; +import java.util.Iterator; +import java.util.NoSuchElementException; @@ -725,7 +724,7 @@ index 0000000000000000000000000000000000000000..cdda74564ced196ae577a64782236c2b +} diff --git a/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java new file mode 100644 -index 0000000000000000000000000000000000000000..84ef8d9ecab4745a90504718f803110b9e2dbf65 +index 0000000000000000000000000000000000000000..d9fdc8196e53518ceac3aeb7bf3b98a0bd348f8f --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/maplist/IBlockDataList.java @@ -0,0 +1,128 @@ @@ -733,9 +732,9 @@ index 0000000000000000000000000000000000000000..84ef8d9ecab4745a90504718f803110b + +import it.unimi.dsi.fastutil.longs.LongIterator; +import it.unimi.dsi.fastutil.shorts.Short2LongOpenHashMap; -+import net.minecraft.server.ChunkSection; -+import net.minecraft.server.DataPaletteGlobal; -+import net.minecraft.server.IBlockData; ++import net.minecraft.world.level.block.state.IBlockData; ++import net.minecraft.world.level.chunk.ChunkSection; ++import net.minecraft.world.level.chunk.DataPaletteGlobal; +import java.util.Arrays; + +/** @@ -743,7 +742,7 @@ index 0000000000000000000000000000000000000000..84ef8d9ecab4745a90504718f803110b + */ +public final class IBlockDataList { + -+ static final DataPaletteGlobal GLOBAL_PALETTE = (DataPaletteGlobal)ChunkSection.GLOBAL_PALETTE; ++ static final DataPaletteGlobal GLOBAL_PALETTE = (DataPaletteGlobal) ChunkSection.GLOBAL_PALETTE; + + // map of location -> (index | (location << 16) | (palette id << 32)) + private final Short2LongOpenHashMap map = new Short2LongOpenHashMap(2, 0.8f); @@ -1095,7 +1094,7 @@ index 0000000000000000000000000000000000000000..c3b936f54b3fff418c265639ef223292 +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java new file mode 100644 -index 0000000000000000000000000000000000000000..1330df2c1d3c4f52dad0adeb169409eb412814ab +index 0000000000000000000000000000000000000000..24407a3e653ba32ef6b921c346571ec734a72245 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/AreaMap.java @@ -0,0 +1,453 @@ @@ -1106,9 +1105,9 @@ index 0000000000000000000000000000000000000000..1330df2c1d3c4f52dad0adeb169409eb +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; +import it.unimi.dsi.fastutil.objects.Object2LongOpenHashMap; -+import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.MCUtil; +import net.minecraft.server.MinecraftServer; ++import net.minecraft.world.level.ChunkCoordIntPair; +import javax.annotation.Nullable; +import java.util.Iterator; + @@ -1554,7 +1553,7 @@ index 0000000000000000000000000000000000000000..1330df2c1d3c4f52dad0adeb169409eb +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java new file mode 100644 -index 0000000000000000000000000000000000000000..3f86c1ad43782bdc56be6c0eca053311e51228ca +index 0000000000000000000000000000000000000000..905b76d1d65744fe35f56bb78ef75f49178a6a24 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/DistanceTrackingAreaMap.java @@ -0,0 +1,175 @@ @@ -1562,8 +1561,8 @@ index 0000000000000000000000000000000000000000..3f86c1ad43782bdc56be6c0eca053311 + +import com.destroystokyo.paper.util.math.IntegerUtil; +import it.unimi.dsi.fastutil.longs.Long2IntOpenHashMap; -+import net.minecraft.server.ChunkCoordIntPair; +import net.minecraft.server.MCUtil; ++import net.minecraft.world.level.ChunkCoordIntPair; + +/** @author Spottedleaf */ +public abstract class DistanceTrackingAreaMap extends AreaMap { @@ -1735,13 +1734,13 @@ index 0000000000000000000000000000000000000000..3f86c1ad43782bdc56be6c0eca053311 +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java new file mode 100644 -index 0000000000000000000000000000000000000000..b1396f405d041fc3ca1f7ce1e0f884a3cfb8b96e +index 0000000000000000000000000000000000000000..ed6133b07bc6c4662bd2099ea7dc8aabec37c853 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerAreaMap.java @@ -0,0 +1,32 @@ +package com.destroystokyo.paper.util.misc; + -+import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.level.EntityPlayer; + +/** + * @author Spottedleaf @@ -1773,13 +1772,13 @@ index 0000000000000000000000000000000000000000..b1396f405d041fc3ca1f7ce1e0f884a3 +} diff --git a/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java new file mode 100644 -index 0000000000000000000000000000000000000000..0292afc5224326b767bd56d0718c215c184f2e0f +index 0000000000000000000000000000000000000000..eca1fea17184076635563717bb32c81187e2f6f7 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/util/misc/PlayerDistanceTrackingAreaMap.java @@ -0,0 +1,24 @@ +package com.destroystokyo.paper.util.misc; + -+import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.level.EntityPlayer; + +public class PlayerDistanceTrackingAreaMap extends DistanceTrackingAreaMap { + @@ -2258,36 +2257,24 @@ index 0000000000000000000000000000000000000000..9df0006c1a283f77c4d01d9fce9062fc + return (other.backingSet & this.backingSet) != 0; + } +} -diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 277d7a124e9a21803fe4d5a66fc0b311df2cfba7..02c09f39848399a86d46bd17569b4f01a7b5ab1f 100644 ---- a/src/main/java/net/minecraft/server/AxisAlignedBB.java -+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -190,10 +190,12 @@ public class AxisAlignedBB { - return this.d(vec3d.x, vec3d.y, vec3d.z); +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java +index bc7757b929ecce998094ddcdf51a4703e165a6d6..c8bb06a31242089ad950713bd5f94abbfe12adc8 100644 +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -78,7 +78,7 @@ public class SystemUtils { } -+ public final boolean intersects(AxisAlignedBB axisalignedbb) { return this.c(axisalignedbb); } // Paper - OBFHELPER - public boolean c(AxisAlignedBB axisalignedbb) { - return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); + public static long getMonotonicNanos() { +- return SystemUtils.a.getAsLong(); ++ return System.nanoTime(); // Paper } -+ public final boolean intersects(double d0, double d1, double d2, double d3, double d4, double d5) { return a(d0, d1, d2, d3, d4, d5); } // Paper - OBFHELPER - public boolean a(double d0, double d1, double d2, double d3, double d4, double d5) { - return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; - } -@@ -206,6 +208,7 @@ public class AxisAlignedBB { - return d0 >= this.minX && d0 < this.maxX && d1 >= this.minY && d1 < this.maxY && d2 >= this.minZ && d2 < this.maxZ; - } - -+ public final double getAverageSideLength(){return a();} // Paper - OBFHELPER - public double a() { - double d0 = this.b(); - double d1 = this.c(); -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 7f803529d67cdea2d809743e34d6d3d456a114d7..f6a5ebd4c7ec045c8dd6841831f8fcc0b32d964e 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -16,9 +16,9 @@ public class BaseBlockPosition implements Comparable { + public static long getTimeMillis() { +diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java +index fe3a3ce150de0e689c452b67d480b9d69471b330..25fdd55a7548cfaa45a541ad77f22f33c33e7471 100644 +--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java +@@ -18,9 +18,9 @@ public class BaseBlockPosition implements Comparable { return IntStream.of(new int[]{baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()}); }); public static final BaseBlockPosition ZERO = new BaseBlockPosition(0, 0, 0); @@ -2300,7 +2287,7 @@ index 7f803529d67cdea2d809743e34d6d3d456a114d7..f6a5ebd4c7ec045c8dd6841831f8fcc0 public BaseBlockPosition(int i, int j, int k) { this.a = i; -@@ -62,15 +62,15 @@ public class BaseBlockPosition implements Comparable { +@@ -64,15 +64,15 @@ public class BaseBlockPosition implements Comparable { return this.e; } @@ -2319,7 +2306,7 @@ index 7f803529d67cdea2d809743e34d6d3d456a114d7..f6a5ebd4c7ec045c8dd6841831f8fcc0 this.e = i; } -@@ -106,6 +106,7 @@ public class BaseBlockPosition implements Comparable { +@@ -108,6 +108,7 @@ public class BaseBlockPosition implements Comparable { return this.distanceSquared(iposition.getX(), iposition.getY(), iposition.getZ(), true) < d0 * d0; } @@ -2327,46 +2314,11 @@ index 7f803529d67cdea2d809743e34d6d3d456a114d7..f6a5ebd4c7ec045c8dd6841831f8fcc0 public double j(BaseBlockPosition baseblockposition) { return this.distanceSquared((double) baseblockposition.getX(), (double) baseblockposition.getY(), (double) baseblockposition.getZ(), true); } -diff --git a/src/main/java/net/minecraft/server/BlockAccessAir.java b/src/main/java/net/minecraft/server/BlockAccessAir.java -index eff6ebcd30b538cbaedaa031a46a59ea956253ba..30cbfc8eac20910aa55951e3dce63862f5a43c37 100644 ---- a/src/main/java/net/minecraft/server/BlockAccessAir.java -+++ b/src/main/java/net/minecraft/server/BlockAccessAir.java -@@ -14,6 +14,18 @@ public enum BlockAccessAir implements IBlockAccess { - return null; - } - -+ // Paper start - If loaded util -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ return this.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ return this.getType(blockposition); -+ } -+ // Paper end -+ - @Override - public IBlockData getType(BlockPosition blockposition) { - return Blocks.AIR.getBlockData(); -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index f28b9c093140a26564aff0457e7ef14abcf5f9d5..e0ae51ede44de5c894df526c1fc6d94c46d72013 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -636,6 +636,7 @@ public abstract class BlockBase { - return this.a != null ? this.a.d : Block.a(this.getCollisionShape(iblockaccess, blockposition)); - } - -+ public final IBlockData getBlockData() { return p(); } // Paper - OBFHELPER - protected abstract IBlockData p(); - - public boolean isRequiresSpecialTool() { -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab74638c02 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -99,6 +99,7 @@ public class BlockPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index 76675ad1633dbaebb180842b9914fac18741c62e..9fb6db18c5c1f39b5a564c0f5f70498825defa97 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -105,6 +105,7 @@ public class BlockPosition extends BaseBlockPosition { return d0 == 0.0D && d1 == 0.0D && d2 == 0.0D ? this : new BlockPosition((double) this.getX() + d0, (double) this.getY() + d1, (double) this.getZ() + d2); } @@ -2374,7 +2326,7 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab public BlockPosition b(int i, int j, int k) { return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); } -@@ -430,6 +431,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -436,6 +437,7 @@ public class BlockPosition extends BaseBlockPosition { return super.a(enumblockrotation).immutableCopy(); } @@ -2382,7 +2334,7 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab public BlockPosition.MutableBlockPosition d(int i, int j, int k) { this.o(i); this.p(j); -@@ -437,6 +439,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -443,6 +445,7 @@ public class BlockPosition extends BaseBlockPosition { return this; } @@ -2390,7 +2342,7 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab public BlockPosition.MutableBlockPosition c(double d0, double d1, double d2) { return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } -@@ -490,6 +493,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -496,6 +499,7 @@ public class BlockPosition extends BaseBlockPosition { } } @@ -2398,7 +2350,7 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab @Override public void o(int i) { super.o(i); -@@ -500,10 +504,10 @@ public class BlockPosition extends BaseBlockPosition { +@@ -506,10 +510,10 @@ public class BlockPosition extends BaseBlockPosition { super.p(i); } @@ -2410,899 +2362,154 @@ index 1b2f415e3ed7f6dca12d13cd098cb4ec3af54020..64e8088d394ddcda59d0209883b778ab @Override public BlockPosition immutableCopy() { -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9a07db3442d1ef2c1b1c1f1293445d28b0a4c84d..c8ff99ef5c7574292ee66a4aec45d1550eab1624 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -26,7 +26,7 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/core/RegistryBlockID.java b/src/main/java/net/minecraft/core/RegistryBlockID.java +index e543b6927280a14e1d1220534758289934e31282..d5bec8b0e155ea5ae5746b6da571754a98e4125e 100644 +--- a/src/main/java/net/minecraft/core/RegistryBlockID.java ++++ b/src/main/java/net/minecraft/core/RegistryBlockID.java +@@ -64,6 +64,7 @@ public class RegistryBlockID implements Registry { + return Iterators.filter(this.c.iterator(), Predicates.notNull()); + } - private static final Logger LOGGER = LogManager.getLogger(); - @Nullable -- public static final ChunkSection a = null; -+ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = a; // Paper - OBFHELPER - private final ChunkSection[] sections; - private BiomeStorage d; - private final Map e; -@@ -49,7 +49,7 @@ public class Chunk implements IChunkAccess { - private Supplier u; - @Nullable - private Consumer v; -- private final ChunkCoordIntPair loc; -+ private final ChunkCoordIntPair loc; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key - private volatile boolean x; - - public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) { -@@ -66,7 +66,8 @@ public class Chunk implements IChunkAccess { - this.n = new ShortList[16]; - this.entitySlices = (List[]) (new List[16]); // Spigot - this.world = (WorldServer) world; // CraftBukkit - type -- this.loc = chunkcoordintpair; -+ this.locX = chunkcoordintpair.x; this.locZ = chunkcoordintpair.z; // Paper - reduce need for field look ups -+ this.loc = chunkcoordintpair; this.coordinateKey = ChunkCoordIntPair.pair(locX, locZ); // Paper - cache long key - this.i = chunkconverter; - HeightMap.Type[] aheightmap_type = HeightMap.Type.values(); - int j = aheightmap_type.length; -@@ -112,6 +113,110 @@ public class Chunk implements IChunkAccess { - public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY); - // CraftBukkit end - -+ // Paper start -+ public final com.destroystokyo.paper.util.maplist.EntityList entities = new com.destroystokyo.paper.util.maplist.EntityList(); -+ public PlayerChunk playerChunk; -+ -+ static final int NEIGHBOUR_CACHE_RADIUS = 3; -+ public static int getNeighbourCacheRadius() { -+ return NEIGHBOUR_CACHE_RADIUS; -+ } -+ -+ boolean loadedTicketLevel; -+ private long neighbourChunksLoadedBitset; -+ private final Chunk[] loadedNeighbourChunks = new Chunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)]; -+ -+ private static int getNeighbourIndex(final int relativeX, final int relativeZ) { -+ // index = (relativeX + NEIGHBOUR_CACHE_RADIUS) + (relativeZ + NEIGHBOUR_CACHE_RADIUS) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1) -+ // optimised variant of the above by moving some of the ops to compile time -+ return relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))); -+ } -+ -+ public final Chunk getRelativeNeighbourIfLoaded(final int relativeX, final int relativeZ) { -+ return this.loadedNeighbourChunks[getNeighbourIndex(relativeX, relativeZ)]; -+ } -+ -+ public final boolean isNeighbourLoaded(final int relativeX, final int relativeZ) { -+ return (this.neighbourChunksLoadedBitset & (1L << getNeighbourIndex(relativeX, relativeZ))) != 0; -+ } -+ -+ public final void setNeighbourLoaded(final int relativeX, final int relativeZ, final Chunk chunk) { -+ if (chunk == null) { -+ throw new IllegalArgumentException("Chunk must be non-null, neighbour: (" + relativeX + "," + relativeZ + "), chunk: " + this.loc); -+ } -+ final long before = this.neighbourChunksLoadedBitset; -+ final int index = getNeighbourIndex(relativeX, relativeZ); -+ this.loadedNeighbourChunks[index] = chunk; -+ this.neighbourChunksLoadedBitset |= (1L << index); -+ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); -+ } -+ -+ public final void setNeighbourUnloaded(final int relativeX, final int relativeZ) { -+ final long before = this.neighbourChunksLoadedBitset; -+ final int index = getNeighbourIndex(relativeX, relativeZ); -+ this.loadedNeighbourChunks[index] = null; -+ this.neighbourChunksLoadedBitset &= ~(1L << index); -+ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); -+ } -+ -+ public final void resetNeighbours() { -+ final long before = this.neighbourChunksLoadedBitset; -+ this.neighbourChunksLoadedBitset = 0L; -+ java.util.Arrays.fill(this.loadedNeighbourChunks, null); -+ this.onNeighbourChange(before, 0L); -+ } -+ -+ protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { -+ -+ } -+ -+ public final boolean isAnyNeighborsLoaded() { -+ return neighbourChunksLoadedBitset != 0; -+ } -+ public final boolean areNeighboursLoaded(final int radius) { -+ return Chunk.areNeighboursLoaded(this.neighbourChunksLoadedBitset, radius); -+ } -+ -+ public static boolean areNeighboursLoaded(final long bitset, final int radius) { -+ // index = relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))) -+ switch (radius) { -+ case 0: { -+ return (bitset & (1L << getNeighbourIndex(0, 0))) != 0; -+ } -+ case 1: { -+ long mask = 0L; -+ for (int dx = -1; dx <= 1; ++dx) { -+ for (int dz = -1; dz <= 1; ++dz) { -+ mask |= (1L << getNeighbourIndex(dx, dz)); -+ } -+ } -+ return (bitset & mask) == mask; -+ } -+ case 2: { -+ long mask = 0L; -+ for (int dx = -2; dx <= 2; ++dx) { -+ for (int dz = -2; dz <= 2; ++dz) { -+ mask |= (1L << getNeighbourIndex(dx, dz)); -+ } -+ } -+ return (bitset & mask) == mask; -+ } -+ case 3: { -+ long mask = 0L; -+ for (int dx = -3; dx <= 3; ++dx) { -+ for (int dz = -3; dz <= 3; ++dz) { -+ mask |= (1L << getNeighbourIndex(dx, dz)); -+ } -+ } -+ return (bitset & mask) == mask; -+ } -+ -+ default: -+ throw new IllegalArgumentException("Radius not recognized: " + radius); -+ } -+ } -+ // Paper end -+ - public Chunk(World world, ProtoChunk protochunk) { - this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null); - Iterator iterator = protochunk.y().iterator(); -@@ -217,6 +322,18 @@ public class Chunk implements IChunkAccess { ++ public int size() { return this.a(); } // Paper - OBFHELPER + public int a() { + return this.b.size(); + } +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +index b2fb24e9ae19ab6e7039a98fc0c265f801be8a99..44fefe1cdc23667219ce825ba283f84cd3020e14 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -76,7 +76,7 @@ public class NBTTagCompound implements NBTBase { + return "TAG_Compound"; } - } - -+ // Paper start - If loaded util -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ return this.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ return this.getType(blockposition); -+ } -+ // Paper end -+ - @Override - public Fluid getFluid(BlockPosition blockposition) { - return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -357,6 +474,7 @@ public class Chunk implements IChunkAccess { - entity.chunkX = this.loc.x; - entity.chunkY = k; - entity.chunkZ = this.loc.z; -+ this.entities.add(entity); // Paper - per chunk entity list - this.entitySlices[k].add(entity); - } - -@@ -380,6 +498,7 @@ public class Chunk implements IChunkAccess { - } - - this.entitySlices[i].remove(entity); -+ this.entities.remove(entity); // Paper - } - - @Override -@@ -401,6 +520,7 @@ public class Chunk implements IChunkAccess { - return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); - } - -+ @Nullable public final TileEntity getTileEntityImmediately(BlockPosition pos) { return this.a(pos, EnumTileEntityState.IMMEDIATE); } // Paper - OBFHELPER - @Nullable - public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { - // CraftBukkit start -@@ -512,7 +632,25 @@ public class Chunk implements IChunkAccess { - - // CraftBukkit start - public void loadCallback() { -+ // Paper start - neighbour cache -+ int chunkX = this.loc.x; -+ int chunkZ = this.loc.z; -+ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); -+ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { -+ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { -+ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); -+ if (neighbour != null) { -+ neighbour.setNeighbourLoaded(-dx, -dz, this); -+ // should be in cached already -+ this.setNeighbourLoaded(dx, dz, neighbour); -+ } -+ } -+ } -+ this.setNeighbourLoaded(0, 0, this); -+ this.loadedTicketLevel = true; -+ // Paper end - neighbour cache - org.bukkit.Server server = this.world.getServer(); -+ ((WorldServer)this.world).getChunkProvider().addLoadedChunk(this); // Paper - if (server != null) { - /* - * If it's a new world, the first few chunks are generated inside -@@ -551,6 +689,22 @@ public class Chunk implements IChunkAccess { - server.getPluginManager().callEvent(unloadEvent); - // note: saving can be prevented, but not forced if no saving is actually required - this.mustNotSave = !unloadEvent.isSaveChunk(); -+ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper -+ // Paper start - neighbour cache -+ int chunkX = this.loc.x; -+ int chunkZ = this.loc.z; -+ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); -+ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { -+ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { -+ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); -+ if (neighbour != null) { -+ neighbour.setNeighbourUnloaded(-dx, -dz); -+ } -+ } -+ } -+ this.loadedTicketLevel = false; -+ this.resetNeighbours(); -+ // Paper end - } - // CraftBukkit end - -diff --git a/src/main/java/net/minecraft/server/ChunkCache.java b/src/main/java/net/minecraft/server/ChunkCache.java -index b703382204a3ccd57e642cff18c7c28fef157cc0..8eecdcde510661ec3a13a25a04ba394f6b6dc012 100644 ---- a/src/main/java/net/minecraft/server/ChunkCache.java -+++ b/src/main/java/net/minecraft/server/ChunkCache.java -@@ -10,7 +10,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { - protected final int b; - protected final IChunkAccess[][] c; - protected boolean d; -- protected final World e; -+ protected final World e; protected final World getWorld() { return e; } // Paper - OBFHELPER - - public ChunkCache(World world, BlockPosition blockposition, BlockPosition blockposition1) { - this.e = world; -@@ -29,7 +29,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { - - for (k = this.a; k <= i; ++k) { - for (l = this.b; l <= j; ++l) { -- this.c[k - this.a][l - this.b] = ichunkprovider.a(k, l); -+ this.c[k - this.a][l - this.b] = ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(k, l); // Paper - } - } - -@@ -54,7 +54,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { - int k = i - this.a; - int l = j - this.b; - -- if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { -+ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { // Paper - if this changes, update getChunkIfLoaded below - IChunkAccess ichunkaccess = this.c[k][l]; - - return (IChunkAccess) (ichunkaccess != null ? ichunkaccess : new ChunkEmpty(this.e, new ChunkCoordIntPair(i, j))); -@@ -73,6 +73,29 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { - return this.a(i, j); - } - -+ // Paper start - if loaded util -+ private IChunkAccess getChunkIfLoaded(int x, int z) { -+ int k = x - this.a; -+ int l = z - this.b; -+ -+ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { -+ return this.c[k][l]; -+ } -+ return null; -+ } -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); -+ return chunk == null ? null : chunk.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); -+ return chunk == null ? null : chunk.getType(blockposition); -+ } -+ // Paper end -+ - @Nullable - @Override - public TileEntity getTileEntity(BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index ae61d0a7676bf06c8c9aa5c68ccb8dd4baf326b6..b12e43ed13a1a9d7d418831b8988c30a242cb5c4 100644 ---- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -11,27 +11,32 @@ public class ChunkCoordIntPair { - public static final long a = pair(1875016, 1875016); - public final int x; - public final int z; -+ public final long longKey; // Paper - - public ChunkCoordIntPair(int i, int j) { - this.x = i; - this.z = j; -+ this.longKey = pair(this.x, this.z); // Paper - } - - public ChunkCoordIntPair(BlockPosition blockposition) { - this.x = blockposition.getX() >> 4; - this.z = blockposition.getZ() >> 4; -+ this.longKey = pair(this.x, this.z); // Paper - } - - public ChunkCoordIntPair(long i) { - this.x = (int) i; - this.z = (int) (i >> 32); -+ this.longKey = pair(this.x, this.z); // Paper - } - - public long pair() { -- return pair(this.x, this.z); -+ return longKey; // Paper - } - -- public static long pair(int i, int j) { -+ public static long pair(final BlockPosition pos) { return pair(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER -+ public static long pair(int i, int j) { - return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; - } - -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 056e1fced00dff1d6507a90c13f2448a04ca0558..08f11f98c40221fa4ce9a4f14ee8398f8588f38a 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -17,6 +17,10 @@ import java.util.function.Consumer; - import java.util.function.Function; - import java.util.function.Supplier; - import javax.annotation.Nullable; -+import com.destroystokyo.paper.exception.ServerInternalException; -+import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper -+import org.apache.logging.log4j.LogManager; -+import org.apache.logging.log4j.Logger; - - public class ChunkProviderServer extends IChunkProvider { - -@@ -24,7 +28,7 @@ public class ChunkProviderServer extends IChunkProvider { - private final ChunkMapDistance chunkMapDistance; - public final ChunkGenerator chunkGenerator; - private final WorldServer world; -- private final Thread serverThread; -+ public final Thread serverThread; // Paper - private -> public - private final LightEngineThreaded lightEngine; - private final ChunkProviderServer.a serverThreadQueue; - public final PlayerChunkMap playerChunkMap; -@@ -37,6 +41,158 @@ public class ChunkProviderServer extends IChunkProvider { - private final IChunkAccess[] cacheChunk = new IChunkAccess[4]; - @Nullable - private SpawnerCreature.d p; -+ // Paper start -+ final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); -+ final Long2ObjectOpenHashMap loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); -+ -+ private final Chunk[] lastLoadedChunks = new Chunk[4 * 4]; -+ -+ private static int getChunkCacheKey(int x, int z) { -+ return x & 3 | ((z & 3) << 2); -+ } -+ -+ void addLoadedChunk(Chunk chunk) { -+ this.loadedChunkMapSeqLock.acquireWrite(); -+ try { -+ this.loadedChunkMap.put(chunk.coordinateKey, chunk); -+ } finally { -+ this.loadedChunkMapSeqLock.releaseWrite(); -+ } -+ -+ // rewrite cache if we have to -+ // we do this since we also cache null chunks -+ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); -+ -+ this.lastLoadedChunks[cacheKey] = chunk; -+ } -+ -+ void removeLoadedChunk(Chunk chunk) { -+ this.loadedChunkMapSeqLock.acquireWrite(); -+ try { -+ this.loadedChunkMap.remove(chunk.coordinateKey); -+ } finally { -+ this.loadedChunkMapSeqLock.releaseWrite(); -+ } -+ -+ // rewrite cache if we have to -+ // we do this since we also cache null chunks -+ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); -+ -+ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; -+ if (cachedChunk != null && cachedChunk.coordinateKey == chunk.coordinateKey) { -+ this.lastLoadedChunks[cacheKey] = null; -+ } -+ } -+ -+ public final Chunk getChunkAtIfLoadedMainThread(int x, int z) { -+ int cacheKey = getChunkCacheKey(x, z); -+ -+ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; -+ if (cachedChunk != null && cachedChunk.locX == x & cachedChunk.locZ == z) { -+ return this.lastLoadedChunks[cacheKey]; -+ } -+ -+ long chunkKey = ChunkCoordIntPair.pair(x, z); -+ -+ cachedChunk = this.loadedChunkMap.get(chunkKey); -+ // Skipping a null check to avoid extra instructions to improve inline capability -+ this.lastLoadedChunks[cacheKey] = cachedChunk; -+ return cachedChunk; -+ } -+ -+ public final Chunk getChunkAtIfLoadedMainThreadNoCache(int x, int z) { -+ return this.loadedChunkMap.get(ChunkCoordIntPair.pair(x, z)); -+ } -+ -+ public final Chunk getChunkAtMainThread(int x, int z) { -+ Chunk ret = this.getChunkAtIfLoadedMainThread(x, z); -+ if (ret != null) { -+ return ret; -+ } -+ return (Chunk)this.getChunkAt(x, z, ChunkStatus.FULL, true); -+ } -+ -+ private long chunkFutureAwaitCounter; -+ -+ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ this.serverThreadQueue.execute(() -> { -+ ChunkProviderServer.this.getEntityTickingChunkAsync(x, z, onLoad); -+ }); -+ return; -+ } -+ this.getChunkFutureAsynchronously(x, z, 31, PlayerChunk::getEntityTickingFuture, onLoad); -+ } -+ -+ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ this.serverThreadQueue.execute(() -> { -+ ChunkProviderServer.this.getTickingChunkAsync(x, z, onLoad); -+ }); -+ return; -+ } -+ this.getChunkFutureAsynchronously(x, z, 32, PlayerChunk::getTickingFuture, onLoad); -+ } -+ -+ public void getFullChunkAsync(int x, int z, java.util.function.Consumer onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ this.serverThreadQueue.execute(() -> { -+ ChunkProviderServer.this.getFullChunkAsync(x, z, onLoad); -+ }); -+ return; -+ } -+ this.getChunkFutureAsynchronously(x, z, 33, PlayerChunk::getFullChunkFuture, onLoad); -+ } -+ -+ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, Function>> futureGet, java.util.function.Consumer onLoad) { -+ if (Thread.currentThread() != this.serverThread) { -+ throw new IllegalStateException(); -+ } -+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); -+ Long identifier = this.chunkFutureAwaitCounter++; -+ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); -+ this.tickDistanceManager(); -+ -+ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair()); -+ -+ if (chunk == null) { -+ throw new IllegalStateException("Expected playerchunk " + chunkPos + " in world '" + this.world.getWorld().getName() + "'"); -+ } -+ -+ CompletableFuture> future = futureGet.apply(chunk); -+ -+ future.whenCompleteAsync((either, throwable) -> { -+ try { -+ if (throwable != null) { -+ if (throwable instanceof ThreadDeath) { -+ throw (ThreadDeath)throwable; -+ } -+ MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", throwable); -+ } else if (either.right().isPresent()) { -+ MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "': " + either.right().get().toString()); -+ } -+ -+ try { -+ if (onLoad != null) { -+ playerChunkMap.callbackExecutor.execute(() -> { -+ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback. -+ }); -+ } -+ } catch (Throwable thr) { -+ if (thr instanceof ThreadDeath) { -+ throw (ThreadDeath)thr; -+ } -+ MinecraftServer.LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", thr); -+ return; -+ } -+ } finally { -+ // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback. -+ ChunkProviderServer.this.chunkMapDistance.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); -+ ChunkProviderServer.this.chunkMapDistance.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); -+ } -+ }, this.serverThreadQueue); -+ } -+ // Paper end - - public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier supplier) { - this.world = worldserver; -@@ -98,6 +254,49 @@ public class ChunkProviderServer extends IChunkProvider { - this.cacheChunk[0] = ichunkaccess; - } - -+ // Paper start - "real" get chunk if loaded -+ // Note: Partially copied from the getChunkAt method below -+ @Nullable -+ public Chunk getChunkAtIfCachedImmediately(int x, int z) { -+ long k = ChunkCoordIntPair.pair(x, z); -+ -+ // Note: Bypass cache since we need to check ticket level, and to make this MT-Safe -+ -+ PlayerChunk playerChunk = this.getChunk(k); -+ if (playerChunk == null) { -+ return null; -+ } -+ -+ return playerChunk.getFullChunkIfCached(); -+ } -+ -+ @Nullable -+ public Chunk getChunkAtIfLoadedImmediately(int x, int z) { -+ long k = ChunkCoordIntPair.pair(x, z); -+ -+ if (Thread.currentThread() == this.serverThread) { -+ return this.getChunkAtIfLoadedMainThread(x, z); -+ } -+ -+ Chunk ret = null; -+ long readlock; -+ do { -+ readlock = this.loadedChunkMapSeqLock.acquireRead(); -+ try { -+ ret = this.loadedChunkMap.get(k); -+ } catch (Throwable thr) { -+ if (thr instanceof ThreadDeath) { -+ throw (ThreadDeath)thr; -+ } -+ // re-try, this means a CME occurred... -+ continue; -+ } -+ } while (!this.loadedChunkMapSeqLock.tryReleaseRead(readlock)); -+ -+ return ret; -+ } -+ // Paper end -+ - @Nullable - @Override - public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { -@@ -380,10 +579,9 @@ public class ChunkProviderServer extends IChunkProvider { - - this.p = spawnercreature_d; - this.world.getMethodProfiler().exit(); -- List list = Lists.newArrayList(this.playerChunkMap.f()); -- -- Collections.shuffle(list); -- list.forEach((playerchunk) -> { -+ //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper -+ //Collections.shuffle(list); // Paper -+ this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... - Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - - if (optional.isPresent()) { -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index b0f7ea97d4795655b6c30b296fd929806dac4ef1..882c2733beaff1df68b892d44fc77cacf4364ff4 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -133,6 +133,7 @@ public class ChunkSection { - return this.blockIds; - } - -+ public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER - public void b(PacketDataSerializer packetdataserializer) { - packetdataserializer.writeShort(this.nonEmptyBlockCount); - this.blockIds.b(packetdataserializer); -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index c4d5ad5d3619675de55ece0583750c210e4794c4..53e7bac2f7a99238f509bb0f871ebed103fda568 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -83,6 +83,7 @@ public class DataBits { - return (int) (k >> l & this.d); - } - -+ public final long[] getDataBits() { return this.a(); } // Paper - OBFHELPER - public long[] a() { - return this.b; - } -diff --git a/src/main/java/net/minecraft/server/DataPalette.java b/src/main/java/net/minecraft/server/DataPalette.java -index b7f4330bbe3b51e6792043cbd0c46c73aad457cb..75b721933ccbe8edc1cd7ea5cc4562214e26b66d 100644 ---- a/src/main/java/net/minecraft/server/DataPalette.java -+++ b/src/main/java/net/minecraft/server/DataPalette.java -@@ -5,10 +5,12 @@ import javax.annotation.Nullable; - - public interface DataPalette { - -+ default int getOrCreateIdFor(T object) { return this.a(object); } // Paper - OBFHELPER - int a(T t0); - - boolean a(Predicate predicate); - -+ @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER - @Nullable - T a(int i); - -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index 8856981da86219bdb036aa6246152f382ff8a818..32849e360a396128bd228db269ad1a8f7c6583a8 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -10,7 +10,7 @@ import java.util.stream.Collectors; - - public class DataPaletteBlock implements DataPaletteExpandable { - -- private final DataPalette b; -+ private final DataPalette b; private final DataPalette getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER - private final DataPaletteExpandable c = (i, object) -> { - return 0; }; -@@ -18,9 +18,9 @@ public class DataPaletteBlock implements DataPaletteExpandable { - private final Function e; - private final Function f; - private final T g; -- protected DataBits a; -- private DataPalette h; -- private int i; -+ protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER -+ private DataPalette h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER -+ private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER - private final ReentrantLock j = new ReentrantLock(); +- private final Map map; ++ public final Map map; // Paper - public void a() { -@@ -55,6 +55,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return j << 8 | k << 4 | i; + protected NBTTagCompound(Map map) { + this.map = map; +@@ -139,10 +139,14 @@ public class NBTTagCompound implements NBTBase { + this.map.put(s, NBTTagLong.a(i)); } -+ private void initialize(int bitsPerObject) { this.b(bitsPerObject); } // Paper - OBFHELPER - private void b(int i) { - if (i != this.i) { - this.i = i; -@@ -132,6 +133,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { - return t0 == null ? this.g : t0; ++ public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER + public void a(String s, UUID uuid) { + this.map.put(s, GameProfileSerializer.a(uuid)); } -+ public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER - public void b(PacketDataSerializer packetdataserializer) { - this.a(); - packetdataserializer.writeByte(this.i); -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 390d79187bc822187d1ba1102c418fa588e8f121..68f1a101174f4a2f7ab5556a5b733f75f3a7802f 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java -@@ -6,6 +6,8 @@ import org.bukkit.event.entity.EntityUnleashEvent; - - public abstract class EntityCreature extends EntityInsentient { - -+ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper + - protected EntityCreature(EntityTypes entitytypes, World world) { - super(entitytypes, world); ++ @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER ++ @Nullable + public UUID a(String s) { + return GameProfileSerializer.a(this.get(s)); } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index e01bc3cdbf382cf61add297b871ba8308720508d..03bfd29c12e7dd6e359481ffb56fddad1a44492a 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -160,6 +160,7 @@ public abstract class EntityInsentient extends EntityLiving { - return this.goalTarget; - } - -+ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper - public void setGoalTarget(@Nullable EntityLiving entityliving) { - // CraftBukkit start - fire event - setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 9038b28881dea326fb712528b3417a6a12dd5751..f49f66e3c128e9ce0f4edc24332f5c52cbb20d02 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -138,6 +138,7 @@ public abstract class EntityLiving extends Entity { - public boolean collides = true; - public Set collidableExemptions = new HashSet<>(); - public boolean canPickUpLoot; -+ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper - - @Override - public float getBukkitYaw() { -diff --git a/src/main/java/net/minecraft/server/EntityMonster.java b/src/main/java/net/minecraft/server/EntityMonster.java -index efba3b772238cabd5981978bee5d7dc76115f93f..74426693c47b6437a4597ddd1b961aae79d7a866 100644 ---- a/src/main/java/net/minecraft/server/EntityMonster.java -+++ b/src/main/java/net/minecraft/server/EntityMonster.java -@@ -5,6 +5,7 @@ import java.util.function.Predicate; - - public abstract class EntityMonster extends EntityCreature implements IMonster { - -+ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper - protected EntityMonster(EntityTypes entitytypes, World world) { - super(entitytypes, world); - this.f = 5; -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3da86b5351dc1701d1c54848830e7bb648671978..37a84b44a46e1490f7b79839b04aef012ddc9fa3 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -96,6 +96,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public Integer clientViewDistance; - // CraftBukkit end - -+ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper -+ - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); - this.spawnDimension = World.OVERWORLD; -@@ -108,6 +110,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.c(worldserver); - this.co = minecraftserver.a(this); - -+ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper -+ - // CraftBukkit start - this.displayName = this.getName(); - this.canPickUpLoot = true; -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index a314ed0106cbf4359dd1920bb4b3c6095b2550ee..ef2a276fa2bdcac789e2f195a9d06ecce38daa45 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -3,6 +3,7 @@ package net.minecraft.server; - import com.google.common.collect.ImmutableSet; - import java.util.Optional; - import java.util.Set; // Paper -+import java.util.Map; // Paper - import java.util.UUID; - import java.util.function.Function; - import java.util.stream.Stream; -@@ -311,8 +312,8 @@ public class EntityTypes { - return this.br.height; - } - -- @Nullable -- public T a(World world) { -+ public T create(World world) { return this.a(world); } // Paper - OBFHELPER -+ @Nullable public T a(World world) { // Paper - OBFHELPER - return this.bf.create(this, world); - } - -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index ac2f4354e8c442a20b842f315a76a3abdcfec4dc..f97fb0434e80478d514a718a1e7376fd2717037d 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -@@ -68,6 +68,15 @@ public abstract class IAsyncTaskHandler implements Mailbox> { } -+ // Paper start -+ public void scheduleOnMain(Runnable r0) { -+ // postToMainThread does not work the same as older versions of mc -+ // This method is actually used to create a TickTask, which can then be posted onto main -+ this.addTask(this.postToMainThread(r0)); -+ } -+ // Paper end -+ -+ public final void addTask(R r0) { a(r0); }; // Paper - OBFHELPER - public void a(R r0) { - this.d.add(r0); - LockSupport.unpark(this.getThread()); -diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java -index cff2d0f0560fb744473d0baa4e4d6928d6559108..93946d15c08fa71c63273f6b4e096bb8b4448394 100644 ---- a/src/main/java/net/minecraft/server/IBlockAccess.java -+++ b/src/main/java/net/minecraft/server/IBlockAccess.java -@@ -12,6 +12,19 @@ public interface IBlockAccess { - TileEntity getTileEntity(BlockPosition blockposition); ++ private void dispatchPacket(Packet packet, @Nullable GenericFutureListener> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER + private void b(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { + EnumProtocol enumprotocol = EnumProtocol.a(packet); + EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get(); +@@ -208,6 +209,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - IBlockData getType(BlockPosition blockposition); -+ // Paper start - if loaded util -+ IBlockData getTypeIfLoaded(BlockPosition blockposition); -+ default Material getMaterialIfLoaded(BlockPosition blockposition) { -+ IBlockData type = this.getTypeIfLoaded(blockposition); -+ return type == null ? null : type.getMaterial(); -+ } -+ -+ default Block getBlockIfLoaded(BlockPosition blockposition) { -+ IBlockData type = this.getTypeIfLoaded(blockposition); -+ return type == null ? null : type.getBlock(); -+ } -+ Fluid getFluidIfLoaded(BlockPosition blockposition); -+ // Paper end + } - Fluid getFluid(BlockPosition blockposition); ++ private void sendPacketQueue() { this.p(); } // Paper - OBFHELPER + private void p() { + if (this.channel != null && this.channel.isOpen()) { + Queue queue = this.packetQueue; +@@ -344,9 +346,9 @@ public class NetworkManager extends SimpleChannelInboundHandler> { -diff --git a/src/main/java/net/minecraft/server/IOWorker.java b/src/main/java/net/minecraft/server/IOWorker.java -index 38ccfd78639a85abcefb915c5c231be5881cebc1..8668b8f3941f37a7bc30a55c33baf74bd8ac49e3 100644 ---- a/src/main/java/net/minecraft/server/IOWorker.java -+++ b/src/main/java/net/minecraft/server/IOWorker.java -@@ -21,7 +21,7 @@ public class IOWorker implements AutoCloseable { - private static final Logger LOGGER = LogManager.getLogger(); - private final AtomicBoolean b = new AtomicBoolean(); - private final ThreadedMailbox c; -- private final RegionFileCache d; -+ private final RegionFileCache d;public RegionFileCache getRegionFileCache() { return d; } // Paper - OBFHELPER - private final Map e = Maps.newLinkedHashMap(); + static class QueuedPacket { - protected IOWorker(File file, boolean flag, String s) { -diff --git a/src/main/java/net/minecraft/server/IWorldReader.java b/src/main/java/net/minecraft/server/IWorldReader.java -index b163033a3e15a4fbfdfd8d09cae448675e61c185..eb7282c33dd4f0bb26b9ccafc42bd92e6fdb997e 100644 ---- a/src/main/java/net/minecraft/server/IWorldReader.java -+++ b/src/main/java/net/minecraft/server/IWorldReader.java -@@ -5,6 +5,7 @@ import javax.annotation.Nullable; +- private final Packet a; ++ private final Packet a; private final Packet getPacket() { return this.a; } // Paper - OBFHELPER + @Nullable +- private final GenericFutureListener> b; ++ private final GenericFutureListener> b; private final GenericFutureListener> getGenericFutureListener() { return this.b; } // Paper - OBFHELPER - public interface IWorldReader extends IBlockLightAccess, ICollisionAccess, BiomeManager.Provider { + public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { + this.a = packet; +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java +index f94e96406d6dc9c75091ae7563dd5b325f4f0c22..5413bf93f7f0f4491fca1f07c47a925fdace7751 100644 +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -49,6 +49,7 @@ public class PacketDataSerializer extends ByteBuf { + this.a = bytebuf; + } -+ @Nullable IChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading) ++ public static int countBytes(int i) { return PacketDataSerializer.a(i); } // Paper - OBFHELPER + public static int a(int i) { + for (int j = 1; j < 5; ++j) { + if ((i & -1 << j * 7) == 0) { +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java +index 06098698e4adc31aa96f9592975e441f965b5558..dc8cc8d6c00176c8562086282f726dc1b24b2c65 100644 +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java +@@ -44,6 +44,7 @@ public class PacketEncoder extends MessageToByteEncoder> { + packet.b(packetdataserializer); + } catch (Throwable throwable) { + PacketEncoder.LOGGER.error(throwable); ++ throwable.printStackTrace(); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? + if (packet.a()) { + throw new SkipEncodeException(throwable); + } else { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java +index d748e07f8870023e74796910a457d58ee0361ca6..2b8358995e4933d3fc3498407a7df7475d7b7e26 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInBEdit.java +@@ -7,7 +7,7 @@ import net.minecraft.world.item.ItemStack; + + public class PacketPlayInBEdit implements Packet { + +- private ItemStack a; ++ private ItemStack a; public ItemStack getBook() { return a; } // Paper - OBFHELPER + private boolean b; + private int c; + +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index 820ba7c59e7bc7b6f3311f1a4ec3d724e265a2af..b6b55d5baa5e8a6b69a3e4865c06bc8a4d61a4f3 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -28,7 +28,7 @@ public class PacketPlayOutMapChunk implements Packet { + private NBTTagCompound d; @Nullable - IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); + private int[] e; +- private byte[] f; ++ private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER + private List g; + private boolean h; -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index d4dcdcb2ca6a75c4927bc104e4b683e7c6ce702d..7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -49,7 +49,7 @@ public final class ItemStack { - })).apply(instance, ItemStack::new); - }); - private static final Logger LOGGER = LogManager.getLogger(); -- public static final ItemStack b = new ItemStack((Item) null); -+ public static final ItemStack b = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = b; // Paper - OBFHELPER - public static final DecimalFormat c = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error - decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); - }); -@@ -606,6 +606,24 @@ public final class ItemStack { - return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList(); +@@ -140,6 +140,7 @@ public class PacketPlayOutMapChunk implements Packet { + return bytebuf; } -+ // Paper start - (this is just a good no conflict location) -+ public org.bukkit.inventory.ItemStack asBukkitMirror() { -+ return CraftItemStack.asCraftMirror(this); -+ } -+ public org.bukkit.inventory.ItemStack asBukkitCopy() { -+ return CraftItemStack.asCraftMirror(this.cloneItemStack()); -+ } -+ public static ItemStack fromBukkitCopy(org.bukkit.inventory.ItemStack itemstack) { -+ return CraftItemStack.asNMSCopy(itemstack); -+ } -+ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack; -+ public org.bukkit.inventory.ItemStack getBukkitStack() { -+ if (bukkitStack == null || bukkitStack.getHandle() != this) { -+ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); -+ } -+ return bukkitStack; -+ } -+ // Paper end - public void setTag(@Nullable NBTTagCompound nbttagcompound) { - this.tag = nbttagcompound; - if (this.getItem().usesDurability()) { -@@ -704,6 +722,7 @@ public final class ItemStack { - return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; - } - -+ public void getOrCreateTagAndSet(String s, NBTBase nbtbase) { a(s, nbtbase);} // Paper - OBFHELPER - public void a(String s, NBTBase nbtbase) { - this.getOrCreateTag().set(s, nbtbase); - } -@@ -789,6 +808,7 @@ public final class ItemStack { - // CraftBukkit start - @Deprecated - public void setItem(Item item) { -+ this.bukkitStack = null; // Paper - this.item = item; - } - // CraftBukkit end ++ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER + public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { + int j = 0; + ChunkSection[] achunksection = chunk.getSections(); diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..17d73ebbe51a83f79f338bdb1b366cecd99f880d +index 0000000000000000000000000000000000000000..18b56b59fd6efd618e6ff6f9cf3a02f57588d244 --- /dev/null +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -0,0 +1,503 @@ +@@ -0,0 +1,510 @@ +package net.minecraft.server; + +import com.destroystokyo.paper.block.TargetBlockInfo; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; ++import net.minecraft.core.BlockPosition; ++import net.minecraft.core.EnumDirection; ++import net.minecraft.server.level.WorldServer; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.level.ChunkCoordIntPair; ++import net.minecraft.world.level.RayTrace; ++import net.minecraft.world.level.World; +import org.apache.commons.lang.exception.ExceptionUtils; +import org.bukkit.Location; +import org.bukkit.block.BlockFace; @@ -3802,10 +3009,10 @@ index 0000000000000000000000000000000000000000..17d73ebbe51a83f79f338bdb1b366cec + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2c8674fbdb76a03e87f94779c30e871962de1f4c..7678f69b9b9a28e6b1ac837fb9e499d8e0db1b13 100644 +index 76d880e05bbc1534343a105dd7121bddd729b8a2..08443ca31ead7c484f0faeef57305c28d74c0e3f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -767,6 +767,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant map; -+ public final Map map; // Paper +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 7fd6893c30fbb34367181620aa159ed79b803455..3055ef62a054d91a74552f83f7afdfe08c7880db 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -42,6 +42,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStruct + import net.minecraft.world.level.storage.Convertable; + import net.minecraft.world.level.storage.WorldData; + import net.minecraft.world.level.storage.WorldPersistentData; ++import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper - protected NBTTagCompound(Map map) { - this.map = map; -@@ -133,10 +133,14 @@ public class NBTTagCompound implements NBTBase { - this.map.put(s, NBTTagLong.a(i)); - } + public class ChunkProviderServer extends IChunkProvider { -+ public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER - public void a(String s, UUID uuid) { - this.map.put(s, GameProfileSerializer.a(uuid)); - } - -+ -+ @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER -+ @Nullable - public UUID a(String s) { - return GameProfileSerializer.a(this.get(s)); - } -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index cd17ad99cd1aa7c474566151025991e3f605f734..6034f0cf5a22adb8441226cd54c519e41c198f6f 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -158,6 +158,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - - } - -+ private void dispatchPacket(Packet packet, @Nullable GenericFutureListener> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER - private void b(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { - EnumProtocol enumprotocol = EnumProtocol.a(packet); - EnumProtocol enumprotocol1 = (EnumProtocol) this.channel.attr(NetworkManager.c).get(); -@@ -198,6 +199,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - - } - -+ private void sendPacketQueue() { this.p(); } // Paper - OBFHELPER - private void p() { - if (this.channel != null && this.channel.isOpen()) { - Queue queue = this.packetQueue; -@@ -334,9 +336,9 @@ public class NetworkManager extends SimpleChannelInboundHandler> { - - static class QueuedPacket { - -- private final Packet a; -+ private final Packet a; private final Packet getPacket() { return this.a; } // Paper - OBFHELPER - @Nullable -- private final GenericFutureListener> b; -+ private final GenericFutureListener> b; private final GenericFutureListener> getGenericFutureListener() { return this.b; } // Paper - OBFHELPER - - public QueuedPacket(Packet packet, @Nullable GenericFutureListener> genericfuturelistener) { - this.a = packet; -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 1b9b0d98c0ad179b1351a887a90fcb1f83e8d5ea..2976e8cc2da6e54e08e50ca1f5de5669823ef3f7 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -36,6 +36,7 @@ public class PacketDataSerializer extends ByteBuf { - this.a = bytebuf; - } - -+ public static int countBytes(int i) { return PacketDataSerializer.a(i); } // Paper - OBFHELPER - public static int a(int i) { - for (int j = 1; j < 5; ++j) { - if ((i & -1 << j * 7) == 0) { -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 90223deae3376fd6828eddf3831dab96650afef2..63c4dbd327beb7b6ab42eb44650d68accd3b0de6 100644 ---- a/src/main/java/net/minecraft/server/PacketEncoder.java -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -42,6 +42,7 @@ public class PacketEncoder extends MessageToByteEncoder> { - packet.b(packetdataserializer); - } catch (Throwable throwable) { - PacketEncoder.LOGGER.error(throwable); -+ throwable.printStackTrace(); // Paper - WHAT WAS IT? WHO DID THIS TO YOU? WHAT DID YOU SEE? - if (packet.a()) { - throw new SkipEncodeException(throwable); - } else { -diff --git a/src/main/java/net/minecraft/server/PacketPlayInBEdit.java b/src/main/java/net/minecraft/server/PacketPlayInBEdit.java -index d7252b044288aadb1d235dd968038ee5c13cf701..185ba3789739d06bcb58979519e1f8ff8439be9f 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInBEdit.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInBEdit.java -@@ -4,7 +4,7 @@ import java.io.IOException; - - public class PacketPlayInBEdit implements Packet { - -- private ItemStack a; -+ private ItemStack a; public ItemStack getBook() { return a; } // Paper - OBFHELPER - private boolean b; - private int c; - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 8bdda63a2807635e8780481244251f6e35c13627..36a7e41cc5036345929ebf4d2fa160a8c16c2c0a 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -17,7 +17,7 @@ public class PacketPlayOutMapChunk implements Packet { - private NBTTagCompound d; +@@ -49,7 +50,7 @@ public class ChunkProviderServer extends IChunkProvider { + private final ChunkMapDistance chunkMapDistance; + public final ChunkGenerator chunkGenerator; + private final WorldServer world; +- private final Thread serverThread; ++ public final Thread serverThread; // Paper - private -> public + private final LightEngineThreaded lightEngine; + private final ChunkProviderServer.a serverThreadQueue; + public final PlayerChunkMap playerChunkMap; +@@ -62,6 +63,158 @@ public class ChunkProviderServer extends IChunkProvider { + private final IChunkAccess[] cacheChunk = new IChunkAccess[4]; @Nullable - private int[] e; -- private byte[] f; -+ private byte[] f; private byte[] getData() { return this.f; } // Paper - OBFHELPER - private List g; - private boolean h; + private SpawnerCreature.d p; ++ // Paper start ++ final com.destroystokyo.paper.util.concurrent.WeakSeqLock loadedChunkMapSeqLock = new com.destroystokyo.paper.util.concurrent.WeakSeqLock(); ++ final Long2ObjectOpenHashMap loadedChunkMap = new Long2ObjectOpenHashMap<>(8192, 0.5f); ++ ++ private final Chunk[] lastLoadedChunks = new Chunk[4 * 4]; ++ ++ private static int getChunkCacheKey(int x, int z) { ++ return x & 3 | ((z & 3) << 2); ++ } ++ ++ void addLoadedChunk(Chunk chunk) { ++ this.loadedChunkMapSeqLock.acquireWrite(); ++ try { ++ this.loadedChunkMap.put(chunk.coordinateKey, chunk); ++ } finally { ++ this.loadedChunkMapSeqLock.releaseWrite(); ++ } ++ ++ // rewrite cache if we have to ++ // we do this since we also cache null chunks ++ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); ++ ++ this.lastLoadedChunks[cacheKey] = chunk; ++ } ++ ++ void removeLoadedChunk(Chunk chunk) { ++ this.loadedChunkMapSeqLock.acquireWrite(); ++ try { ++ this.loadedChunkMap.remove(chunk.coordinateKey); ++ } finally { ++ this.loadedChunkMapSeqLock.releaseWrite(); ++ } ++ ++ // rewrite cache if we have to ++ // we do this since we also cache null chunks ++ int cacheKey = getChunkCacheKey(chunk.locX, chunk.locZ); ++ ++ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; ++ if (cachedChunk != null && cachedChunk.coordinateKey == chunk.coordinateKey) { ++ this.lastLoadedChunks[cacheKey] = null; ++ } ++ } ++ ++ public final Chunk getChunkAtIfLoadedMainThread(int x, int z) { ++ int cacheKey = getChunkCacheKey(x, z); ++ ++ Chunk cachedChunk = this.lastLoadedChunks[cacheKey]; ++ if (cachedChunk != null && cachedChunk.locX == x & cachedChunk.locZ == z) { ++ return this.lastLoadedChunks[cacheKey]; ++ } ++ ++ long chunkKey = ChunkCoordIntPair.pair(x, z); ++ ++ cachedChunk = this.loadedChunkMap.get(chunkKey); ++ // Skipping a null check to avoid extra instructions to improve inline capability ++ this.lastLoadedChunks[cacheKey] = cachedChunk; ++ return cachedChunk; ++ } ++ ++ public final Chunk getChunkAtIfLoadedMainThreadNoCache(int x, int z) { ++ return this.loadedChunkMap.get(ChunkCoordIntPair.pair(x, z)); ++ } ++ ++ public final Chunk getChunkAtMainThread(int x, int z) { ++ Chunk ret = this.getChunkAtIfLoadedMainThread(x, z); ++ if (ret != null) { ++ return ret; ++ } ++ return (Chunk)this.getChunkAt(x, z, ChunkStatus.FULL, true); ++ } ++ ++ private long chunkFutureAwaitCounter; ++ ++ public void getEntityTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ this.serverThreadQueue.execute(() -> { ++ ChunkProviderServer.this.getEntityTickingChunkAsync(x, z, onLoad); ++ }); ++ return; ++ } ++ this.getChunkFutureAsynchronously(x, z, 31, PlayerChunk::getEntityTickingFuture, onLoad); ++ } ++ ++ public void getTickingChunkAsync(int x, int z, java.util.function.Consumer onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ this.serverThreadQueue.execute(() -> { ++ ChunkProviderServer.this.getTickingChunkAsync(x, z, onLoad); ++ }); ++ return; ++ } ++ this.getChunkFutureAsynchronously(x, z, 32, PlayerChunk::getTickingFuture, onLoad); ++ } ++ ++ public void getFullChunkAsync(int x, int z, java.util.function.Consumer onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ this.serverThreadQueue.execute(() -> { ++ ChunkProviderServer.this.getFullChunkAsync(x, z, onLoad); ++ }); ++ return; ++ } ++ this.getChunkFutureAsynchronously(x, z, 33, PlayerChunk::getFullChunkFuture, onLoad); ++ } ++ ++ private void getChunkFutureAsynchronously(int x, int z, int ticketLevel, Function>> futureGet, java.util.function.Consumer onLoad) { ++ if (Thread.currentThread() != this.serverThread) { ++ throw new IllegalStateException(); ++ } ++ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); ++ Long identifier = this.chunkFutureAwaitCounter++; ++ this.chunkMapDistance.addTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ this.tickDistanceManager(); ++ ++ PlayerChunk chunk = this.playerChunkMap.getUpdatingChunk(chunkPos.pair()); ++ ++ if (chunk == null) { ++ throw new IllegalStateException("Expected playerchunk " + chunkPos + " in world '" + this.world.getWorld().getName() + "'"); ++ } ++ ++ CompletableFuture> future = futureGet.apply(chunk); ++ ++ future.whenCompleteAsync((either, throwable) -> { ++ try { ++ if (throwable != null) { ++ if (throwable instanceof ThreadDeath) { ++ throw (ThreadDeath)throwable; ++ } ++ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", throwable); ++ } else if (either.right().isPresent()) { ++ net.minecraft.server.MinecraftServer.LOGGER.fatal("Failed to complete future await for chunk " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "': " + either.right().get().toString()); ++ } ++ ++ try { ++ if (onLoad != null) { ++ playerChunkMap.callbackExecutor.execute(() -> { ++ onLoad.accept(either == null ? null : either.left().orElse(null)); // indicate failure to the callback. ++ }); ++ } ++ } catch (Throwable thr) { ++ if (thr instanceof ThreadDeath) { ++ throw (ThreadDeath)thr; ++ } ++ net.minecraft.server.MinecraftServer.LOGGER.fatal("Load callback for future await failed " + chunkPos.toString() + " in world '" + ChunkProviderServer.this.world.getWorld().getName() + "'", thr); ++ return; ++ } ++ } finally { ++ // due to odd behaviour with CB unload implementation we need to have these AFTER the load callback. ++ ChunkProviderServer.this.chunkMapDistance.addTicketAtLevel(TicketType.UNKNOWN, chunkPos, ticketLevel, chunkPos); ++ ChunkProviderServer.this.chunkMapDistance.removeTicketAtLevel(TicketType.FUTURE_AWAIT, chunkPos, ticketLevel, identifier); ++ } ++ }, this.serverThreadQueue); ++ } ++ // Paper end -@@ -129,6 +129,7 @@ public class PacketPlayOutMapChunk implements Packet { - return bytebuf; + public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier supplier) { + this.world = worldserver; +@@ -123,6 +276,49 @@ public class ChunkProviderServer extends IChunkProvider { + this.cacheChunk[0] = ichunkaccess; } -+ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER - public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { - int j = 0; - ChunkSection[] achunksection = chunk.getSections(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b2c751b30 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -21,9 +21,9 @@ public class PlayerChunk { ++ // Paper start - "real" get chunk if loaded ++ // Note: Partially copied from the getChunkAt method below ++ @Nullable ++ public Chunk getChunkAtIfCachedImmediately(int x, int z) { ++ long k = ChunkCoordIntPair.pair(x, z); ++ ++ // Note: Bypass cache since we need to check ticket level, and to make this MT-Safe ++ ++ PlayerChunk playerChunk = this.getChunk(k); ++ if (playerChunk == null) { ++ return null; ++ } ++ ++ return playerChunk.getFullChunkIfCached(); ++ } ++ ++ @Nullable ++ public Chunk getChunkAtIfLoadedImmediately(int x, int z) { ++ long k = ChunkCoordIntPair.pair(x, z); ++ ++ if (Thread.currentThread() == this.serverThread) { ++ return this.getChunkAtIfLoadedMainThread(x, z); ++ } ++ ++ Chunk ret = null; ++ long readlock; ++ do { ++ readlock = this.loadedChunkMapSeqLock.acquireRead(); ++ try { ++ ret = this.loadedChunkMap.get(k); ++ } catch (Throwable thr) { ++ if (thr instanceof ThreadDeath) { ++ throw (ThreadDeath)thr; ++ } ++ // re-try, this means a CME occurred... ++ continue; ++ } ++ } while (!this.loadedChunkMapSeqLock.tryReleaseRead(readlock)); ++ ++ return ret; ++ } ++ // Paper end ++ + @Nullable + @Override + public IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag) { +@@ -405,10 +601,9 @@ public class ChunkProviderServer extends IChunkProvider { + + this.p = spawnercreature_d; + this.world.getMethodProfiler().exit(); +- List list = Lists.newArrayList(this.playerChunkMap.f()); +- +- Collections.shuffle(list); +- list.forEach((playerchunk) -> { ++ //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper ++ //Collections.shuffle(list); // Paper ++ this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + + if (optional.isPresent()) { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index f1459d4d2b2592aea1fc39257255979f0a8c61e5..e818bf022b74cae34a512d8c98b47ec3e5c74b9a 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -223,6 +223,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public Integer clientViewDistance; + // CraftBukkit end + ++ public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper ++ + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); + this.spawnDimension = World.OVERWORLD; +@@ -235,6 +237,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.c(worldserver); + this.co = minecraftserver.a(this); + ++ this.cachedSingleHashSet = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper ++ + // CraftBukkit start + this.displayName = this.getName(); + this.canPickUpLoot = true; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 254953c1d8ad80173bcc9ed703bacaf32ca89c9a..7dea5e783ce2a1f8ddd2b3ab7a19e03a56c36ba1 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -46,9 +46,9 @@ public class PlayerChunk { private static final List CHUNK_STATUSES = ChunkStatus.a(); private static final PlayerChunk.State[] CHUNK_STATES = PlayerChunk.State.values(); private final AtomicReferenceArray>> statusFutures; @@ -3950,7 +3305,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b private CompletableFuture chunkSave; public int oldTicketLevel; private int ticketLevel; -@@ -39,6 +39,8 @@ public class PlayerChunk { +@@ -64,6 +64,8 @@ public class PlayerChunk { private boolean hasBeenLoaded; private boolean x; @@ -3959,7 +3314,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -54,10 +56,49 @@ public class PlayerChunk { +@@ -79,10 +81,49 @@ public class PlayerChunk { this.ticketLevel = this.oldTicketLevel; this.n = this.oldTicketLevel; this.a(i); @@ -4010,7 +3365,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b if (!getChunkState(this.oldTicketLevel).isAtLeast(PlayerChunk.State.BORDER)) return null; // note: using oldTicketLevel for isLoaded checks return this.getFullChunkUnchecked(); } -@@ -68,6 +109,14 @@ public class PlayerChunk { +@@ -93,6 +134,14 @@ public class PlayerChunk { return (either == null) ? null : (Chunk) either.left().orElse(null); } // CraftBukkit end @@ -4025,7 +3380,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { CompletableFuture> completablefuture = (CompletableFuture) this.statusFutures.get(chunkstatus.c()); -@@ -79,20 +128,23 @@ public class PlayerChunk { +@@ -104,20 +153,23 @@ public class PlayerChunk { return getChunkStatus(this.ticketLevel).b(chunkstatus) ? this.getStatusFutureUnchecked(chunkstatus) : PlayerChunk.UNLOADED_CHUNK_ACCESS_FUTURE; } @@ -4053,7 +3408,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b CompletableFuture> completablefuture = this.a(); Either either = (Either) completablefuture.getNow(null); // CraftBukkit - decompile error -@@ -117,7 +169,7 @@ public class PlayerChunk { +@@ -142,7 +194,7 @@ public class PlayerChunk { return null; } @@ -4062,7 +3417,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b return this.chunkSave; } -@@ -258,11 +310,11 @@ public class PlayerChunk { +@@ -283,11 +335,11 @@ public class PlayerChunk { }); } @@ -4076,7 +3431,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b return this.ticketLevel; } -@@ -333,13 +385,27 @@ public class PlayerChunk { +@@ -358,13 +410,27 @@ public class PlayerChunk { this.hasBeenLoaded |= flag3; if (!flag2 && flag3) { @@ -4105,7 +3460,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b this.a(((CompletableFuture>) completablefuture).thenApply((either1) -> { // CraftBukkit - decompile error playerchunkmap.getClass(); return either1.ifLeft(playerchunkmap::a); -@@ -350,12 +416,24 @@ public class PlayerChunk { +@@ -375,12 +441,24 @@ public class PlayerChunk { boolean flag5 = playerchunk_state1.isAtLeast(PlayerChunk.State.TICKING); if (!flag4 && flag5) { @@ -4132,7 +3487,7 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b this.tickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -@@ -367,12 +445,24 @@ public class PlayerChunk { +@@ -392,12 +470,24 @@ public class PlayerChunk { throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException())); } @@ -4159,11 +3514,11 @@ index f645d3dfb57e99757e233ee2bbb51be5094203cb..985fc002fa5afc71ecd242aa8101684b this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 8ec2eac3646263634c1c763b7d827d25134e2938..e641f4b89b39525686bba4d1e91c4ec26a9bd681 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -102,6 +102,26 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index b9a0b37ceeeda9f6b1c4c23283e53dcb229f7249..67cae076af338348fdc9c5de51377b32a97ef836 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -146,6 +146,26 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end @@ -4190,7 +3545,7 @@ index 8ec2eac3646263634c1c763b7d827d25134e2938..e641f4b89b39525686bba4d1e91c4ec2 public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i, boolean flag) { super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); this.visibleChunks = this.updatingChunks.clone(); -@@ -191,6 +211,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -235,6 +255,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; } @@ -4205,7 +3560,7 @@ index 8ec2eac3646263634c1c763b7d827d25134e2938..e641f4b89b39525686bba4d1e91c4ec2 private CompletableFuture, PlayerChunk.Failure>> a(ChunkCoordIntPair chunkcoordintpair, int i, IntFunction intfunction) { List>> list = Lists.newArrayList(); int j = chunkcoordintpair.x; -@@ -901,6 +929,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -945,6 +973,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!flag1) { this.chunkDistanceManager.a(SectionPosition.a((Entity) entityplayer), entityplayer); } @@ -4213,7 +3568,7 @@ index 8ec2eac3646263634c1c763b7d827d25134e2938..e641f4b89b39525686bba4d1e91c4ec2 } else { SectionPosition sectionposition = entityplayer.O(); -@@ -908,6 +937,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -952,6 +981,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!flag2) { this.chunkDistanceManager.b(sectionposition, entityplayer); } @@ -4221,7 +3576,7 @@ index 8ec2eac3646263634c1c763b7d827d25134e2938..e641f4b89b39525686bba4d1e91c4ec2 } for (int k = i - this.viewDistance; k <= i + this.viewDistance; ++k) { -@@ -1018,6 +1048,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1062,6 +1092,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -4230,88 +3585,11 @@ index 8ec2eac3646263634c1c763b7d827d25134e2938..e641f4b89b39525686bba4d1e91c4ec2 } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2abd00975b058baca32e5de67c96dad46f266dee..b37b791cd66b2e88dd0ecf52beea1844c97cdb94 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -73,9 +73,9 @@ public class PlayerConnection implements PacketListenerPlayIn { - private final MinecraftServer minecraftServer; - public EntityPlayer player; - private int e; -- private long lastKeepAlive; -- private boolean awaitingKeepAlive; -- private long h; -+ private long lastKeepAlive; private void setLastPing(long lastPing) { this.lastKeepAlive = lastPing;}; private long getLastPing() { return this.lastKeepAlive;}; // Paper - OBFHELPER -+ private boolean awaitingKeepAlive; private void setPendingPing(boolean isPending) { this.awaitingKeepAlive = isPending;}; private boolean isPendingPing() { return this.awaitingKeepAlive;}; // Paper - OBFHELPER -+ private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER - // CraftBukkit start - multithreaded fields - private volatile int chatThrottle; - private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); -diff --git a/src/main/java/net/minecraft/server/PlayerInventory.java b/src/main/java/net/minecraft/server/PlayerInventory.java -index c027fb94881be14396cba879087861df35023500..3b65711b91c51ac7b4b5b2b0144ffd279fe60eeb 100644 ---- a/src/main/java/net/minecraft/server/PlayerInventory.java -+++ b/src/main/java/net/minecraft/server/PlayerInventory.java -@@ -17,7 +17,7 @@ public class PlayerInventory implements IInventory, INamableTileEntity { - public final NonNullList items; - public final NonNullList armor; - public final NonNullList extraSlots; -- private final List> f; -+ private final List> f;List> getComponents() { return f; } // Paper - OBFHELPER - public int itemInHandIndex; - public final EntityHuman player; - private ItemStack carried; -diff --git a/src/main/java/net/minecraft/server/PotionUtil.java b/src/main/java/net/minecraft/server/PotionUtil.java -index 44392c0f919a6a948ba8de0a559573727307a608..c995ce224e5236ecb33a01375824c55931faa9c0 100644 ---- a/src/main/java/net/minecraft/server/PotionUtil.java -+++ b/src/main/java/net/minecraft/server/PotionUtil.java -@@ -112,6 +112,7 @@ public class PotionUtil { - return nbttagcompound == null ? Potions.EMPTY : PotionRegistry.a(nbttagcompound.getString("Potion")); - } - -+ public static ItemStack addPotionToItemStack(ItemStack itemstack, PotionRegistry potionregistry) { return a(itemstack, potionregistry); } // Paper - OBFHELPER - public static ItemStack a(ItemStack itemstack, PotionRegistry potionregistry) { - MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); - -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 2335dfb90314b1b049a6cb0f8706dbbd07b4ff78..e356bd73901ac7f230492e654af579d21c8fc086 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -81,6 +81,18 @@ public class ProtoChunk implements IChunkAccess { - - } - -+ // Paper start - If loaded util -+ @Override -+ public Fluid getFluidIfLoaded(BlockPosition blockposition) { -+ return this.getFluid(blockposition); -+ } -+ -+ @Override -+ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { -+ return this.getType(blockposition); -+ } -+ // Paper end -+ - @Override - public IBlockData getType(BlockPosition blockposition) { - int i = blockposition.getY(); -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 49387e812a50b8cda45352cf9dd6b1692b7476c1..135f38cc5d5d2fa3866aa1063df49a96b5e72ac2 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -108,6 +108,7 @@ public class RegionFile implements AutoCloseable { - return this.e.resolve(s); - } - -+ @Nullable public synchronized DataInputStream getReadStream(ChunkCoordIntPair chunkCoordIntPair) throws IOException { return a(chunkCoordIntPair);} // Paper - OBFHELPER - @Nullable - public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { - int i = this.getOffset(chunkcoordintpair); -diff --git a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -index adc9959932a99ff62af4f893d0f8af1130579138..34a72ba218892de337752af896fd307f91d9fc95 100644 ---- a/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -+++ b/src/main/java/net/minecraft/server/RegionLimitedWorldAccess.java -@@ -104,6 +104,26 @@ public class RegionLimitedWorldAccess implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java b/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java +index 91d9e6b554964e1f4dd67deea220a738f2715aee..04006caeeb42b523d986efc313828557854718d7 100644 +--- a/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java ++++ b/src/main/java/net/minecraft/server/level/RegionLimitedWorldAccess.java +@@ -141,6 +141,26 @@ public class RegionLimitedWorldAccess implements GeneratorAccessSeed { return i >= this.n.x && i <= this.o.x && j >= this.n.z && j <= this.o.z; } @@ -4338,36 +3616,11 @@ index adc9959932a99ff62af4f893d0f8af1130579138..34a72ba218892de337752af896fd307f @Override public IBlockData getType(BlockPosition blockposition) { return this.getChunkAt(blockposition.getX() >> 4, blockposition.getZ() >> 4).getType(blockposition); -diff --git a/src/main/java/net/minecraft/server/RegistryBlockID.java b/src/main/java/net/minecraft/server/RegistryBlockID.java -index 06ea0c3bfcb54a5f6a42363f633800c687b6f19d..f9c444c3caa1a38feafca0c59a937868b528fffe 100644 ---- a/src/main/java/net/minecraft/server/RegistryBlockID.java -+++ b/src/main/java/net/minecraft/server/RegistryBlockID.java -@@ -64,6 +64,7 @@ public class RegistryBlockID implements Registry { - return Iterators.filter(this.c.iterator(), Predicates.notNull()); - } - -+ public int size() { return this.a(); } // Paper - OBFHELPER - public int a() { - return this.b.size(); - } -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 5f3a960b3303c48b039630b39975d6ef549a4dbe..bdfd17362518ff2398cf9e1743a7a4f0c7a0e966 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -72,7 +72,7 @@ public class SystemUtils { - } - - public static long getMonotonicNanos() { -- return SystemUtils.a.getAsLong(); -+ return System.nanoTime(); // Paper - } - - public static long getTimeMillis() { -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index f82db93f88223ffddc55deec8f21efc5b774d900..75ab9f185b3231113dfa387c956a707b403bb2db 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -21,6 +21,7 @@ public class TicketType { +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index 9cae7fed34df3ff81d75105b2fcbc4510f2a0e71..285a03b57431bd6a4d26bb84e916d2c6e1eb0213 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -25,6 +25,7 @@ public class TicketType { public static final TicketType UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit public static final TicketType PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit @@ -4375,28 +3628,400 @@ index f82db93f88223ffddc55deec8f21efc5b774d900..75ab9f185b3231113dfa387c956a707b public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index ff41038ce6d2c1a8093bce3539070fa0ccfd61c2..ed0f9c5d29c4f88b7beee4b0ecdd7a56de2d7a9e 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -21,10 +21,12 @@ public final class VoxelShapes { - public static final VoxelShape a = create(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); - private static final VoxelShape c = new VoxelShapeArray(new VoxelShapeBitSet(0, 0, 0), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D})); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index b88b0890cb5b5b0c4c2c35456fdffb02e8cfcf91..bc580b35bdffddc5675a7bd50801057587fd02fe 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -12,6 +12,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; + import it.unimi.dsi.fastutil.longs.LongSet; + import it.unimi.dsi.fastutil.longs.LongSets; + import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; ++import it.unimi.dsi.fastutil.objects.Object2IntMap; + import it.unimi.dsi.fastutil.objects.ObjectIterator; + import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; + import java.io.BufferedWriter; +@@ -169,7 +170,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + private final Map entitiesByUUID = Maps.newHashMap(); + private final Queue entitiesToAdd = Queues.newArrayDeque(); + private final List players = Lists.newArrayList(); +- private final ChunkProviderServer chunkProvider; ++ public final ChunkProviderServer chunkProvider; // Paper - public + boolean tickingEntities; + private final MinecraftServer server; + public final WorldDataServer worldDataServer; // CraftBukkit - type +@@ -1687,7 +1688,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + ObjectIterator objectiterator = spawnercreature_d.b().object2IntEntrySet().iterator(); -+ public static final VoxelShape empty() {return a();} // Paper - OBFHELPER - public static VoxelShape a() { - return VoxelShapes.c; + while (objectiterator.hasNext()) { +- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); ++ Object2IntMap.Entry it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + + bufferedwriter.write(String.format("spawn_count.%s: %d\n", ((EnumCreatureType) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey()).b(), it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue())); + } +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 638eb973121af6d942bdc6e9e0d6fceaa75ea665..5ed893d96fe317dc5a238c82b0bd5f3f03dfa9cc 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -218,9 +218,9 @@ public class PlayerConnection implements PacketListenerPlayIn { + private final MinecraftServer minecraftServer; + public EntityPlayer player; + private int e; +- private long lastKeepAlive; +- private boolean awaitingKeepAlive; +- private long h; ++ private long lastKeepAlive; private void setLastPing(long lastPing) { this.lastKeepAlive = lastPing;}; private long getLastPing() { return this.lastKeepAlive;}; // Paper - OBFHELPER ++ private boolean awaitingKeepAlive; private void setPendingPing(boolean isPending) { this.awaitingKeepAlive = isPending;}; private boolean isPendingPing() { return this.awaitingKeepAlive;}; // Paper - OBFHELPER ++ private long h; private void setKeepAliveID(long keepAliveID) { this.h = keepAliveID;}; private long getKeepAliveID() {return this.h; }; // Paper - OBFHELPER + // CraftBukkit start - multithreaded fields + private volatile int chatThrottle; + private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); +diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java +index 54974a941a334dc0c8e62ffb8ca094772888b8fa..0c0576c8730069fb5364d8383dec8ab7e698658d 100644 +--- a/src/main/java/net/minecraft/util/DataBits.java ++++ b/src/main/java/net/minecraft/util/DataBits.java +@@ -84,6 +84,7 @@ public class DataBits { + return (int) (k >> l & this.d); } -+ public static final VoxelShape fullCube() {return b();} // Paper - OBFHELPER - public static VoxelShape b() { - return VoxelShapes.b; ++ public final long[] getDataBits() { return this.a(); } // Paper - OBFHELPER + public long[] a() { + return this.b; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 1606a7b4727fffef27d6bb08633b652b7e7fe588..6df28adb17d78a7f5189787a979a44fad677f05c 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +index 2b2c03ab62816f3d21ef953c4a45f55e3997cca6..e5641f2b41d89a57285fc072a48b951aa03a14a7 100644 +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +@@ -68,6 +68,15 @@ public abstract class IAsyncTaskHandler implements Mailbox entitytypes, World world) { + super(entitytypes, world); + } +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index b91bb7f562d5c43ec1d0d88ba417e43b07dbf0f3..dbfcdc3cc7c1dccf785f5e13634e84c5af088985 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -225,6 +225,7 @@ public abstract class EntityInsentient extends EntityLiving { + return this.goalTarget; + } + ++ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper + public void setGoalTarget(@Nullable EntityLiving entityliving) { + // CraftBukkit start - fire event + setGoalTarget(entityliving, EntityTargetEvent.TargetReason.UNKNOWN, true); +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index e4710d5fd7d28d6269d26cf1e3d399a66f5fabf1..feb640a21f4d0b00d85c1c4f013c22454616578a 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -231,6 +231,7 @@ public abstract class EntityLiving extends Entity { + public boolean collides = true; + public Set collidableExemptions = new HashSet<>(); + public boolean canPickUpLoot; ++ public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper + + @Override + public float getBukkitYaw() { +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index a32bc63ff1960bdb874d546ee42633063834da24..ac57ab9992e141c91cf48f033148ad78433b364c 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -3,6 +3,7 @@ package net.minecraft.world.entity; + import com.google.common.collect.ImmutableSet; + import java.util.Optional; + import java.util.Set; // Paper ++import java.util.Map; // Paper + import java.util.UUID; + import java.util.function.Function; + import java.util.stream.Stream; +@@ -441,8 +442,8 @@ public class EntityTypes { + return this.br.height; + } + +- @Nullable +- public T a(World world) { ++ public T create(World world) { return this.a(world); } // Paper - OBFHELPER ++ @Nullable public T a(World world) { // Paper - OBFHELPER + return this.bf.create(this, world); + } + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java b/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java +index acebee991eca1e19fc1094718dc40822b66756e1..c484e27650364b6537fe6b2e8e14de98382b86a3 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityMonster.java +@@ -27,6 +27,7 @@ import net.minecraft.world.level.WorldAccess; + + public abstract class EntityMonster extends EntityCreature implements IMonster { + ++ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper + protected EntityMonster(EntityTypes entitytypes, World world) { + super(entitytypes, world); + this.f = 5; +diff --git a/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java b/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java +index 97db41acf626eec3e587964d0e73c370e5695bf0..bc251c67b2006ea85e890c29fec52dc034298281 100644 +--- a/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java ++++ b/src/main/java/net/minecraft/world/entity/player/PlayerInventory.java +@@ -38,7 +38,7 @@ public class PlayerInventory implements IInventory, INamableTileEntity { + public final NonNullList items; + public final NonNullList armor; + public final NonNullList extraSlots; +- private final List> f; ++ private final List> f;List> getComponents() { return f; } // Paper - OBFHELPER + public int itemInHandIndex; + public final EntityHuman player; + private ItemStack carried; +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index dee2714cd9fc930a1a13e97d752ab2df39cd31ed..4010152dccc93019f2e7f284d80b92bae0d91c34 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -103,7 +103,7 @@ public final class ItemStack { + })).apply(instance, ItemStack::new); + }); + private static final Logger LOGGER = LogManager.getLogger(); +- public static final ItemStack b = new ItemStack((Item) null); ++ public static final ItemStack b = new ItemStack((Item) null);public static final ItemStack NULL_ITEM = b; // Paper - OBFHELPER + public static final DecimalFormat c = (DecimalFormat) SystemUtils.a((new DecimalFormat("#.##")), (decimalformat) -> { // CraftBukkit - decompile error + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + }); +@@ -660,6 +660,24 @@ public final class ItemStack { + return this.tag != null ? this.tag.getList("Enchantments", 10) : new NBTTagList(); + } + ++ // Paper start - (this is just a good no conflict location) ++ public org.bukkit.inventory.ItemStack asBukkitMirror() { ++ return CraftItemStack.asCraftMirror(this); ++ } ++ public org.bukkit.inventory.ItemStack asBukkitCopy() { ++ return CraftItemStack.asCraftMirror(this.cloneItemStack()); ++ } ++ public static ItemStack fromBukkitCopy(org.bukkit.inventory.ItemStack itemstack) { ++ return CraftItemStack.asNMSCopy(itemstack); ++ } ++ private org.bukkit.craftbukkit.inventory.CraftItemStack bukkitStack; ++ public org.bukkit.inventory.ItemStack getBukkitStack() { ++ if (bukkitStack == null || bukkitStack.getHandle() != this) { ++ bukkitStack = org.bukkit.craftbukkit.inventory.CraftItemStack.asCraftMirror(this); ++ } ++ return bukkitStack; ++ } ++ // Paper end + public void setTag(@Nullable NBTTagCompound nbttagcompound) { + this.tag = nbttagcompound; + if (this.getItem().usesDurability()) { +@@ -758,6 +776,7 @@ public final class ItemStack { + return this.tag != null && this.tag.hasKeyOfType("Enchantments", 9) ? !this.tag.getList("Enchantments", 10).isEmpty() : false; + } + ++ public void getOrCreateTagAndSet(String s, NBTBase nbtbase) { a(s, nbtbase);} // Paper - OBFHELPER + public void a(String s, NBTBase nbtbase) { + this.getOrCreateTag().set(s, nbtbase); + } +@@ -843,6 +862,7 @@ public final class ItemStack { + // CraftBukkit start + @Deprecated + public void setItem(Item item) { ++ this.bukkitStack = null; // Paper + this.item = item; + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java b/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java +index daad63e731008eddccd3f51418a2a9b2d587f77b..795bc60a73e1e628590803fd515ffb78302d4f97 100644 +--- a/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java ++++ b/src/main/java/net/minecraft/world/item/alchemy/PotionUtil.java +@@ -121,6 +121,7 @@ public class PotionUtil { + return nbttagcompound == null ? Potions.EMPTY : PotionRegistry.a(nbttagcompound.getString("Potion")); + } + ++ public static ItemStack addPotionToItemStack(ItemStack itemstack, PotionRegistry potionregistry) { return a(itemstack, potionregistry); } // Paper - OBFHELPER + public static ItemStack a(ItemStack itemstack, PotionRegistry potionregistry) { + MinecraftKey minecraftkey = IRegistry.POTION.getKey(potionregistry); + +diff --git a/src/main/java/net/minecraft/world/level/BlockAccessAir.java b/src/main/java/net/minecraft/world/level/BlockAccessAir.java +index 5f8022745f709b6d542182d2ac94147aefdd3f0f..543b13c1e43135c044f834c2a6231e174536b623 100644 +--- a/src/main/java/net/minecraft/world/level/BlockAccessAir.java ++++ b/src/main/java/net/minecraft/world/level/BlockAccessAir.java +@@ -20,6 +20,18 @@ public enum BlockAccessAir implements IBlockAccess { + return null; + } + ++ // Paper start - If loaded util ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ return this.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ return this.getType(blockposition); ++ } ++ // Paper end ++ + @Override + public IBlockData getType(BlockPosition blockposition) { + return Blocks.AIR.getBlockData(); +diff --git a/src/main/java/net/minecraft/world/level/ChunkCache.java b/src/main/java/net/minecraft/world/level/ChunkCache.java +index 8541e87a34612e8bc86cf5c291164e091641d1af..5694c6225fd2b79c61ed004c4a696e75bbd53716 100644 +--- a/src/main/java/net/minecraft/world/level/ChunkCache.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCache.java +@@ -23,7 +23,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + protected final int b; + protected final IChunkAccess[][] c; + protected boolean d; +- protected final World e; ++ protected final World e; protected final World getWorld() { return e; } // Paper - OBFHELPER + + public ChunkCache(World world, BlockPosition blockposition, BlockPosition blockposition1) { + this.e = world; +@@ -42,7 +42,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + + for (k = this.a; k <= i; ++k) { + for (l = this.b; l <= j; ++l) { +- this.c[k - this.a][l - this.b] = ichunkprovider.a(k, l); ++ this.c[k - this.a][l - this.b] = ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(k, l); // Paper + } + } + +@@ -67,7 +67,7 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + int k = i - this.a; + int l = j - this.b; + +- if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { ++ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { // Paper - if this changes, update getChunkIfLoaded below + IChunkAccess ichunkaccess = this.c[k][l]; + + return (IChunkAccess) (ichunkaccess != null ? ichunkaccess : new ChunkEmpty(this.e, new ChunkCoordIntPair(i, j))); +@@ -86,6 +86,29 @@ public class ChunkCache implements IBlockAccess, ICollisionAccess { + return this.a(i, j); + } + ++ // Paper start - if loaded util ++ private IChunkAccess getChunkIfLoaded(int x, int z) { ++ int k = x - this.a; ++ int l = z - this.b; ++ ++ if (k >= 0 && k < this.c.length && l >= 0 && l < this.c[k].length) { ++ return this.c[k][l]; ++ } ++ return null; ++ } ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ return chunk == null ? null : chunk.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ IChunkAccess chunk = getChunkIfLoaded(blockposition.getX() >> 4, blockposition.getZ() >> 4); ++ return chunk == null ? null : chunk.getType(blockposition); ++ } ++ // Paper end ++ + @Nullable + @Override + public TileEntity getTileEntity(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +index 14e55bf842e928d1e8e2137f9efdef0f7c336362..9a88791be443a5b18934e7d752aee6dcdb8aa38f 100644 +--- a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +@@ -12,27 +12,32 @@ public class ChunkCoordIntPair { + public static final long a = pair(1875016, 1875016); + public final int x; + public final int z; ++ public final long longKey; // Paper + + public ChunkCoordIntPair(int i, int j) { + this.x = i; + this.z = j; ++ this.longKey = pair(this.x, this.z); // Paper + } + + public ChunkCoordIntPair(BlockPosition blockposition) { + this.x = blockposition.getX() >> 4; + this.z = blockposition.getZ() >> 4; ++ this.longKey = pair(this.x, this.z); // Paper + } + + public ChunkCoordIntPair(long i) { + this.x = (int) i; + this.z = (int) (i >> 32); ++ this.longKey = pair(this.x, this.z); // Paper + } + + public long pair() { +- return pair(this.x, this.z); ++ return longKey; // Paper + } + +- public static long pair(int i, int j) { ++ public static long pair(final BlockPosition pos) { return pair(pos.getX() >> 4, pos.getZ() >> 4); } // Paper - OBFHELPER ++ public static long pair(int i, int j) { + return (long) i & 4294967295L | ((long) j & 4294967295L) << 32; + } + +diff --git a/src/main/java/net/minecraft/world/level/IBlockAccess.java b/src/main/java/net/minecraft/world/level/IBlockAccess.java +index 25e50b57f42dde156443480d73c6c9985df6f0c6..f0b74dce1e0a3ca150251008247a14b380cde03d 100644 +--- a/src/main/java/net/minecraft/world/level/IBlockAccess.java ++++ b/src/main/java/net/minecraft/world/level/IBlockAccess.java +@@ -22,6 +22,19 @@ public interface IBlockAccess { + TileEntity getTileEntity(BlockPosition blockposition); + + IBlockData getType(BlockPosition blockposition); ++ // Paper start - if loaded util ++ IBlockData getTypeIfLoaded(BlockPosition blockposition); ++ default Material getMaterialIfLoaded(BlockPosition blockposition) { ++ IBlockData type = this.getTypeIfLoaded(blockposition); ++ return type == null ? null : type.getMaterial(); ++ } ++ ++ default Block getBlockIfLoaded(BlockPosition blockposition) { ++ IBlockData type = this.getTypeIfLoaded(blockposition); ++ return type == null ? null : type.getBlock(); ++ } ++ Fluid getFluidIfLoaded(BlockPosition blockposition); ++ // Paper end + + Fluid getFluid(BlockPosition blockposition); + +diff --git a/src/main/java/net/minecraft/world/level/IWorldReader.java b/src/main/java/net/minecraft/world/level/IWorldReader.java +index d3d33e77ce09d485552076c5ab6faf08a16d90db..5f12b290d59e0b5e843d644bf7f608a946ef02c0 100644 +--- a/src/main/java/net/minecraft/world/level/IWorldReader.java ++++ b/src/main/java/net/minecraft/world/level/IWorldReader.java +@@ -18,6 +18,7 @@ import net.minecraft.world.phys.AxisAlignedBB; + + public interface IWorldReader extends IBlockLightAccess, ICollisionAccess, BiomeManager.Provider { + ++ @Nullable IChunkAccess getChunkIfLoadedImmediately(int x, int z); // Paper - ifLoaded api (we need this since current impl blocks if the chunk is loading) + @Nullable + IChunkAccess getChunkAt(int i, int j, ChunkStatus chunkstatus, boolean flag); + +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index f794113e7cc5809d1da0c85648fb7311fb633f40..0cbebc2095489c240fecd3fd32f5373be2a3d684 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -74,6 +74,7 @@ import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.block.CapturedBlockState; @@ -4404,7 +4029,7 @@ index 1606a7b4727fffef27d6bb08633b652b7e7fe588..6df28adb17d78a7f5189787a979a44fa import org.bukkit.craftbukkit.block.data.CraftBlockData; import org.bukkit.event.block.BlockPhysicsEvent; // CraftBukkit end -@@ -203,17 +204,50 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -255,17 +256,50 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return i < 0 || i >= 256; } @@ -4459,7 +4084,7 @@ index 1606a7b4727fffef27d6bb08633b652b7e7fe588..6df28adb17d78a7f5189787a979a44fa IChunkAccess ichunkaccess = this.getChunkProvider().getChunkAt(i, j, chunkstatus, flag); if (ichunkaccess == null && flag) { -@@ -224,7 +258,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -276,7 +310,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } @Override @@ -4468,7 +4093,7 @@ index 1606a7b4727fffef27d6bb08633b652b7e7fe588..6df28adb17d78a7f5189787a979a44fa return this.a(blockposition, iblockdata, i, 512); } -@@ -370,8 +404,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -422,8 +456,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void a(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} @@ -4480,7 +4105,7 @@ index 1606a7b4727fffef27d6bb08633b652b7e7fe588..6df28adb17d78a7f5189787a979a44fa Fluid fluid = this.getFluid(blockposition); return this.setTypeAndData(blockposition, fluid.getBlockData(), 3 | (flag ? 64 : 0)); -@@ -517,7 +552,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -569,7 +604,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { if (isOutsideWorld(blockposition)) { return Blocks.VOID_AIR.getBlockData(); } else { @@ -4489,11 +4114,23 @@ index 1606a7b4727fffef27d6bb08633b652b7e7fe588..6df28adb17d78a7f5189787a979a44fa return chunk.getType(blockposition); } -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 5719ef9714e9680596a08c42c33508c16c0e676a..bb0f30f182856d2701fde9b1a65eeb987462104a 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -37,6 +37,7 @@ public class WorldBorder { +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index 2e9a7deaf7837558519528d30fcc3f729b11d7b2..a96c7b0883f3bdf8b731aeccaf1217583a32f5c8 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -687,6 +687,7 @@ public abstract class BlockBase { + return this.a != null ? this.a.d : Block.a(this.getCollisionShape(iblockaccess, blockposition)); + } + ++ public final IBlockData getBlockData() { return p(); } // Paper - OBFHELPER + protected abstract IBlockData p(); + + public boolean isRequiresSpecialTool() { +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +index 79f645ff1b6274bbdf5dc3f96a762b3b63397c82..2bb03f1cb9671a7754a68059219f783d4508eeb9 100644 +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -47,6 +47,7 @@ public class WorldBorder { return this.b(entity.locX(), entity.locZ()); } @@ -4501,45 +4138,411 @@ index 5719ef9714e9680596a08c42c33508c16c0e676a..bb0f30f182856d2701fde9b1a65eeb98 public VoxelShape c() { return this.j.m(); } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f1c206b6b506aff09c484730dd2d5ce796c3c2ab..592af06de1fc02d94273363c2ede1175a39997f0 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -12,6 +12,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap.Entry; - import it.unimi.dsi.fastutil.longs.LongSet; - import it.unimi.dsi.fastutil.longs.LongSets; - import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; -+import it.unimi.dsi.fastutil.objects.Object2IntMap; - import it.unimi.dsi.fastutil.objects.ObjectIterator; - import it.unimi.dsi.fastutil.objects.ObjectLinkedOpenHashSet; - import java.io.BufferedWriter; -@@ -60,7 +61,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - private final Map entitiesByUUID = Maps.newHashMap(); - private final Queue entitiesToAdd = Queues.newArrayDeque(); - private final List players = Lists.newArrayList(); -- private final ChunkProviderServer chunkProvider; -+ public final ChunkProviderServer chunkProvider; // Paper - public - boolean tickingEntities; - private final MinecraftServer server; - public final WorldDataServer worldDataServer; // CraftBukkit - type -@@ -1578,7 +1579,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - ObjectIterator objectiterator = spawnercreature_d.b().object2IntEntrySet().iterator(); +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 4561cf94fe1dce51abad0ac8635749ed87c8b307..b15200c2a3923bd8be2ee5e73fdadfeea3e3a8dc 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -60,7 +60,7 @@ public class Chunk implements IChunkAccess { - while (objectiterator.hasNext()) { -- it.unimi.dsi.fastutil.objects.Object2IntMap.Entry it_unimi_dsi_fastutil_objects_object2intmap_entry = (it.unimi.dsi.fastutil.objects.Object2IntMap.Entry) objectiterator.next(); -+ Object2IntMap.Entry it_unimi_dsi_fastutil_objects_object2intmap_entry = (Object2IntMap.Entry) objectiterator.next(); // Paper - decompile fix + private static final Logger LOGGER = LogManager.getLogger(); + @Nullable +- public static final ChunkSection a = null; ++ public static final ChunkSection a = null; public static final ChunkSection EMPTY_CHUNK_SECTION = a; // Paper - OBFHELPER + private final ChunkSection[] sections; + private BiomeStorage d; + private final Map e; +@@ -83,7 +83,7 @@ public class Chunk implements IChunkAccess { + private Supplier u; + @Nullable + private Consumer v; +- private final ChunkCoordIntPair loc; ++ private final ChunkCoordIntPair loc; public final long coordinateKey; public final int locX; public final int locZ; // Paper - cache coordinate key + private volatile boolean x; - bufferedwriter.write(String.format("spawn_count.%s: %d\n", ((EnumCreatureType) it_unimi_dsi_fastutil_objects_object2intmap_entry.getKey()).b(), it_unimi_dsi_fastutil_objects_object2intmap_entry.getIntValue())); - } + public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage) { +@@ -100,7 +100,8 @@ public class Chunk implements IChunkAccess { + this.n = new ShortList[16]; + this.entitySlices = (List[]) (new List[16]); // Spigot + this.world = (WorldServer) world; // CraftBukkit - type +- this.loc = chunkcoordintpair; ++ this.locX = chunkcoordintpair.x; this.locZ = chunkcoordintpair.z; // Paper - reduce need for field look ups ++ this.loc = chunkcoordintpair; this.coordinateKey = ChunkCoordIntPair.pair(locX, locZ); // Paper - cache long key + this.i = chunkconverter; + HeightMap.Type[] aheightmap_type = HeightMap.Type.values(); + int j = aheightmap_type.length; +@@ -146,6 +147,110 @@ public class Chunk implements IChunkAccess { + public final org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer persistentDataContainer = new org.bukkit.craftbukkit.persistence.CraftPersistentDataContainer(DATA_TYPE_REGISTRY); + // CraftBukkit end + ++ // Paper start ++ public final com.destroystokyo.paper.util.maplist.EntityList entities = new com.destroystokyo.paper.util.maplist.EntityList(); ++ public PlayerChunk playerChunk; ++ ++ static final int NEIGHBOUR_CACHE_RADIUS = 3; ++ public static int getNeighbourCacheRadius() { ++ return NEIGHBOUR_CACHE_RADIUS; ++ } ++ ++ boolean loadedTicketLevel; ++ private long neighbourChunksLoadedBitset; ++ private final Chunk[] loadedNeighbourChunks = new Chunk[(NEIGHBOUR_CACHE_RADIUS * 2 + 1) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)]; ++ ++ private static int getNeighbourIndex(final int relativeX, final int relativeZ) { ++ // index = (relativeX + NEIGHBOUR_CACHE_RADIUS) + (relativeZ + NEIGHBOUR_CACHE_RADIUS) * (NEIGHBOUR_CACHE_RADIUS * 2 + 1) ++ // optimised variant of the above by moving some of the ops to compile time ++ return relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))); ++ } ++ ++ public final Chunk getRelativeNeighbourIfLoaded(final int relativeX, final int relativeZ) { ++ return this.loadedNeighbourChunks[getNeighbourIndex(relativeX, relativeZ)]; ++ } ++ ++ public final boolean isNeighbourLoaded(final int relativeX, final int relativeZ) { ++ return (this.neighbourChunksLoadedBitset & (1L << getNeighbourIndex(relativeX, relativeZ))) != 0; ++ } ++ ++ public final void setNeighbourLoaded(final int relativeX, final int relativeZ, final Chunk chunk) { ++ if (chunk == null) { ++ throw new IllegalArgumentException("Chunk must be non-null, neighbour: (" + relativeX + "," + relativeZ + "), chunk: " + this.loc); ++ } ++ final long before = this.neighbourChunksLoadedBitset; ++ final int index = getNeighbourIndex(relativeX, relativeZ); ++ this.loadedNeighbourChunks[index] = chunk; ++ this.neighbourChunksLoadedBitset |= (1L << index); ++ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); ++ } ++ ++ public final void setNeighbourUnloaded(final int relativeX, final int relativeZ) { ++ final long before = this.neighbourChunksLoadedBitset; ++ final int index = getNeighbourIndex(relativeX, relativeZ); ++ this.loadedNeighbourChunks[index] = null; ++ this.neighbourChunksLoadedBitset &= ~(1L << index); ++ this.onNeighbourChange(before, this.neighbourChunksLoadedBitset); ++ } ++ ++ public final void resetNeighbours() { ++ final long before = this.neighbourChunksLoadedBitset; ++ this.neighbourChunksLoadedBitset = 0L; ++ java.util.Arrays.fill(this.loadedNeighbourChunks, null); ++ this.onNeighbourChange(before, 0L); ++ } ++ ++ protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { ++ ++ } ++ ++ public final boolean isAnyNeighborsLoaded() { ++ return neighbourChunksLoadedBitset != 0; ++ } ++ public final boolean areNeighboursLoaded(final int radius) { ++ return Chunk.areNeighboursLoaded(this.neighbourChunksLoadedBitset, radius); ++ } ++ ++ public static boolean areNeighboursLoaded(final long bitset, final int radius) { ++ // index = relativeX + (relativeZ * (NEIGHBOUR_CACHE_RADIUS * 2 + 1)) + (NEIGHBOUR_CACHE_RADIUS + NEIGHBOUR_CACHE_RADIUS * ((NEIGHBOUR_CACHE_RADIUS * 2 + 1))) ++ switch (radius) { ++ case 0: { ++ return (bitset & (1L << getNeighbourIndex(0, 0))) != 0; ++ } ++ case 1: { ++ long mask = 0L; ++ for (int dx = -1; dx <= 1; ++dx) { ++ for (int dz = -1; dz <= 1; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (bitset & mask) == mask; ++ } ++ case 2: { ++ long mask = 0L; ++ for (int dx = -2; dx <= 2; ++dx) { ++ for (int dz = -2; dz <= 2; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (bitset & mask) == mask; ++ } ++ case 3: { ++ long mask = 0L; ++ for (int dx = -3; dx <= 3; ++dx) { ++ for (int dz = -3; dz <= 3; ++dz) { ++ mask |= (1L << getNeighbourIndex(dx, dz)); ++ } ++ } ++ return (bitset & mask) == mask; ++ } ++ ++ default: ++ throw new IllegalArgumentException("Radius not recognized: " + radius); ++ } ++ } ++ // Paper end ++ + public Chunk(World world, ProtoChunk protochunk) { + this(world, protochunk.getPos(), protochunk.getBiomeIndex(), protochunk.p(), protochunk.n(), protochunk.o(), protochunk.getInhabitedTime(), protochunk.getSections(), (Consumer) null); + Iterator iterator = protochunk.y().iterator(); +@@ -251,6 +356,18 @@ public class Chunk implements IChunkAccess { + } + } + ++ // Paper start - If loaded util ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ return this.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ return this.getType(blockposition); ++ } ++ // Paper end ++ + @Override + public Fluid getFluid(BlockPosition blockposition) { + return this.a(blockposition.getX(), blockposition.getY(), blockposition.getZ()); +@@ -391,6 +508,7 @@ public class Chunk implements IChunkAccess { + entity.chunkX = this.loc.x; + entity.chunkY = k; + entity.chunkZ = this.loc.z; ++ this.entities.add(entity); // Paper - per chunk entity list + this.entitySlices[k].add(entity); + } + +@@ -414,6 +532,7 @@ public class Chunk implements IChunkAccess { + } + + this.entitySlices[i].remove(entity); ++ this.entities.remove(entity); // Paper + } + + @Override +@@ -435,6 +554,7 @@ public class Chunk implements IChunkAccess { + return this.a(blockposition, Chunk.EnumTileEntityState.CHECK); + } + ++ @Nullable public final TileEntity getTileEntityImmediately(BlockPosition pos) { return this.a(pos, EnumTileEntityState.IMMEDIATE); } // Paper - OBFHELPER + @Nullable + public TileEntity a(BlockPosition blockposition, Chunk.EnumTileEntityState chunk_enumtileentitystate) { + // CraftBukkit start +@@ -546,7 +666,25 @@ public class Chunk implements IChunkAccess { + + // CraftBukkit start + public void loadCallback() { ++ // Paper start - neighbour cache ++ int chunkX = this.loc.x; ++ int chunkZ = this.loc.z; ++ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); ++ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { ++ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { ++ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); ++ if (neighbour != null) { ++ neighbour.setNeighbourLoaded(-dx, -dz, this); ++ // should be in cached already ++ this.setNeighbourLoaded(dx, dz, neighbour); ++ } ++ } ++ } ++ this.setNeighbourLoaded(0, 0, this); ++ this.loadedTicketLevel = true; ++ // Paper end - neighbour cache + org.bukkit.Server server = this.world.getServer(); ++ ((WorldServer)this.world).getChunkProvider().addLoadedChunk(this); // Paper + if (server != null) { + /* + * If it's a new world, the first few chunks are generated inside +@@ -585,6 +723,22 @@ public class Chunk implements IChunkAccess { + server.getPluginManager().callEvent(unloadEvent); + // note: saving can be prevented, but not forced if no saving is actually required + this.mustNotSave = !unloadEvent.isSaveChunk(); ++ ((WorldServer)this.world).getChunkProvider().removeLoadedChunk(this); // Paper ++ // Paper start - neighbour cache ++ int chunkX = this.loc.x; ++ int chunkZ = this.loc.z; ++ ChunkProviderServer chunkProvider = ((WorldServer)this.world).getChunkProvider(); ++ for (int dx = -NEIGHBOUR_CACHE_RADIUS; dx <= NEIGHBOUR_CACHE_RADIUS; ++dx) { ++ for (int dz = -NEIGHBOUR_CACHE_RADIUS; dz <= NEIGHBOUR_CACHE_RADIUS; ++dz) { ++ Chunk neighbour = chunkProvider.getChunkAtIfLoadedMainThreadNoCache(chunkX + dx, chunkZ + dz); ++ if (neighbour != null) { ++ neighbour.setNeighbourUnloaded(-dx, -dz); ++ } ++ } ++ } ++ this.loadedTicketLevel = false; ++ this.resetNeighbours(); ++ // Paper end + } + // CraftBukkit end + +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index cf2dd6da5ce88aafdcc4db63af18eda9396a066a..a4e2eb1a753e8fcb48982d78fe80e505bce5c476 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -139,6 +139,7 @@ public class ChunkSection { + return this.blockIds; + } + ++ public void writeChunkSection(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER + public void b(PacketDataSerializer packetdataserializer) { + packetdataserializer.writeShort(this.nonEmptyBlockCount); + this.blockIds.b(packetdataserializer); +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPalette.java b/src/main/java/net/minecraft/world/level/chunk/DataPalette.java +index f1dd62541187d007a69087f0279508b6b18d5166..44fe0ee179eebfa6c4c0403a7f06735d7da5c773 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPalette.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPalette.java +@@ -7,10 +7,12 @@ import net.minecraft.network.PacketDataSerializer; + + public interface DataPalette { + ++ default int getOrCreateIdFor(T object) { return this.a(object); } // Paper - OBFHELPER + int a(T t0); + + boolean a(Predicate predicate); + ++ @Nullable default T getObject(int dataBits) { return this.a(dataBits); } // Paper - OBFHELPER + @Nullable + T a(int i); + +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index fe441146757a4ac0562d5b493fb6430e33b9ee28..e397b871b846c3a90bc75d0e1cf0683b6a3d0ca9 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +@@ -19,7 +19,7 @@ import net.minecraft.util.MathHelper; + + public class DataPaletteBlock implements DataPaletteExpandable { + +- private final DataPalette b; ++ private final DataPalette b; private final DataPalette getDataPaletteGlobal() { return this.b; } // Paper - OBFHELPER + private final DataPaletteExpandable c = (i, object) -> { + return 0; + }; +@@ -27,9 +27,9 @@ public class DataPaletteBlock implements DataPaletteExpandable { + private final Function e; + private final Function f; + private final T g; +- protected DataBits a; +- private DataPalette h; +- private int i; ++ protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER ++ private DataPalette h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER ++ private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER + private final ReentrantLock j = new ReentrantLock(); + + public void a() { +@@ -64,6 +64,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { + return j << 8 | k << 4 | i; + } + ++ private void initialize(int bitsPerObject) { this.b(bitsPerObject); } // Paper - OBFHELPER + private void b(int i) { + if (i != this.i) { + this.i = i; +@@ -141,6 +142,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { + return t0 == null ? this.g : t0; + } + ++ public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER + public void b(PacketDataSerializer packetdataserializer) { + this.a(); + packetdataserializer.writeByte(this.i); +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +index 4192d30ad2117a12a4058b48581d6cf93b50088c..7572ca53a5cca8ca5085d18c24048b85dda4daa9 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +@@ -99,6 +99,18 @@ public class ProtoChunk implements IChunkAccess { + + } + ++ // Paper start - If loaded util ++ @Override ++ public Fluid getFluidIfLoaded(BlockPosition blockposition) { ++ return this.getFluid(blockposition); ++ } ++ ++ @Override ++ public IBlockData getTypeIfLoaded(BlockPosition blockposition) { ++ return this.getType(blockposition); ++ } ++ // Paper end ++ + @Override + public IBlockData getType(BlockPosition blockposition) { + int i = blockposition.getY(); +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java +index 859561a5dccba6548967b685b20e8fcfc296db2a..9ebf2806122a308f7655cdbee1f642cd80c9932c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IOWorker.java +@@ -27,7 +27,7 @@ public class IOWorker implements AutoCloseable { + private static final Logger LOGGER = LogManager.getLogger(); + private final AtomicBoolean b = new AtomicBoolean(); + private final ThreadedMailbox c; +- private final RegionFileCache d; ++ private final RegionFileCache d;public RegionFileCache getRegionFileCache() { return d; } // Paper - OBFHELPER + private final Map e = Maps.newLinkedHashMap(); + + protected IOWorker(File file, boolean flag, String s) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index d5b11b08cadbe53fee06025f5658c9a165bd2bd7..f2694e46123ac2edcfdc53ef1abae283227eaa51 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -111,6 +111,7 @@ public class RegionFile implements AutoCloseable { + return this.e.resolve(s); + } + ++ @Nullable public synchronized DataInputStream getReadStream(ChunkCoordIntPair chunkCoordIntPair) throws IOException { return a(chunkCoordIntPair);} // Paper - OBFHELPER + @Nullable + public synchronized DataInputStream a(ChunkCoordIntPair chunkcoordintpair) throws IOException { + int i = this.getOffset(chunkcoordintpair); +diff --git a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +index 633a484cebc99f4a2f071b7f84b0b63d0ec3f985..3941dd33da4b5c09d0087143f1d8a2d76fc18792 100644 +--- a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java ++++ b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +@@ -194,10 +194,12 @@ public class AxisAlignedBB { + return this.d(vec3d.x, vec3d.y, vec3d.z); + } + ++ public final boolean intersects(AxisAlignedBB axisalignedbb) { return this.c(axisalignedbb); } // Paper - OBFHELPER + public boolean c(AxisAlignedBB axisalignedbb) { + return this.a(axisalignedbb.minX, axisalignedbb.minY, axisalignedbb.minZ, axisalignedbb.maxX, axisalignedbb.maxY, axisalignedbb.maxZ); + } + ++ public final boolean intersects(double d0, double d1, double d2, double d3, double d4, double d5) { return a(d0, d1, d2, d3, d4, d5); } // Paper - OBFHELPER + public boolean a(double d0, double d1, double d2, double d3, double d4, double d5) { + return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; + } +@@ -210,6 +212,7 @@ public class AxisAlignedBB { + return d0 >= this.minX && d0 < this.maxX && d1 >= this.minY && d1 < this.maxY && d2 >= this.minZ && d2 < this.maxZ; + } + ++ public final double getAverageSideLength(){return a();} // Paper - OBFHELPER + public double a() { + double d0 = this.b(); + double d1 = this.c(); +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index 44d37272a337fee9606ebaa1b6f647c0fd392320..fdd9e37a8c90fc3311e515355af0a0593efbdacc 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -31,10 +31,12 @@ public final class VoxelShapes { + public static final VoxelShape a = create(Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY, Double.POSITIVE_INFINITY); + private static final VoxelShape c = new VoxelShapeArray(new VoxelShapeBitSet(0, 0, 0), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D}), new DoubleArrayList(new double[]{0.0D})); + ++ public static final VoxelShape empty() {return a();} // Paper - OBFHELPER + public static VoxelShape a() { + return VoxelShapes.c; + } + ++ public static final VoxelShape fullCube() {return b();} // Paper - OBFHELPER + public static VoxelShape b() { + return VoxelShapes.b; + } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 62cdb32a63cdcbaee80946f73d23817bbb455488..721a1c6bd4505cb132e7004c45b795d4959389e3 100644 +index 52fa8a38545be43a31363d1d57e42471bbb0c499..275b943a59ef28c831a068987e111e84ebba3bb7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -85,6 +85,7 @@ public final class CraftItemStack extends ItemStack { } - net.minecraft.server.ItemStack handle; -+ public net.minecraft.server.ItemStack getHandle() { return handle; } // Paper + net.minecraft.world.item.ItemStack handle; ++ public net.minecraft.world.item.ItemStack getHandle() { return handle; } // Paper /** * Mirror @@ -4758,7 +4761,7 @@ index 0000000000000000000000000000000000000000..49dc0c441b9dd7e7745cf15ced67f383 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java -index 2eeb3e23e465054f6415def6881081788239417f..0cee7f04bd27b1cb8784c23c972e31a401dbcbce 100644 +index f4ea5809f48fda39e32738529b4ae8f74acadb90..b2b14eada44231a619622a2baef27abdb798aa47 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java +++ b/src/main/java/org/bukkit/craftbukkit/util/DummyGeneratorAccess.java @@ -168,7 +168,23 @@ public class DummyGeneratorAccess implements GeneratorAccess { @@ -4799,7 +4802,7 @@ index 1aec70a1f1a9d8fd2cd06bde4033e19e769ab331..f72c13bedaa6fa45e26f5dcad564835b private int initialCapacity; diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a83e1cdbcbb6b01bee6a3f31dcac0b601a1ffc47..f08110a22646716bcdf6a8d25ec44df8d78e85a4 100644 +index 724c6a47846f4266c858b783f68f162e0508d2fa..c04d912adf0da8f7a5b75dd2f58739a11ca31601 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -118,7 +118,11 @@ public class SpigotConfig diff --git a/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch index d4f51ab496..a390f7960d 100644 --- a/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch +++ b/Spigot-Server-Patches/0006-Add-MinecraftKey-Information-to-Objects.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add MinecraftKey Information to Objects Stores the reference to the objects respective MinecraftKey diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index ed7e4220199f9c57d0ffe67f552027c0bade3af1..411aebed946991b899205fcc1fcf7f3bf83718c0 100644 +index 68cd4134cb6a00c1768100462f8e9e94f3fa6279..6943524c2dd8b12691b8ac5b08daee823ce50c3d 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -208,7 +208,7 @@ public class PaperCommand extends Command { @@ -18,20 +18,37 @@ index ed7e4220199f9c57d0ffe67f552027c0bade3af1..411aebed946991b899205fcc1fcf7f3b MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f2fb9e661b6c2d87348c9144d32e568cc6ada5dc..b8267cf23f795fd7e586b0e567037eae5048d08e 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -51,7 +51,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; +diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java +new file mode 100644 +index 0000000000000000000000000000000000000000..500477f0d98a277145c2b0dbb4d1496e2a588542 +--- /dev/null ++++ b/src/main/java/net/minecraft/server/KeyedObject.java +@@ -0,0 +1,11 @@ ++package net.minecraft.server; ++ ++import net.minecraft.resources.MinecraftKey; ++ ++public interface KeyedObject { ++ MinecraftKey getMinecraftKey(); ++ default String getMinecraftKeyString() { ++ MinecraftKey key = getMinecraftKey(); ++ return key != null ? key.toString() : null; ++ } ++} +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 3c8767d5fab575e61ca179b517f0bff1a38405ce..ec553e7d7595ef3652bfa3325a07483bb3c32245 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -136,7 +136,7 @@ import org.bukkit.event.player.PlayerTeleportEvent; import org.bukkit.plugin.PluginManager; // CraftBukkit end -public abstract class Entity implements INamableTileEntity, ICommandListener { -+public abstract class Entity implements INamableTileEntity, ICommandListener, KeyedObject { // Paper ++public abstract class Entity implements INamableTileEntity, ICommandListener, net.minecraft.server.KeyedObject { // Paper // CraftBukkit start private static final int CURRENT_LEVEL = 2; -@@ -1677,12 +1677,31 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { +@@ -1762,12 +1762,31 @@ public abstract class Entity implements INamableTileEntity, ICommandListener { return true; } @@ -64,11 +81,11 @@ index f2fb9e661b6c2d87348c9144d32e568cc6ada5dc..b8267cf23f795fd7e586b0e567037eae } protected abstract void loadData(NBTTagCompound nbttagcompound); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index ef2a276fa2bdcac789e2f195a9d06ecce38daa45..9946985407561596c6c364526d2fe7477771303a 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -254,6 +254,7 @@ public class EntityTypes { +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index ac57ab9992e141c91cf48f033148ad78433b364c..dc92b112770955f9fa49a408262da2e5bbc4bf98 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -384,6 +384,7 @@ public class EntityTypes { } } @@ -76,35 +93,20 @@ index ef2a276fa2bdcac789e2f195a9d06ecce38daa45..9946985407561596c6c364526d2fe747 public boolean a() { return this.bi; } -diff --git a/src/main/java/net/minecraft/server/KeyedObject.java b/src/main/java/net/minecraft/server/KeyedObject.java -new file mode 100644 -index 0000000000000000000000000000000000000000..743142d0303fa25fe48a2abb07040d1228d04402 ---- /dev/null -+++ b/src/main/java/net/minecraft/server/KeyedObject.java -@@ -0,0 +1,9 @@ -+package net.minecraft.server; -+ -+public interface KeyedObject { -+ MinecraftKey getMinecraftKey(); -+ default String getMinecraftKeyString() { -+ MinecraftKey key = getMinecraftKey(); -+ return key != null ? key.toString() : null; -+ } -+} -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 134c7a9567c97ecf206b272a0e0a28a8a7534009..c80f964aef02ac6edd0dcf9f4af9f849e8ac3da9 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -13,7 +13,7 @@ import org.bukkit.inventory.InventoryHolder; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 72d43b38de3e797a509de6591874af12fa7b9ec0..2b58ae6d91fe0d0f36eedbb78a3c8a8a66d92405 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -23,7 +23,7 @@ import org.bukkit.inventory.InventoryHolder; import org.spigotmc.CustomTimingsHandler; // Spigot -public abstract class TileEntity { -+public abstract class TileEntity implements KeyedObject { // Paper ++public abstract class TileEntity implements net.minecraft.server.KeyedObject { // Paper public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot // CraftBukkit start - data containers -@@ -21,7 +21,7 @@ public abstract class TileEntity { +@@ -31,7 +31,7 @@ public abstract class TileEntity { public CraftPersistentDataContainer persistentDataContainer; // CraftBukkit end private static final Logger LOGGER = LogManager.getLogger(); @@ -113,7 +115,7 @@ index 134c7a9567c97ecf206b272a0e0a28a8a7534009..c80f964aef02ac6edd0dcf9f4af9f849 @Nullable protected World world; protected BlockPosition position; -@@ -35,6 +35,26 @@ public abstract class TileEntity { +@@ -45,6 +45,26 @@ public abstract class TileEntity { this.tileType = tileentitytypes; } diff --git a/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch b/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch index d2aebd3270..df2fae99a0 100644 --- a/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch +++ b/Spigot-Server-Patches/0007-Store-reference-to-current-Chunk-for-Entity-and-Bloc.patch @@ -7,11 +7,68 @@ Subject: [PATCH] Store reference to current Chunk for Entity and Block This enables us a fast reference to the entities current chunk instead of having to look it up by hashmap lookups. -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index c8ff99ef5c7574292ee66a4aec45d1550eab1624..7c5f79124d2f2c69548263e79752484e07e77d48 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -56,11 +56,36 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index ec553e7d7595ef3652bfa3325a07483bb3c32245..9af9d9463e9b50f8a627ffd79dcd3716c506f7e7 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -261,7 +261,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + public boolean isChunkLoaded() { +- return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); ++ return getCurrentChunk() != null; + } + // CraftBukkit end + +@@ -1763,6 +1763,23 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + // Paper start ++ java.lang.ref.WeakReference currentChunk = null; ++ ++ public void setCurrentChunk(net.minecraft.world.level.chunk.Chunk chunk) { ++ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; ++ } ++ /** ++ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null ++ */ ++ public net.minecraft.world.level.chunk.Chunk getCurrentChunk() { ++ final net.minecraft.world.level.chunk.Chunk chunk = currentChunk != null ? currentChunk.get() : null; ++ if (chunk != null && chunk.loaded) { ++ return chunk; ++ } ++ ++ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(chunkX, chunkZ); ++ } ++ + private MinecraftKey entityKey; + private String entityKeyString; + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 2b58ae6d91fe0d0f36eedbb78a3c8a8a66d92405..8300bb425f7fc3fa8a5a8832a0bb432a2947793b 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -63,6 +63,15 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / + getMinecraftKey(); // Try to load if it doesn't exists. + return tileEntityKeyString; + } ++ ++ private java.lang.ref.WeakReference currentChunk = null; ++ public Chunk getCurrentChunk() { ++ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; ++ return chunk != null && chunk.loaded ? chunk : null; ++ } ++ public void setCurrentChunk(Chunk chunk) { ++ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; ++ } + // Paper end + + @Nullable +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index b15200c2a3923bd8be2ee5e73fdadfeea3e3a8dc..929f6fcd4b9f1b9a1488e170d6a77a5d64beecf3 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -90,11 +90,36 @@ public class Chunk implements IChunkAccess { this(world, chunkcoordintpair, biomestorage, ChunkConverter.a, TickListEmpty.b(), TickListEmpty.b(), 0L, (ChunkSection[]) null, (Consumer) null); } @@ -49,7 +106,7 @@ index c8ff99ef5c7574292ee66a4aec45d1550eab1624..7c5f79124d2f2c69548263e79752484e this.l = Maps.newHashMap(); this.m = Maps.newHashMap(); this.n = new ShortList[16]; -@@ -471,6 +496,7 @@ public class Chunk implements IChunkAccess { +@@ -505,6 +530,7 @@ public class Chunk implements IChunkAccess { } entity.inChunk = true; @@ -57,7 +114,7 @@ index c8ff99ef5c7574292ee66a4aec45d1550eab1624..7c5f79124d2f2c69548263e79752484e entity.chunkX = this.loc.x; entity.chunkY = k; entity.chunkZ = this.loc.z; -@@ -483,6 +509,7 @@ public class Chunk implements IChunkAccess { +@@ -517,6 +543,7 @@ public class Chunk implements IChunkAccess { ((HeightMap) this.heightMap.get(heightmap_type)).a(along); } @@ -65,7 +122,7 @@ index c8ff99ef5c7574292ee66a4aec45d1550eab1624..7c5f79124d2f2c69548263e79752484e public void b(Entity entity) { this.a(entity, entity.chunkY); } -@@ -497,7 +524,12 @@ public class Chunk implements IChunkAccess { +@@ -531,7 +558,12 @@ public class Chunk implements IChunkAccess { i = this.entitySlices.length - 1; } @@ -79,71 +136,14 @@ index c8ff99ef5c7574292ee66a4aec45d1550eab1624..7c5f79124d2f2c69548263e79752484e this.entities.remove(entity); // Paper } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b8267cf23f795fd7e586b0e567037eae5048d08e..b35ffae9f88cc14aec01482c2a3ed2e2428c2012 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -176,7 +176,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - public boolean isChunkLoaded() { -- return world.isChunkLoaded((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); -+ return getCurrentChunk() != null; - } - // CraftBukkit end - -@@ -1678,6 +1678,23 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - // Paper start -+ java.lang.ref.WeakReference currentChunk = null; -+ -+ public void setCurrentChunk(Chunk chunk) { -+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; -+ } -+ /** -+ * Returns the entities current registered chunk. If the entity is not added to a chunk yet, it will return null -+ */ -+ public Chunk getCurrentChunk() { -+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; -+ if (chunk != null && chunk.loaded) { -+ return chunk; -+ } -+ -+ return !inChunk ? null : ((WorldServer)world).getChunkProvider().getChunkAtIfLoadedMainThreadNoCache(chunkX, chunkZ); -+ } -+ - private MinecraftKey entityKey; - private String entityKeyString; - -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index c80f964aef02ac6edd0dcf9f4af9f849e8ac3da9..43757f60d091414befe7daa192b17e2fe1ddbef9 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -53,6 +53,15 @@ public abstract class TileEntity implements KeyedObject { // Paper - getMinecraftKey(); // Try to load if it doesn't exists. - return tileEntityKeyString; - } -+ -+ private java.lang.ref.WeakReference currentChunk = null; -+ public Chunk getCurrentChunk() { -+ final Chunk chunk = currentChunk != null ? currentChunk.get() : null; -+ return chunk != null && chunk.loaded ? chunk : null; -+ } -+ public void setCurrentChunk(Chunk chunk) { -+ this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; -+ } - // Paper end - - @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 48747fada4f982ada8c8598fb8ba756d901b40f1..a2048d2dd71381ee5e878c87e0d727ab62756b20 100644 +index df7e5f1d17ddfeffc15df02906c3bf9f9461d82b..eea242af23825ad29ada6e997205e87edffb6bb9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -145,6 +145,7 @@ import net.minecraft.server.EntityZombieVillager; - import net.minecraft.server.IChatBaseComponent; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; +@@ -145,6 +145,7 @@ import net.minecraft.world.entity.vehicle.EntityMinecartMobSpawner; + import net.minecraft.world.entity.vehicle.EntityMinecartRideable; + import net.minecraft.world.entity.vehicle.EntityMinecartTNT; + import net.minecraft.world.phys.AxisAlignedBB; +import org.bukkit.Chunk; // Paper import org.bukkit.EntityEffect; import org.bukkit.Location; @@ -154,7 +154,7 @@ index 48747fada4f982ada8c8598fb8ba756d901b40f1..a2048d2dd71381ee5e878c87e0d727ab + @Override + public Chunk getChunk() { -+ net.minecraft.server.Chunk currentChunk = entity.getCurrentChunk(); ++ net.minecraft.world.level.chunk.Chunk currentChunk = entity.getCurrentChunk(); + return currentChunk != null ? currentChunk.bukkitChunk : getLocation().getChunk(); + } + diff --git a/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch b/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch index a4a2a5f478..73d224306f 100644 --- a/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch +++ b/Spigot-Server-Patches/0008-Store-counts-for-each-Entity-Block-Entity-Type.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Store counts for each Entity/Block Entity Type Opens door for future patches to optimize performance -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 7c5f79124d2f2c69548263e79752484e07e77d48..853e11836b6c4eadd03feead101bf578b17b86a3 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -57,15 +57,19 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 929f6fcd4b9f1b9a1488e170d6a77a5d64beecf3..acdcece38a4b30d6c89eb4342918ae8997db9f0b 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -91,15 +91,19 @@ public class Chunk implements IChunkAccess { } // Paper start @@ -29,7 +29,7 @@ index 7c5f79124d2f2c69548263e79752484e07e77d48..853e11836b6c4eadd03feead101bf578 } return replaced; } -@@ -75,6 +79,7 @@ public class Chunk implements IChunkAccess { +@@ -109,6 +113,7 @@ public class Chunk implements IChunkAccess { TileEntity removed = super.remove(key); if (removed != null) { removed.setCurrentChunk(null); @@ -37,7 +37,7 @@ index 7c5f79124d2f2c69548263e79752484e07e77d48..853e11836b6c4eadd03feead101bf578 } return removed; } -@@ -495,6 +500,7 @@ public class Chunk implements IChunkAccess { +@@ -529,6 +534,7 @@ public class Chunk implements IChunkAccess { k = this.entitySlices.length - 1; } @@ -45,7 +45,7 @@ index 7c5f79124d2f2c69548263e79752484e07e77d48..853e11836b6c4eadd03feead101bf578 entity.inChunk = true; entity.setCurrentChunk(this); // Paper entity.chunkX = this.loc.x; -@@ -529,6 +535,7 @@ public class Chunk implements IChunkAccess { +@@ -563,6 +569,7 @@ public class Chunk implements IChunkAccess { if (!this.entitySlices[i].remove(entity)) { return; } diff --git a/Spigot-Server-Patches/0009-Timings-v2.patch b/Spigot-Server-Patches/0009-Timings-v2.patch index 9a827ea75d..42bf7d230a 100644 --- a/Spigot-Server-Patches/0009-Timings-v2.patch +++ b/Spigot-Server-Patches/0009-Timings-v2.patch @@ -6,14 +6,17 @@ Subject: [PATCH] Timings v2 diff --git a/src/main/java/co/aikar/timings/MinecraftTimings.java b/src/main/java/co/aikar/timings/MinecraftTimings.java new file mode 100644 -index 0000000000000000000000000000000000000000..11fe3524f38f7756ebd0e3807678e8848fd2217d +index 0000000000000000000000000000000000000000..fed920e5ec65409377f181d74dcf9274d45aadc1 --- /dev/null +++ b/src/main/java/co/aikar/timings/MinecraftTimings.java -@@ -0,0 +1,148 @@ +@@ -0,0 +1,151 @@ +package co.aikar.timings; + +import com.google.common.collect.MapMaker; -+import net.minecraft.server.*; ++import net.minecraft.commands.CustomFunction; ++import net.minecraft.network.protocol.Packet; ++import net.minecraft.world.level.block.Block; ++import net.minecraft.world.level.block.entity.TileEntity; +import org.bukkit.plugin.Plugin; +import org.bukkit.scheduler.BukkitTask; + @@ -115,7 +118,7 @@ index 0000000000000000000000000000000000000000..11fe3524f38f7756ebd0e3807678e884 + + /** + * Get a named timer for the specified entity type to track type specific timings. -+ * @param entity ++ * @param entityType + * @return + */ + public static Timing getEntityTimings(String entityType, String type) { @@ -717,179 +720,11 @@ index da922f395f0fff0881ead893c900c5b2623f48f0..1d03a79e9010bc514b72a81ba0ad4a62 + " - Server Name: " + timingsServerName); + } } -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 55b9fe1a79e0feb80dc2932f1267b972900b92b1..428a10fb100d1b4775dab6cfe69f28c29a45cd70 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -22,6 +22,15 @@ public class Block extends BlockBase implements IMaterial { - }); - protected final BlockStateList blockStateList; - private IBlockData blockData; -+ // Paper start -+ public co.aikar.timings.Timing timing; -+ public co.aikar.timings.Timing getTiming() { -+ if (timing == null) { -+ timing = co.aikar.timings.MinecraftTimings.getBlockTiming(this); -+ } -+ return timing; -+ } -+ // Paper end - @Nullable - private String name; - @Nullable -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 853e11836b6c4eadd03feead101bf578b17b86a3..0aea16df16b55b1d4756b51d10c8c22d37aef9a3 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -699,6 +699,7 @@ public class Chunk implements IChunkAccess { - server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); - - if (this.needsDecoration) { -+ try (co.aikar.timings.Timing ignored = this.world.timings.chunkLoadPopulate.startTiming()) { // Paper - this.needsDecoration = false; - java.util.Random random = new java.util.Random(); - random.setSeed(world.getSeed()); -@@ -718,6 +719,7 @@ public class Chunk implements IChunkAccess { - } - } - server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); -+ } // Paper - } - } - } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 08f11f98c40221fa4ce9a4f14ee8398f8588f38a..a066026bce318683dcc022920dad39d7ec25e485 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -322,11 +322,13 @@ public class ChunkProviderServer extends IChunkProvider { - } - - gameprofilerfiller.c("getChunkCacheMiss"); -- world.timings.syncChunkLoadTimer.startTiming(); // Spigot - CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); - -+ if (!completablefuture.isDone()) { // Paper -+ this.world.timings.syncChunkLoad.startTiming(); // Paper - this.serverThreadQueue.awaitTasks(completablefuture::isDone); -- world.timings.syncChunkLoadTimer.stopTiming(); // Spigot -+ this.world.timings.syncChunkLoad.stopTiming(); // Paper -+ } // Paper - ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { - return ichunkaccess1; - }, (playerchunk_failure) -> { -@@ -513,7 +515,9 @@ public class ChunkProviderServer extends IChunkProvider { - - public void save(boolean flag) { - this.tickDistanceManager(); -+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings - this.playerChunkMap.save(flag); -+ } // Paper - Timings - } - - @Override -@@ -550,7 +554,9 @@ public class ChunkProviderServer extends IChunkProvider { - this.tickDistanceManager(); - this.world.timings.doChunkMap.stopTiming(); // Spigot - this.world.getMethodProfiler().exitEnter("chunks"); -+ this.world.timings.chunks.startTiming(); // Paper - timings - this.tickChunks(); -+ this.world.timings.chunks.stopTiming(); // Paper - timings - this.world.timings.doChunkUnload.startTiming(); // Spigot - this.world.getMethodProfiler().exitEnter("unload"); - this.playerChunkMap.unloadChunks(booleansupplier); -@@ -574,8 +580,10 @@ public class ChunkProviderServer extends IChunkProvider { - boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit - - this.world.getMethodProfiler().enter("naturalSpawnCount"); -+ this.world.timings.countNaturalMobs.startTiming(); // Paper - timings - int l = this.chunkMapDistance.b(); - SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.A(), this::a); -+ this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings - - this.p = spawnercreature_d; - this.world.getMethodProfiler().exit(); -@@ -586,7 +594,9 @@ public class ChunkProviderServer extends IChunkProvider { - - if (optional.isPresent()) { - this.world.getMethodProfiler().enter("broadcast"); -+ this.world.timings.broadcastChunkUpdates.startTiming(); // Paper - timings - playerchunk.a((Chunk) optional.get()); -+ this.world.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings - this.world.getMethodProfiler().exit(); - Optional optional1 = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - -@@ -600,25 +610,25 @@ public class ChunkProviderServer extends IChunkProvider { - SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); - } - -- this.world.timings.doTickTiles.startTiming(); // Spigot -+ this.world.timings.chunkTicks.startTiming(); // Spigot // Paper - this.world.a(chunk, k); -- this.world.timings.doTickTiles.stopTiming(); // Spigot -+ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper - } - } - } - }); - this.world.getMethodProfiler().enter("customSpawners"); - if (flag1) { -+ try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings - this.world.doMobSpawning(this.allowMonsters, this.allowAnimals); -+ } // Paper - timings - } - - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().exit(); - } - -- this.world.timings.tracker.startTiming(); // Spigot - this.playerChunkMap.g(); -- this.world.timings.tracker.stopTiming(); // Spigot - } - - private void a(long i, Consumer consumer) { -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index bd47979e11d900b5b31c995751dfefbf0a2706b9..d30c4d5a4ee83e21ba9269c0b92af2b72b85d3cc 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import co.aikar.timings.Timings; - import com.google.common.collect.Maps; - import it.unimi.dsi.fastutil.longs.LongOpenHashSet; - import it.unimi.dsi.fastutil.longs.LongSet; -@@ -404,7 +405,6 @@ public class ChunkRegionLoader { - private static void loadEntities(NBTTagCompound nbttagcompound, Chunk chunk) { - NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); - World world = chunk.getWorld(); -- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot - - for (int i = 0; i < nbttaglist.size(); ++i) { - NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); -@@ -416,8 +416,6 @@ public class ChunkRegionLoader { - chunk.d(true); - } - -- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot -- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot - NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities", 10); - - for (int j = 0; j < nbttaglist1.size(); ++j) { -@@ -435,8 +433,6 @@ public class ChunkRegionLoader { - } - } - } -- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot -- - } - - private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map, StructureStart> map, Map, LongSet> map1) { -diff --git a/src/main/java/net/minecraft/server/CustomFunction.java b/src/main/java/net/minecraft/server/CustomFunction.java -index 6d628c759346701c4097f36c302d1a1ab258bf9c..67e1b153a6f2ff9547dd03fcf4abcbea851e69f9 100644 ---- a/src/main/java/net/minecraft/server/CustomFunction.java -+++ b/src/main/java/net/minecraft/server/CustomFunction.java -@@ -13,12 +13,22 @@ public class CustomFunction { +diff --git a/src/main/java/net/minecraft/commands/CustomFunction.java b/src/main/java/net/minecraft/commands/CustomFunction.java +index f96b132bb51c2d97703964a70fcb058f0649ac13..4c146ac041332230f6d9a01be28b6852c7624416 100644 +--- a/src/main/java/net/minecraft/commands/CustomFunction.java ++++ b/src/main/java/net/minecraft/commands/CustomFunction.java +@@ -15,12 +15,22 @@ public class CustomFunction { private final CustomFunction.c[] a; private final MinecraftKey b; @@ -912,11 +747,38 @@ index 6d628c759346701c4097f36c302d1a1ab258bf9c..67e1b153a6f2ff9547dd03fcf4abcbea public MinecraftKey a() { return this.b; } +diff --git a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java +index 989683265a99fc51607aa130733e00033b444a6a..e47da20ab8ce4da34755e105bf55d8542fb50138 100644 +--- a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java +@@ -6,6 +6,8 @@ import net.minecraft.server.level.WorldServer; + import net.minecraft.util.thread.IAsyncTaskHandler; + import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; ++import co.aikar.timings.MinecraftTimings; // Paper ++import co.aikar.timings.Timing; // Paper + + // CraftBukkit start + import net.minecraft.server.MinecraftServer; +@@ -22,10 +24,13 @@ public class PlayerConnectionUtils { + + public static void ensureMainThread(Packet packet, T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { + if (!iasynctaskhandler.isMainThread()) { ++ Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper - timings + iasynctaskhandler.execute(() -> { + if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590 + if (t0.a().isConnected()) { ++ try (Timing ignored = timing.startTiming()) { // Paper - timings + packet.a(t0); ++ } // Paper - timings + } else { + PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); + } diff --git a/src/main/java/net/minecraft/server/CustomFunctionData.java b/src/main/java/net/minecraft/server/CustomFunctionData.java -index 11891990d90b789192d9081787c1e844646121ae..2a48d85f0490991eb323ef550cb6148d6387acaf 100644 +index 21f5474a1cd60168ca059da542a432d40d88b514..07ca1234ad6ffa797003f7317fb88abf732bc159 100644 --- a/src/main/java/net/minecraft/server/CustomFunctionData.java +++ b/src/main/java/net/minecraft/server/CustomFunctionData.java -@@ -69,7 +69,7 @@ public class CustomFunctionData { +@@ -75,7 +75,7 @@ public class CustomFunctionData { } else { int j; @@ -925,11 +787,205 @@ index 11891990d90b789192d9081787c1e844646121ae..2a48d85f0490991eb323ef550cb6148d this.d = true; int k = 0; CustomFunction.c[] acustomfunction_c = customfunction.b(); -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index d91b029c95b6380300db81e7c0fb172ff57958a1..218071260dec39dd4f7eb733ae6f832aacd6fd6f 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -26,8 +26,9 @@ import org.apache.logging.log4j.Logger; +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 08443ca31ead7c484f0faeef57305c28d74c0e3f..422ee5fb0d917399b2b1e5d893219405c5dbe82d 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -174,7 +174,7 @@ import org.bukkit.craftbukkit.Main; + import org.bukkit.event.server.ServerLoadEvent; + // CraftBukkit end + +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot ++import co.aikar.timings.MinecraftTimings; // Paper + import org.spigotmc.SlackActivityAccountant; // Spigot + + public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { +@@ -228,8 +228,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { +- return !this.canSleepForTick(); ++ return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick + }); + } + +@@ -1112,10 +1125,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { ++ return !this.canOversleep(); ++ }); ++ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); ++ // Paper end ++ + ++this.ticks; + this.b(booleansupplier); + if (i - this.T >= 5000000000L) { +@@ -1133,14 +1154,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit +- SpigotTimings.worldSaveTimer.startTiming(); // Spigot + MinecraftServer.LOGGER.debug("Autosave started"); + this.methodProfiler.enter("save"); + this.playerList.savePlayers(); + this.saveChunks(true, false, false); + this.methodProfiler.exit(); + MinecraftServer.LOGGER.debug("Autosave finished"); +- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot + } + + this.methodProfiler.enter("snooper"); +@@ -1153,6 +1172,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { // CraftBukkit start - fire RemoteServerCommandEvent -@@ -641,10 +643,39 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -680,10 +682,39 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer if (event.isCancelled()) { return; } @@ -1006,372 +1062,103 @@ index d91b029c95b6380300db81e7c0fb172ff57958a1..218071260dec39dd4f7eb733ae6f832a return this.remoteControlCommandListener.getMessages(); } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index b35ffae9f88cc14aec01482c2a3ed2e2428c2012..03933c24ed4d97e16bcebf6b89b1a8d1fc43cd0b 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -31,7 +31,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; - import org.bukkit.entity.Hanging; - import org.bukkit.entity.LivingEntity; - import org.bukkit.entity.Vehicle; --import org.spigotmc.CustomTimingsHandler; // Spigot - import org.bukkit.event.entity.EntityCombustByEntityEvent; - import org.bukkit.event.hanging.HangingBreakByEntityEvent; - import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; -@@ -163,7 +162,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only - public boolean forceExplosionKnockback; // SPIGOT-949 - public boolean persistentInvisibility = false; -- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot - // Spigot start - public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); - public final boolean defaultActivationState; -@@ -532,7 +530,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 3055ef62a054d91a74552f83f7afdfe08c7880db..95af66ebb7849cbf2bcad6bc52aeb85ab2601b6c 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -344,11 +344,13 @@ public class ChunkProviderServer extends IChunkProvider { + } + + gameprofilerfiller.c("getChunkCacheMiss"); +- world.timings.syncChunkLoadTimer.startTiming(); // Spigot + CompletableFuture> completablefuture = this.getChunkFutureMainThread(i, j, chunkstatus, flag); + ++ if (!completablefuture.isDone()) { // Paper ++ this.world.timings.syncChunkLoad.startTiming(); // Paper + this.serverThreadQueue.awaitTasks(completablefuture::isDone); +- world.timings.syncChunkLoadTimer.stopTiming(); // Spigot ++ this.world.timings.syncChunkLoad.stopTiming(); // Paper ++ } // Paper + ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { + return ichunkaccess1; + }, (playerchunk_failure) -> { +@@ -535,7 +537,9 @@ public class ChunkProviderServer extends IChunkProvider { + + public void save(boolean flag) { + this.tickDistanceManager(); ++ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings + this.playerChunkMap.save(flag); ++ } // Paper - Timings } - public void move(EnumMoveType enummovetype, Vec3D vec3d) { -- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot - if (this.noclip) { - this.a(this.getBoundingBox().c(vec3d)); - this.recalcPosition(); -@@ -668,7 +665,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - this.world.getMethodProfiler().exit(); - } -- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot - } - - protected BlockPosition ap() { -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index f49f66e3c128e9ce0f4edc24332f5c52cbb20d02..2150525c7c015bccc8fa4330f2e6c50f9170c55e 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -42,7 +42,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; - import org.bukkit.event.player.PlayerItemConsumeEvent; - // CraftBukkit end - --import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.MinecraftTimings; // Paper - - public abstract class EntityLiving extends Entity { - -@@ -2365,7 +2365,6 @@ public abstract class EntityLiving extends Entity { - @Override - public void tick() { -- SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot - super.tick(); - this.t(); - this.v(); -@@ -2414,9 +2413,7 @@ public abstract class EntityLiving extends Entity { +@@ -572,7 +576,9 @@ public class ChunkProviderServer extends IChunkProvider { + this.tickDistanceManager(); + this.world.timings.doChunkMap.stopTiming(); // Spigot + this.world.getMethodProfiler().exitEnter("chunks"); ++ this.world.timings.chunks.startTiming(); // Paper - timings + this.tickChunks(); ++ this.world.timings.chunks.stopTiming(); // Paper - timings + this.world.timings.doChunkUnload.startTiming(); // Spigot + this.world.getMethodProfiler().exitEnter("unload"); + this.playerChunkMap.unloadChunks(booleansupplier); +@@ -596,8 +602,10 @@ public class ChunkProviderServer extends IChunkProvider { + boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit + + this.world.getMethodProfiler().enter("naturalSpawnCount"); ++ this.world.timings.countNaturalMobs.startTiming(); // Paper - timings + int l = this.chunkMapDistance.b(); + SpawnerCreature.d spawnercreature_d = SpawnerCreature.a(l, this.world.A(), this::a); ++ this.world.timings.countNaturalMobs.stopTiming(); // Paper - timings + + this.p = spawnercreature_d; + this.world.getMethodProfiler().exit(); +@@ -608,7 +616,9 @@ public class ChunkProviderServer extends IChunkProvider { + + if (optional.isPresent()) { + this.world.getMethodProfiler().enter("broadcast"); ++ this.world.timings.broadcastChunkUpdates.startTiming(); // Paper - timings + playerchunk.a((Chunk) optional.get()); ++ this.world.timings.broadcastChunkUpdates.stopTiming(); // Paper - timings + this.world.getMethodProfiler().exit(); + Optional optional1 = ((Either) playerchunk.b().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + +@@ -622,25 +632,25 @@ public class ChunkProviderServer extends IChunkProvider { + SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); + } + +- this.world.timings.doTickTiles.startTiming(); // Spigot ++ this.world.timings.chunkTicks.startTiming(); // Spigot // Paper + this.world.a(chunk, k); +- this.world.timings.doTickTiles.stopTiming(); // Spigot ++ this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper + } + } + } + }); + this.world.getMethodProfiler().enter("customSpawners"); + if (flag1) { ++ try (co.aikar.timings.Timing ignored = this.world.timings.miscMobSpawning.startTiming()) { // Paper - timings + this.world.doMobSpawning(this.allowMonsters, this.allowAnimals); ++ } // Paper - timings } - } -- SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot - this.movementTick(); -- SpigotTimings.timerEntityTickRest.startTiming(); // Spigot - double d0 = this.locX() - this.lastX; - double d1 = this.locZ() - this.lastZ; - float f = (float) (d0 * d0 + d1 * d1); -@@ -2496,8 +2493,6 @@ public abstract class EntityLiving extends Entity { - if (this.isSleeping()) { - this.pitch = 0.0F; - } -- -- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot - } - - public void updateEquipment() { // PAIL private->public; updateEquipment -@@ -2679,7 +2674,6 @@ public abstract class EntityLiving extends Entity { - - this.setMot(d4, d5, d6); - this.world.getMethodProfiler().enter("ai"); -- SpigotTimings.timerEntityAI.startTiming(); // Spigot - if (this.isFrozen()) { - this.jumping = false; - this.aR = 0.0F; -@@ -2689,7 +2683,6 @@ public abstract class EntityLiving extends Entity { - this.doTick(); + this.world.getMethodProfiler().exit(); this.world.getMethodProfiler().exit(); } -- SpigotTimings.timerEntityAI.stopTiming(); // Spigot - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().enter("jump"); -@@ -2724,9 +2717,9 @@ public abstract class EntityLiving extends Entity { - this.r(); - AxisAlignedBB axisalignedbb = this.getBoundingBox(); - -- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot -+ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper - this.g(new Vec3D((double) this.aR, (double) this.aS, (double) this.aT)); -- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot -+ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper - this.world.getMethodProfiler().exit(); - this.world.getMethodProfiler().enter("push"); - if (this.bf > 0) { -@@ -2734,9 +2727,7 @@ public abstract class EntityLiving extends Entity { - this.a(axisalignedbb, this.getBoundingBox()); - } - -- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot - this.collideNearby(); -- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot - this.world.getMethodProfiler().exit(); - if (!this.world.isClientSide && this.dO() && this.aG()) { - this.damageEntity(DamageSource.DROWN, 1.0F); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index 9946985407561596c6c364526d2fe7477771303a..b1fe488e41a2c9f77df091e1d14ed5c87a4358c8 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -151,7 +151,9 @@ public class EntityTypes { - return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s)); +- this.world.timings.tracker.startTiming(); // Spigot + this.playerChunkMap.g(); +- this.world.timings.tracker.stopTiming(); // Spigot } -- public EntityTypes(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet immutableset, EntitySize entitysize, int i, int j) { -+ public final String id; -+ public EntityTypes(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet immutableset, EntitySize entitysize, int i, int j) { this(entitytypes_b, enumcreaturetype, flag, flag1, flag2, flag3, immutableset, entitysize, i, j, "custom"); } // Paper - old signature -+ public EntityTypes(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet immutableset, EntitySize entitysize, int i, int j, String id) { // Paper - add id - this.bf = entitytypes_b; - this.bg = enumcreaturetype; - this.bl = flag3; -@@ -162,6 +164,14 @@ public class EntityTypes { - this.br = entitysize; - this.bm = i; - this.bn = j; -+ -+ // Paper start - timings -+ this.id = id; -+ this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); -+ this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); -+ this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); -+ this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); -+ // Paper end - } - - @Nullable -@@ -382,6 +392,12 @@ public class EntityTypes { - return this.bn; - } - -+ // Paper start - timings -+ public final co.aikar.timings.Timing tickTimer; -+ public final co.aikar.timings.Timing inactiveTickTimer; -+ public final co.aikar.timings.Timing passengerTickTimer; -+ public final co.aikar.timings.Timing passengerInactiveTickTimer; -+ // Paper end - public boolean isDeltaTracking() { - return this != EntityTypes.PLAYER && this != EntityTypes.LLAMA_SPIT && this != EntityTypes.WITHER && this != EntityTypes.BAT && this != EntityTypes.ITEM_FRAME && this != EntityTypes.LEASH_KNOT && this != EntityTypes.PAINTING && this != EntityTypes.END_CRYSTAL && this != EntityTypes.EVOKER_FANGS; - } -@@ -469,7 +485,7 @@ public class EntityTypes { - SystemUtils.a(DataConverterTypes.ENTITY_TREE, s); - } - -- return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); -+ return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i, s); // Paper - add id - } - } - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7678f69b9b9a28e6b1ac837fb9e499d8e0db1b13..c1a651a1c2d5ffed80e4517e465901bb39274548 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -67,7 +67,7 @@ import org.bukkit.craftbukkit.Main; - import org.bukkit.event.server.ServerLoadEvent; - // CraftBukkit end - --import org.bukkit.craftbukkit.SpigotTimings; // Spigot -+import co.aikar.timings.MinecraftTimings; // Paper - import org.spigotmc.SlackActivityAccountant; // Spigot - - public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { -@@ -121,8 +121,8 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { -- return !this.canSleepForTick(); -+ return !this.canSleepForTickNoOversleep(); // Paper - move oversleep into full server tick - }); - } - -@@ -1005,10 +1018,18 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { -+ return !this.canOversleep(); -+ }); -+ isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -+ // Paper end -+ - ++this.ticks; - this.b(booleansupplier); - if (i - this.T >= 5000000000L) { -@@ -1026,14 +1047,12 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit -- SpigotTimings.worldSaveTimer.startTiming(); // Spigot - MinecraftServer.LOGGER.debug("Autosave started"); - this.methodProfiler.enter("save"); - this.playerList.savePlayers(); - this.saveChunks(true, false, false); - this.methodProfiler.exit(); - MinecraftServer.LOGGER.debug("Autosave finished"); -- SpigotTimings.worldSaveTimer.stopTiming(); // Spigot - } - - this.methodProfiler.enter("snooper"); -@@ -1046,6 +1065,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant consumer) { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 67cae076af338348fdc9c5de51377b32a97ef836..8219ffea086a446a682479ae21ca7d56a598751a 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -1,7 +1,9 @@ - package net.minecraft.server; + package net.minecraft.server.level; +import co.aikar.timings.Timing; // Paper import com.google.common.collect.ImmutableList; @@ -1380,7 +1167,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe import com.google.common.collect.Lists; import com.google.common.collect.Queues; import com.google.common.collect.Sets; -@@ -509,11 +511,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -553,11 +555,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private CompletableFuture> f(ChunkCoordIntPair chunkcoordintpair) { return CompletableFuture.supplyAsync(() -> { @@ -1398,7 +1185,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); if (flag) { -@@ -525,7 +530,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -569,7 +574,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } PlayerChunkMap.LOGGER.error("Chunk file at {} is missing level data, skipping", chunkcoordintpair); @@ -1407,7 +1194,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe } catch (ReportedException reportedexception) { Throwable throwable = reportedexception.getCause(); -@@ -562,7 +567,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -606,7 +611,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return "chunkGenerate " + chunkstatus.d(); }); return completablefuture.thenComposeAsync((either) -> { @@ -1416,7 +1203,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe try { CompletableFuture> completablefuture1 = chunkstatus.a(this.world, this.chunkGenerator, this.definedStructureManager, this.lightEngine, (ichunkaccess) -> { return this.c(playerchunk); -@@ -615,6 +620,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -659,6 +664,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkStatus chunkstatus = PlayerChunk.getChunkStatus(playerchunk.getTicketLevel()); return !chunkstatus.b(ChunkStatus.FULL) ? PlayerChunk.UNLOADED_CHUNK_ACCESS : either.mapLeft((ichunkaccess) -> { @@ -1424,7 +1211,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); Chunk chunk; -@@ -666,6 +672,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -710,6 +716,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } return chunk; @@ -1432,7 +1219,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe }); }, (runnable) -> { Mailbox mailbox = this.mailboxMain; -@@ -1124,6 +1131,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1168,6 +1175,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PlayerChunkMap.EntityTracker playerchunkmap_entitytracker; ObjectIterator objectiterator; @@ -1440,7 +1227,7 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe for (objectiterator = this.trackedEntities.values().iterator(); objectiterator.hasNext(); playerchunkmap_entitytracker.trackerEntry.a()) { playerchunkmap_entitytracker = (PlayerChunkMap.EntityTracker) objectiterator.next(); -@@ -1141,16 +1149,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1185,16 +1193,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunkmap_entitytracker.e = sectionposition1; } } @@ -1461,231 +1248,11 @@ index e641f4b89b39525686bba4d1e91c4ec26a9bd681..5ca081e8be411aee98efce3e41876efe } protected void broadcast(Entity entity, Packet packet) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index b37b791cd66b2e88dd0ecf52beea1844c97cdb94..d34e91887cd73009bf852fb849e495a8affed7a9 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -64,6 +64,7 @@ import org.bukkit.inventory.CraftingInventory; - import org.bukkit.inventory.EquipmentSlot; - import org.bukkit.inventory.InventoryView; - import org.bukkit.util.NumberConversions; -+import co.aikar.timings.MinecraftTimings; // Paper - // CraftBukkit end - - public class PlayerConnection implements PacketListenerPlayIn { -@@ -146,7 +147,6 @@ public class PlayerConnection implements PacketListenerPlayIn { - // CraftBukkit end - - public void tick() { -- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.startTiming(); // Spigot - this.syncPosition(); - this.player.lastX = this.player.locX(); - this.player.lastY = this.player.locY(); -@@ -222,7 +222,6 @@ public class PlayerConnection implements PacketListenerPlayIn { - this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 - this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); - } -- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot - - } - -@@ -1769,7 +1768,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - // CraftBukkit end - - private void handleCommand(String s) { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.startTiming(); // Paper - // CraftBukkit start - whole method - if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot - this.LOGGER.info(this.player.getName() + " issued server command: " + s); -@@ -1780,7 +1779,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - this.server.getPluginManager().callEvent(event); - - if (event.isCancelled()) { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - return; - } - -@@ -1793,7 +1792,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); - return; - } finally { -- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot -+ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper - } - // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index 8c534c2f06fe72287364536b8767bd774b94c027..9c810b5aa21ca714ccf355d5648b7612f99b6884 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -@@ -2,6 +2,8 @@ package net.minecraft.server; - - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -+import co.aikar.timings.MinecraftTimings; // Paper -+import co.aikar.timings.Timing; // Paper - - public class PlayerConnectionUtils { - -@@ -13,10 +15,13 @@ public class PlayerConnectionUtils { - - public static void ensureMainThread(Packet packet, T t0, IAsyncTaskHandler iasynctaskhandler) throws CancelledPacketHandleException { - if (!iasynctaskhandler.isMainThread()) { -+ Timing timing = MinecraftTimings.getPacketTiming(packet); // Paper - timings - iasynctaskhandler.execute(() -> { - if (MinecraftServer.getServer().hasStopped() || (t0 instanceof PlayerConnection && ((PlayerConnection) t0).processedDisconnect)) return; // CraftBukkit, MC-142590 - if (t0.a().isConnected()) { -+ try (Timing ignored = timing.startTiming()) { // Paper - timings - packet.a(t0); -+ } // Paper - timings - } else { - PlayerConnectionUtils.LOGGER.debug("Ignoring packet due to disconnection: " + packet); - } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 1ccc54af2feaec241b36304986e474cea5db564f..e712f33fe733b805098174558bb9319aa33572f0 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import co.aikar.timings.MinecraftTimings; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Sets; -@@ -950,10 +951,11 @@ public abstract class PlayerList { - } - - public void savePlayers() { -+ MinecraftTimings.savePlayers.startTiming(); // Paper - for (int i = 0; i < this.players.size(); ++i) { - this.savePlayerFile((EntityPlayer) this.players.get(i)); - } -- -+ MinecraftTimings.savePlayers.stopTiming(); // Paper - } - - public WhiteList getWhitelist() { -diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index e8ff43662b8397229cb19ea26342b66c88807379..3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8 100644 ---- a/src/main/java/net/minecraft/server/TickListServer.java -+++ b/src/main/java/net/minecraft/server/TickListServer.java -@@ -26,12 +26,17 @@ public class TickListServer implements TickList { - private final List> g = Lists.newArrayList(); - private final Consumer> h; - -- public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Consumer> consumer) { -+ public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Consumer> consumer, String timingsType) { // Paper - this.a = predicate; - this.b = function; - this.e = worldserver; - this.h = consumer; -+ this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Cleanup"); -+ this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Ticking"); - } -+ private final co.aikar.timings.Timing timingCleanup; // Paper -+ private final co.aikar.timings.Timing timingTicking; // Paper -+ // Paper end - - public void b() { - int i = this.nextTickList.size(); -@@ -54,6 +59,7 @@ public class TickListServer implements TickList { - - this.e.getMethodProfiler().enter("cleaning"); - -+ this.timingCleanup.startTiming(); // Paper - NextTickListEntry nextticklistentry; - - while (i > 0 && iterator.hasNext()) { -@@ -69,7 +75,9 @@ public class TickListServer implements TickList { - --i; - } - } -+ this.timingCleanup.stopTiming(); // Paper - -+ this.timingTicking.startTiming(); // Paper - this.e.getMethodProfiler().exitEnter("ticking"); - - while ((nextticklistentry = (NextTickListEntry) this.f.poll()) != null) { -@@ -89,6 +97,7 @@ public class TickListServer implements TickList { - } - } - -+ this.timingTicking.stopTiming(); // Paper - this.e.getMethodProfiler().exit(); - this.g.clear(); - this.f.clear(); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 43757f60d091414befe7daa192b17e2fe1ddbef9..c8aa347baf100b25694ed9172590b073db810fe9 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -12,10 +12,12 @@ import org.bukkit.inventory.InventoryHolder; - // CraftBukkit end - - import org.spigotmc.CustomTimingsHandler; // Spigot -+import co.aikar.timings.MinecraftTimings; // Paper -+import co.aikar.timings.Timing; // Paper - - public abstract class TileEntity implements KeyedObject { // Paper - -- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot -+ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper - // CraftBukkit start - data containers - private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); - public CraftPersistentDataContainer persistentDataContainer; -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 6df28adb17d78a7f5189787a979a44fad677f05c..09577ddcb3c2432a0af6047b287a387de5d2920a 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -18,7 +18,6 @@ import org.apache.logging.log4j.Logger; - import java.util.HashMap; - import java.util.Map; - import org.bukkit.Bukkit; --import org.bukkit.craftbukkit.SpigotTimings; // Spigot - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.CraftWorld; - import org.bukkit.craftbukkit.block.CapturedBlockState; -@@ -80,7 +79,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper - -- public final SpigotTimings.WorldTimingsHandler timings; // Spigot -+ public final co.aikar.timings.WorldTimingsHandler timings; // Paper - public static BlockPosition lastPhysicsProblem; // Spigot - private org.spigotmc.TickLimiter entityLimiter; - private org.spigotmc.TickLimiter tileLimiter; -@@ -165,7 +164,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public void c(WorldBorder worldborder, double d0) {} - }); - // CraftBukkit end -- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings -+ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings - this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); - this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); - } -@@ -745,15 +744,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - - timings.tileEntityPending.stopTiming(); // Spigot -+ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper - gameprofilerfiller.exit(); - spigotConfig.currentPrimedTnt = 0; // Spigot - } - - public void a(Consumer consumer, Entity entity) { - try { -- SpigotTimings.tickEntityTimer.startTiming(); // Spigot - consumer.accept(entity); -- SpigotTimings.tickEntityTimer.stopTiming(); // Spigot - } catch (Throwable throwable) { - CrashReport crashreport = CrashReport.a(throwable, "Ticking entity"); - CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked"); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f1451ee868e4 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -2,6 +2,8 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index bc580b35bdffddc5675a7bd50801057587fd02fe..038944613b6687c057e73eaa038c9492bda7116d 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -2,6 +2,8 @@ package net.minecraft.server.level; import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Iterables; @@ -1694,15 +1261,15 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Queues; -@@ -44,7 +46,6 @@ import org.apache.logging.log4j.Logger; - import java.util.logging.Level; +@@ -153,7 +155,6 @@ import net.minecraft.world.level.block.ITileEntity; + import net.minecraft.world.level.storage.WorldDataServer; import org.bukkit.Bukkit; import org.bukkit.WeatherType; -import org.bukkit.craftbukkit.SpigotTimings; // Spigot import org.bukkit.craftbukkit.event.CraftEventFactory; import org.bukkit.craftbukkit.util.WorldUUID; import org.bukkit.event.entity.CreatureSpawnEvent; -@@ -100,10 +101,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -209,10 +210,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit end this.nextTickListBlock = new TickListServer<>(this, (block) -> { return block == null || block.getBlockData().isAir(); @@ -1715,7 +1282,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 this.navigators = Sets.newHashSet(); this.L = new ObjectLinkedOpenHashSet(); this.Q = flag1; -@@ -331,17 +332,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -440,17 +441,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.Q(); this.b(); gameprofilerfiller.exitEnter("chunkSource"); @@ -1739,7 +1306,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 gameprofilerfiller.exitEnter("blockEvents"); timings.doSounds.startTiming(); // Spigot this.ak(); -@@ -513,6 +518,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -622,6 +627,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } gameprofilerfiller.exitEnter("tickBlocks"); @@ -1747,7 +1314,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 if (i > 0) { ChunkSection[] achunksection = chunk.getSections(); int l = achunksection.length; -@@ -544,7 +550,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -653,7 +659,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } } @@ -1756,7 +1323,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 gameprofilerfiller.exit(); } -@@ -642,14 +648,22 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -751,14 +757,22 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (!(entity instanceof EntityHuman) && !this.getChunkProvider().a(entity)) { this.chunkCheck(entity); } else { @@ -1780,7 +1347,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 entity.g(entity.locX(), entity.locY(), entity.locZ()); entity.lastYaw = entity.yaw; entity.lastPitch = entity.pitch; -@@ -676,7 +690,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -785,7 +799,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.a(entity, entity1); } } @@ -1789,7 +1356,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 } } -@@ -754,6 +768,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -863,6 +877,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (!flag1) { org.bukkit.Bukkit.getPluginManager().callEvent(new org.bukkit.event.world.WorldSaveEvent(getWorld())); // CraftBukkit @@ -1797,7 +1364,7 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel")); } -@@ -763,7 +778,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -872,7 +887,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { iprogressupdate.c(new ChatMessage("menu.savingChunks")); } @@ -1808,8 +1375,444 @@ index 592af06de1fc02d94273363c2ede1175a39997f0..3d915105b277a7cbf330ba2cb3c2f145 } // CraftBukkit start - moved from MinecraftServer.saveChunks +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 5ed893d96fe317dc5a238c82b0bd5f3f03dfa9cc..db155011112aba2b1e3ec5b337db25dfb7b511fb 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -209,6 +209,7 @@ import org.bukkit.inventory.CraftingInventory; + import org.bukkit.inventory.EquipmentSlot; + import org.bukkit.inventory.InventoryView; + import org.bukkit.util.NumberConversions; ++import co.aikar.timings.MinecraftTimings; // Paper + // CraftBukkit end + + public class PlayerConnection implements PacketListenerPlayIn { +@@ -291,7 +292,6 @@ public class PlayerConnection implements PacketListenerPlayIn { + // CraftBukkit end + + public void tick() { +- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.startTiming(); // Spigot + this.syncPosition(); + this.player.lastX = this.player.locX(); + this.player.lastY = this.player.locY(); +@@ -367,7 +367,6 @@ public class PlayerConnection implements PacketListenerPlayIn { + this.player.resetIdleTimer(); // CraftBukkit - SPIGOT-854 + this.disconnect(new ChatMessage("multiplayer.disconnect.idling")); + } +- org.bukkit.craftbukkit.SpigotTimings.playerConnectionTimer.stopTiming(); // Spigot + + } + +@@ -1914,7 +1913,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + // CraftBukkit end + + private void handleCommand(String s) { +- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.startTiming(); // Spigot ++ MinecraftTimings.playerCommandTimer.startTiming(); // Paper + // CraftBukkit start - whole method + if ( org.spigotmc.SpigotConfig.logCommands ) // Spigot + this.LOGGER.info(this.player.getName() + " issued server command: " + s); +@@ -1925,7 +1924,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + this.server.getPluginManager().callEvent(event); + + if (event.isCancelled()) { +- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + return; + } + +@@ -1938,7 +1937,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + java.util.logging.Logger.getLogger(PlayerConnection.class.getName()).log(java.util.logging.Level.SEVERE, null, ex); + return; + } finally { +- org.bukkit.craftbukkit.SpigotTimings.playerCommandTimer.stopTiming(); // Spigot ++ MinecraftTimings.playerCommandTimer.stopTiming(); // Paper + } + // this.minecraftServer.getCommandDispatcher().a(this.player.getCommandListener(), s); + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 5d1bbc42b4d65aa735570c53e4e6bc9e08899749..c601a5c577e438a3fa8dd4c5f36dbe9494b03d52 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1,5 +1,6 @@ + package net.minecraft.server.players; + ++import co.aikar.timings.MinecraftTimings; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +@@ -1022,10 +1023,11 @@ public abstract class PlayerList { + } + + public void savePlayers() { ++ MinecraftTimings.savePlayers.startTiming(); // Paper + for (int i = 0; i < this.players.size(); ++i) { + this.savePlayerFile((EntityPlayer) this.players.get(i)); + } +- ++ MinecraftTimings.savePlayers.stopTiming(); // Paper + } + + public WhiteList getWhitelist() { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 9af9d9463e9b50f8a627ffd79dcd3716c506f7e7..db8970539f7f69c9087abe43286bca008cb4594d 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -116,7 +116,6 @@ import org.bukkit.craftbukkit.event.CraftPortalEvent; + import org.bukkit.entity.Hanging; + import org.bukkit.entity.LivingEntity; + import org.bukkit.entity.Vehicle; +-import org.spigotmc.CustomTimingsHandler; // Spigot + import org.bukkit.event.entity.EntityCombustByEntityEvent; + import org.bukkit.event.hanging.HangingBreakByEntityEvent; + import org.bukkit.event.vehicle.VehicleBlockCollisionEvent; +@@ -248,7 +247,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only + public boolean forceExplosionKnockback; // SPIGOT-949 + public boolean persistentInvisibility = false; +- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getEntityTimings(this); // Spigot + // Spigot start + public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); + public final boolean defaultActivationState; +@@ -617,7 +615,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + public void move(EnumMoveType enummovetype, Vec3D vec3d) { +- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.startTiming(); // Spigot + if (this.noclip) { + this.a(this.getBoundingBox().c(vec3d)); + this.recalcPosition(); +@@ -753,7 +750,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + + this.world.getMethodProfiler().exit(); + } +- org.bukkit.craftbukkit.SpigotTimings.entityMoveTimer.stopTiming(); // Spigot + } + + protected BlockPosition ap() { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index feb640a21f4d0b00d85c1c4f013c22454616578a..98f5f1dcd0abf9272533bf3801bab316c9f0a12c 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -135,7 +135,7 @@ import org.bukkit.event.entity.EntityTeleportEvent; + import org.bukkit.event.player.PlayerItemConsumeEvent; + // CraftBukkit end + +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot ++import co.aikar.timings.MinecraftTimings; // Paper + + public abstract class EntityLiving extends Entity { + +@@ -2458,7 +2458,6 @@ public abstract class EntityLiving extends Entity { + + @Override + public void tick() { +- SpigotTimings.timerEntityBaseTick.startTiming(); // Spigot + super.tick(); + this.t(); + this.v(); +@@ -2507,9 +2506,7 @@ public abstract class EntityLiving extends Entity { + } + } + +- SpigotTimings.timerEntityBaseTick.stopTiming(); // Spigot + this.movementTick(); +- SpigotTimings.timerEntityTickRest.startTiming(); // Spigot + double d0 = this.locX() - this.lastX; + double d1 = this.locZ() - this.lastZ; + float f = (float) (d0 * d0 + d1 * d1); +@@ -2589,8 +2586,6 @@ public abstract class EntityLiving extends Entity { + if (this.isSleeping()) { + this.pitch = 0.0F; + } +- +- SpigotTimings.timerEntityTickRest.stopTiming(); // Spigot + } + + public void updateEquipment() { // PAIL private->public; updateEquipment +@@ -2772,7 +2767,6 @@ public abstract class EntityLiving extends Entity { + + this.setMot(d4, d5, d6); + this.world.getMethodProfiler().enter("ai"); +- SpigotTimings.timerEntityAI.startTiming(); // Spigot + if (this.isFrozen()) { + this.jumping = false; + this.aR = 0.0F; +@@ -2782,7 +2776,6 @@ public abstract class EntityLiving extends Entity { + this.doTick(); + this.world.getMethodProfiler().exit(); + } +- SpigotTimings.timerEntityAI.stopTiming(); // Spigot + + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("jump"); +@@ -2817,9 +2810,9 @@ public abstract class EntityLiving extends Entity { + this.r(); + AxisAlignedBB axisalignedbb = this.getBoundingBox(); + +- SpigotTimings.timerEntityAIMove.startTiming(); // Spigot ++ // SpigotTimings.timerEntityAIMove.startTiming(); // Spigot // Paper + this.g(new Vec3D((double) this.aR, (double) this.aS, (double) this.aT)); +- SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot ++ // SpigotTimings.timerEntityAIMove.stopTiming(); // Spigot // Paper + this.world.getMethodProfiler().exit(); + this.world.getMethodProfiler().enter("push"); + if (this.bf > 0) { +@@ -2827,9 +2820,7 @@ public abstract class EntityLiving extends Entity { + this.a(axisalignedbb, this.getBoundingBox()); + } + +- SpigotTimings.timerEntityAICollision.startTiming(); // Spigot + this.collideNearby(); +- SpigotTimings.timerEntityAICollision.stopTiming(); // Spigot + this.world.getMethodProfiler().exit(); + if (!this.world.isClientSide && this.dO() && this.aG()) { + this.damageEntity(DamageSource.DROWN, 1.0F); +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index dc92b112770955f9fa49a408262da2e5bbc4bf98..a707ba365e25ea15e2e9d22110696b6136aa0c6f 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -281,7 +281,9 @@ public class EntityTypes { + return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s)); + } + +- public EntityTypes(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet immutableset, EntitySize entitysize, int i, int j) { ++ public final String id; ++ public EntityTypes(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet immutableset, EntitySize entitysize, int i, int j) { this(entitytypes_b, enumcreaturetype, flag, flag1, flag2, flag3, immutableset, entitysize, i, j, "custom"); } // Paper - old signature ++ public EntityTypes(EntityTypes.b entitytypes_b, EnumCreatureType enumcreaturetype, boolean flag, boolean flag1, boolean flag2, boolean flag3, ImmutableSet immutableset, EntitySize entitysize, int i, int j, String id) { // Paper - add id + this.bf = entitytypes_b; + this.bg = enumcreaturetype; + this.bl = flag3; +@@ -292,6 +294,14 @@ public class EntityTypes { + this.br = entitysize; + this.bm = i; + this.bn = j; ++ ++ // Paper start - timings ++ this.id = id; ++ this.tickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "tick"); ++ this.inactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "inactiveTick"); ++ this.passengerTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerTick"); ++ this.passengerInactiveTickTimer = co.aikar.timings.MinecraftTimings.getEntityTimings(id, "passengerInactiveTick"); ++ // Paper end + } + + @Nullable +@@ -512,6 +522,12 @@ public class EntityTypes { + return this.bn; + } + ++ // Paper start - timings ++ public final co.aikar.timings.Timing tickTimer; ++ public final co.aikar.timings.Timing inactiveTickTimer; ++ public final co.aikar.timings.Timing passengerTickTimer; ++ public final co.aikar.timings.Timing passengerInactiveTickTimer; ++ // Paper end + public boolean isDeltaTracking() { + return this != EntityTypes.PLAYER && this != EntityTypes.LLAMA_SPIT && this != EntityTypes.WITHER && this != EntityTypes.BAT && this != EntityTypes.ITEM_FRAME && this != EntityTypes.LEASH_KNOT && this != EntityTypes.PAINTING && this != EntityTypes.END_CRYSTAL && this != EntityTypes.EVOKER_FANGS; + } +@@ -599,7 +615,7 @@ public class EntityTypes { + SystemUtils.a(DataConverterTypes.ENTITY_TREE, s); + } + +- return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i); ++ return new EntityTypes<>(this.a, this.b, this.d, this.e, this.f, this.g, this.c, this.j, this.h, this.i, s); // Paper - add id + } + } + +diff --git a/src/main/java/net/minecraft/world/level/TickListServer.java b/src/main/java/net/minecraft/world/level/TickListServer.java +index e7296b8684d6d8c2f256d4a9da87f408a198c331..c221e5caf518b8c588390e438346fa58fa8c5a38 100644 +--- a/src/main/java/net/minecraft/world/level/TickListServer.java ++++ b/src/main/java/net/minecraft/world/level/TickListServer.java +@@ -38,12 +38,17 @@ public class TickListServer implements TickList { + private final List> g = Lists.newArrayList(); + private final Consumer> h; + +- public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Consumer> consumer) { ++ public TickListServer(WorldServer worldserver, Predicate predicate, Function function, Consumer> consumer, String timingsType) { // Paper + this.a = predicate; + this.b = function; + this.e = worldserver; + this.h = consumer; ++ this.timingCleanup = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Cleanup"); ++ this.timingTicking = co.aikar.timings.WorldTimingsHandler.getTickList(worldserver, timingsType + " - Ticking"); + } ++ private final co.aikar.timings.Timing timingCleanup; // Paper ++ private final co.aikar.timings.Timing timingTicking; // Paper ++ // Paper end + + public void b() { + int i = this.nextTickList.size(); +@@ -66,6 +71,7 @@ public class TickListServer implements TickList { + + this.e.getMethodProfiler().enter("cleaning"); + ++ this.timingCleanup.startTiming(); // Paper + NextTickListEntry nextticklistentry; + + while (i > 0 && iterator.hasNext()) { +@@ -81,7 +87,9 @@ public class TickListServer implements TickList { + --i; + } + } ++ this.timingCleanup.stopTiming(); // Paper + ++ this.timingTicking.startTiming(); // Paper + this.e.getMethodProfiler().exitEnter("ticking"); + + while ((nextticklistentry = (NextTickListEntry) this.f.poll()) != null) { +@@ -101,6 +109,7 @@ public class TickListServer implements TickList { + } + } + ++ this.timingTicking.stopTiming(); // Paper + this.e.getMethodProfiler().exit(); + this.g.clear(); + this.f.clear(); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 0cbebc2095489c240fecd3fd32f5373be2a3d684..1b03c69fa7ffeca4083470a179e18be828b0a957 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -70,7 +70,6 @@ import net.minecraft.server.level.WorldServer; + import net.minecraft.world.entity.item.EntityItem; + import net.minecraft.world.level.border.IWorldBorderListener; + import org.bukkit.Bukkit; +-import org.bukkit.craftbukkit.SpigotTimings; // Spigot + import org.bukkit.craftbukkit.CraftServer; + import org.bukkit.craftbukkit.CraftWorld; + import org.bukkit.craftbukkit.block.CapturedBlockState; +@@ -132,7 +131,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper + +- public final SpigotTimings.WorldTimingsHandler timings; // Spigot ++ public final co.aikar.timings.WorldTimingsHandler timings; // Paper + public static BlockPosition lastPhysicsProblem; // Spigot + private org.spigotmc.TickLimiter entityLimiter; + private org.spigotmc.TickLimiter tileLimiter; +@@ -217,7 +216,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public void c(WorldBorder worldborder, double d0) {} + }); + // CraftBukkit end +- timings = new SpigotTimings.WorldTimingsHandler(this); // Spigot - code below can generate new world and access timings ++ timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings + this.entityLimiter = new org.spigotmc.TickLimiter(spigotConfig.entityMaxTickTime); + this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); + } +@@ -797,15 +796,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + + timings.tileEntityPending.stopTiming(); // Spigot ++ co.aikar.timings.TimingHistory.tileEntityTicks += this.tileEntityListTick.size(); // Paper + gameprofilerfiller.exit(); + spigotConfig.currentPrimedTnt = 0; // Spigot + } + + public void a(Consumer consumer, Entity entity) { + try { +- SpigotTimings.tickEntityTimer.startTiming(); // Spigot + consumer.accept(entity); +- SpigotTimings.tickEntityTimer.stopTiming(); // Spigot + } catch (Throwable throwable) { + CrashReport crashreport = CrashReport.a(throwable, "Ticking entity"); + CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being ticked"); +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index bab55395ba92d0f3788e798ae0e154d62c4ec2fa..d285c4e3d9f938973bf7fb904680044b414e6236 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -61,6 +61,15 @@ public class Block extends BlockBase implements IMaterial { + }); + protected final BlockStateList blockStateList; + private IBlockData blockData; ++ // Paper start ++ public co.aikar.timings.Timing timing; ++ public co.aikar.timings.Timing getTiming() { ++ if (timing == null) { ++ timing = co.aikar.timings.MinecraftTimings.getBlockTiming(this); ++ } ++ return timing; ++ } ++ // Paper end + @Nullable + private String name; + @Nullable +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 8300bb425f7fc3fa8a5a8832a0bb432a2947793b..da39fcb22d7656eedb8bf7d0774f50018b9fb02b 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -22,10 +22,12 @@ import org.bukkit.inventory.InventoryHolder; + // CraftBukkit end + + import org.spigotmc.CustomTimingsHandler; // Spigot ++import co.aikar.timings.MinecraftTimings; // Paper ++import co.aikar.timings.Timing; // Paper + + public abstract class TileEntity implements net.minecraft.server.KeyedObject { // Paper + +- public CustomTimingsHandler tickTimer = org.bukkit.craftbukkit.SpigotTimings.getTileEntityTimings(this); // Spigot ++ public Timing tickTimer = MinecraftTimings.getTileEntityTimings(this); // Paper + // CraftBukkit start - data containers + private static final CraftPersistentDataTypeRegistry DATA_TYPE_REGISTRY = new CraftPersistentDataTypeRegistry(); + public CraftPersistentDataContainer persistentDataContainer; +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index acdcece38a4b30d6c89eb4342918ae8997db9f0b..ac576d268b23148089d404cb22d8c2f9d1a79d6e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -733,6 +733,7 @@ public class Chunk implements IChunkAccess { + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(this.bukkitChunk, this.needsDecoration)); + + if (this.needsDecoration) { ++ try (co.aikar.timings.Timing ignored = this.world.timings.chunkLoadPopulate.startTiming()) { // Paper + this.needsDecoration = false; + java.util.Random random = new java.util.Random(); + random.setSeed(world.getSeed()); +@@ -752,6 +753,7 @@ public class Chunk implements IChunkAccess { + } + } + server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkPopulateEvent(bukkitChunk)); ++ } // Paper + } + } + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 27703b807735d52313b93f8f606aa263571525d2..f301c7ba4b17b92c6cf2fcee6da1e67081dad4fa 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -1,5 +1,6 @@ + package net.minecraft.world.level.chunk.storage; + ++import co.aikar.timings.Timings; + import com.google.common.collect.Maps; + import it.unimi.dsi.fastutil.longs.LongOpenHashSet; + import it.unimi.dsi.fastutil.longs.LongSet; +@@ -446,7 +447,6 @@ public class ChunkRegionLoader { + private static void loadEntities(NBTTagCompound nbttagcompound, Chunk chunk) { + NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); + World world = chunk.getWorld(); +- world.timings.syncChunkLoadEntitiesTimer.startTiming(); // Spigot + + for (int i = 0; i < nbttaglist.size(); ++i) { + NBTTagCompound nbttagcompound1 = nbttaglist.getCompound(i); +@@ -458,8 +458,6 @@ public class ChunkRegionLoader { + chunk.d(true); + } + +- world.timings.syncChunkLoadEntitiesTimer.stopTiming(); // Spigot +- world.timings.syncChunkLoadTileEntitiesTimer.startTiming(); // Spigot + NBTTagList nbttaglist1 = nbttagcompound.getList("TileEntities", 10); + + for (int j = 0; j < nbttaglist1.size(); ++j) { +@@ -477,8 +475,6 @@ public class ChunkRegionLoader { + } + } + } +- world.timings.syncChunkLoadTileEntitiesTimer.stopTiming(); // Spigot +- + } + + private static NBTTagCompound a(ChunkCoordIntPair chunkcoordintpair, Map, StructureStart> map, Map, LongSet> map1) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9b3f9b11abe89cabb3044766dda60a8842c149f4..0e8de6b3a6acd37064209b6890270ae7f64e7f28 100644 +index bd62288b6951c6b5962497a3c93989cab5d66ad4..6d68610d8ffdef4357cf61ac2f4cf6bf54157b15 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2069,12 +2069,31 @@ public final class CraftServer implements Server { @@ -1845,17 +1848,17 @@ index 9b3f9b11abe89cabb3044766dda60a8842c149f4..0e8de6b3a6acd37064209b6890270ae7 public void restart() { org.spigotmc.RestartCommand.restart(); diff --git a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java -index 66523c21c49b8a019a82fdeb84a187c3b627ab73..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 +index ebf2c62e9ea126577a6cbcbbeb3f3aba259a1f63..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 --- a/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java +++ b/src/main/java/org/bukkit/craftbukkit/SpigotTimings.java @@ -1,163 +0,0 @@ -package org.bukkit.craftbukkit; - -import java.util.HashMap; --import net.minecraft.server.Entity; --import net.minecraft.server.TileEntity; --import net.minecraft.server.World; --import net.minecraft.server.WorldDataServer; +-import net.minecraft.world.entity.Entity; +-import net.minecraft.world.level.World; +-import net.minecraft.world.level.block.entity.TileEntity; +-import net.minecraft.world.level.storage.WorldDataServer; -import org.bukkit.craftbukkit.scheduler.CraftTask; -import org.bukkit.plugin.java.JavaPluginLoader; -import org.bukkit.scheduler.BukkitTask; @@ -2013,7 +2016,7 @@ index 66523c21c49b8a019a82fdeb84a187c3b627ab73..e69de29bb2d1d6434b8b29ae775ad8c2 - } -} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 4ffc8442d559c9bef818011667ac091745575b1d..4bfdd900bae4c886360b24fcc8563e1d2e73ebf0 100644 +index 97387235e883fd53950a88c244ac1bc9b24ec225..597b3b061c707081e7665d5896f5d73676e691d6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1803,6 +1803,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2208,7 +2211,7 @@ index e52ef47b783785dc214746b678e7b549aea9a274..3d90b3426873a3528af14f7f1ab0adae this.value = value; } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6194d8aac0d2e54958aad3fb8b5fe144451cf879..d63a160f1b00de8d67ae1eb4fefbd5ca06835de7 100644 +index 972840fd32cd4b6cb73b7f97d06dcd5699c28ba4..65131f0977fa55c4761c34ce52720170feb61a72 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -158,6 +158,12 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -2239,13 +2242,13 @@ index 6194d8aac0d2e54958aad3fb8b5fe144451cf879..d63a160f1b00de8d67ae1eb4fefbd5ca * This helper class represents the different NBT Tags. *

diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 383997d2e57a31e2ff30cf1bf34128fe477390a8..093a11b6e355f9e1236ecca921ea55488d70451d 100644 +index 44a7323ffbdf91f8e0672e0fadf0d3d26ed9a290..69c5d4e51ebf747d931fadc819973e36f001f5bc 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -29,7 +29,7 @@ import net.minecraft.server.EntityWither; - import net.minecraft.server.MathHelper; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.World; +@@ -29,7 +29,7 @@ import net.minecraft.world.entity.raid.EntityRaider; + import net.minecraft.world.level.World; + import net.minecraft.world.level.chunk.Chunk; + import net.minecraft.world.phys.AxisAlignedBB; -import org.bukkit.craftbukkit.SpigotTimings; +import co.aikar.timings.MinecraftTimings; diff --git a/Spigot-Server-Patches/0010-Adventure.patch b/Spigot-Server-Patches/0010-Adventure.patch index 24227cd785..78af38078b 100644 --- a/Spigot-Server-Patches/0010-Adventure.patch +++ b/Spigot-Server-Patches/0010-Adventure.patch @@ -22,7 +22,7 @@ index 1d03a79e9010bc514b72a81ba0ad4a62aeff1bb7..429b74474ced04d8dd8f038b8590b8df } diff --git a/src/main/java/io/papermc/paper/adventure/AdventureComponent.java b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java new file mode 100644 -index 0000000000000000000000000000000000000000..a2acd31dce4461338a8baa96e03df36a4b4281b8 +index 0000000000000000000000000000000000000000..dd018bb835e1b9fb2496404e1e5b10389fe6176d --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/AdventureComponent.java @@ -0,0 +1,78 @@ @@ -36,9 +36,9 @@ index 0000000000000000000000000000000000000000..a2acd31dce4461338a8baa96e03df36a +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; -+import net.minecraft.server.ChatModifier; -+import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.IChatMutableComponent; ++import net.minecraft.network.chat.ChatModifier; ++import net.minecraft.network.chat.IChatBaseComponent; ++import net.minecraft.network.chat.IChatMutableComponent; +import org.checkerframework.checker.nullness.qual.MonotonicNonNull; +import org.checkerframework.checker.nullness.qual.Nullable; + @@ -123,9 +123,11 @@ index 0000000000000000000000000000000000000000..aa509a1f382991e0f5683b75b0af4094 +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.TextReplacementConfig; +import net.kyori.adventure.text.event.ClickEvent; -+import net.minecraft.server.EntityPlayer; -+import net.minecraft.server.IChatBaseComponent; ++import net.kyori.adventure.text.format.Style; ++import net.kyori.adventure.text.format.TextDecoration; ++import net.minecraft.network.chat.IChatBaseComponent; +import net.minecraft.server.MinecraftServer; ++import net.minecraft.server.level.EntityPlayer; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.entity.CraftPlayer; +import org.bukkit.craftbukkit.util.LazyPlayerSet; @@ -323,13 +325,13 @@ index 0000000000000000000000000000000000000000..aa509a1f382991e0f5683b75b0af4094 +} diff --git a/src/main/java/io/papermc/paper/adventure/DisplayNames.java b/src/main/java/io/papermc/paper/adventure/DisplayNames.java new file mode 100644 -index 0000000000000000000000000000000000000000..48eedc4e7804d9d6986745ec8028f579701a2736 +index 0000000000000000000000000000000000000000..b1d9d6276eb577ed3c66df1f89b3266d2c48eaf2 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/DisplayNames.java @@ -0,0 +1,22 @@ +package io.papermc.paper.adventure; + -+import net.minecraft.server.EntityPlayer; ++import net.minecraft.server.level.EntityPlayer; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.entity.CraftPlayer; + @@ -351,7 +353,7 @@ index 0000000000000000000000000000000000000000..48eedc4e7804d9d6986745ec8028f579 +} diff --git a/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java b/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java new file mode 100644 -index 0000000000000000000000000000000000000000..64fcc77eb2ce8979ae756696d98f1d3a91326ba6 +index 0000000000000000000000000000000000000000..caa9708f321f04cd02534161231c05999bda4acd --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/NBTLegacyHoverEventSerializer.java @@ -0,0 +1,88 @@ @@ -367,9 +369,9 @@ index 0000000000000000000000000000000000000000..64fcc77eb2ce8979ae756696d98f1d3a +import net.kyori.adventure.text.serializer.gson.LegacyHoverEventSerializer; +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.util.Codec; -+import net.minecraft.server.MojangsonParser; -+import net.minecraft.server.NBTBase; -+import net.minecraft.server.NBTTagCompound; ++import net.minecraft.nbt.MojangsonParser; ++import net.minecraft.nbt.NBTBase; ++import net.minecraft.nbt.NBTTagCompound; + +final class NBTLegacyHoverEventSerializer implements LegacyHoverEventSerializer { + public static final NBTLegacyHoverEventSerializer INSTANCE = new NBTLegacyHoverEventSerializer(); @@ -445,7 +447,7 @@ index 0000000000000000000000000000000000000000..64fcc77eb2ce8979ae756696d98f1d3a +} diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java new file mode 100644 -index 0000000000000000000000000000000000000000..c45d48cef53476fa1602cebaa57c72894bba10d3 +index 0000000000000000000000000000000000000000..71938ad7b3494e803beca7e4022aad12a51f2096 --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java @@ -0,0 +1,340 @@ @@ -473,17 +475,17 @@ index 0000000000000000000000000000000000000000..c45d48cef53476fa1602cebaa57c7289 +import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; +import net.kyori.adventure.translation.GlobalTranslator; +import net.kyori.adventure.util.Codec; -+import net.minecraft.server.BossBattle; -+import net.minecraft.server.EnumChatFormat; -+import net.minecraft.server.IChatBaseComponent; -+import net.minecraft.server.ItemStack; -+import net.minecraft.server.LocaleLanguage; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.MojangsonParser; -+import net.minecraft.server.NBTTagCompound; -+import net.minecraft.server.NBTTagList; -+import net.minecraft.server.NBTTagString; -+import net.minecraft.server.SoundCategory; ++import net.minecraft.EnumChatFormat; ++import net.minecraft.locale.LocaleLanguage; ++import net.minecraft.nbt.MojangsonParser; ++import net.minecraft.nbt.NBTTagCompound; ++import net.minecraft.nbt.NBTTagList; ++import net.minecraft.nbt.NBTTagString; ++import net.minecraft.network.chat.IChatBaseComponent; ++import net.minecraft.resources.MinecraftKey; ++import net.minecraft.sounds.SoundCategory; ++import net.minecraft.world.BossBattle; ++import net.minecraft.world.item.ItemStack; +import org.bukkit.ChatColor; +import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.Nullable; @@ -717,7 +719,7 @@ index 0000000000000000000000000000000000000000..c45d48cef53476fa1602cebaa57c7289 + // Book + + public static ItemStack asItemStack(final Book book, final Locale locale) { -+ final ItemStack item = new ItemStack(net.minecraft.server.Items.WRITTEN_BOOK, 1); ++ final ItemStack item = new ItemStack(net.minecraft.world.item.Items.WRITTEN_BOOK, 1); + final NBTTagCompound tag = item.getOrCreateTag(); + tag.setString("title", asJsonString(book.title(), locale)); + tag.setString("author", asJsonString(book.author(), locale)); @@ -791,7 +793,7 @@ index 0000000000000000000000000000000000000000..c45d48cef53476fa1602cebaa57c7289 +} diff --git a/src/main/java/io/papermc/paper/adventure/VanillaBossBarListener.java b/src/main/java/io/papermc/paper/adventure/VanillaBossBarListener.java new file mode 100644 -index 0000000000000000000000000000000000000000..59dd2a453dbfc538431a3414ab35d183cff0faec +index 0000000000000000000000000000000000000000..3a4158781e464d9a860bab72ed719a41929c8add --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/VanillaBossBarListener.java @@ -0,0 +1,41 @@ @@ -801,7 +803,7 @@ index 0000000000000000000000000000000000000000..59dd2a453dbfc538431a3414ab35d183 +import java.util.function.Consumer; +import net.kyori.adventure.bossbar.BossBar; +import net.kyori.adventure.text.Component; -+import net.minecraft.server.PacketPlayOutBoss; ++import net.minecraft.network.protocol.game.PacketPlayOutBoss; +import org.checkerframework.checker.nullness.qual.NonNull; + +public final class VanillaBossBarListener implements BossBar.Listener { @@ -838,7 +840,7 @@ index 0000000000000000000000000000000000000000..59dd2a453dbfc538431a3414ab35d183 +} diff --git a/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java new file mode 100644 -index 0000000000000000000000000000000000000000..1de7376cd4d3601f39d1f73b143c4244fe8480a3 +index 0000000000000000000000000000000000000000..625b57a4274d6348a85897b92ff07fee7ae3a7ab --- /dev/null +++ b/src/main/java/io/papermc/paper/adventure/WrapperAwareSerializer.java @@ -0,0 +1,20 @@ @@ -846,7 +848,7 @@ index 0000000000000000000000000000000000000000..1de7376cd4d3601f39d1f73b143c4244 + +import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.serializer.ComponentSerializer; -+import net.minecraft.server.IChatBaseComponent; ++import net.minecraft.network.chat.IChatBaseComponent; + +final class WrapperAwareSerializer implements ComponentSerializer { + @Override @@ -864,7 +866,7 @@ index 0000000000000000000000000000000000000000..1de7376cd4d3601f39d1f73b143c4244 +} diff --git a/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java b/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java new file mode 100644 -index 0000000000000000000000000000000000000000..7aacbd4cdd538f9676d8370a6baba81772efb6f5 +index 0000000000000000000000000000000000000000..b3e26b9ecca7055760d05975d36c9ae74e0d7d4b --- /dev/null +++ b/src/main/java/net/kyori/adventure/bossbar/HackyBossBarPlatformBridge.java @@ -0,0 +1,36 @@ @@ -872,7 +874,7 @@ index 0000000000000000000000000000000000000000..7aacbd4cdd538f9676d8370a6baba817 + +import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.VanillaBossBarListener; -+import net.minecraft.server.BossBattleServer; ++import net.minecraft.server.level.BossBattleServer; +import org.bukkit.craftbukkit.entity.CraftPlayer; + +public abstract class HackyBossBarPlatformBridge { @@ -904,18 +906,608 @@ index 0000000000000000000000000000000000000000..7aacbd4cdd538f9676d8370a6baba817 + } + } +} -diff --git a/src/main/java/net/minecraft/server/BossBattle.java b/src/main/java/net/minecraft/server/BossBattle.java -index 715c6d9f4820f700cb931f549756d2af2005667b..04477938aeae32b221c15c3491fb9a80248eebb5 100644 ---- a/src/main/java/net/minecraft/server/BossBattle.java -+++ b/src/main/java/net/minecraft/server/BossBattle.java +diff --git a/src/main/java/net/minecraft/EnumChatFormat.java b/src/main/java/net/minecraft/EnumChatFormat.java +index 75e38f05c10713f773a8763100dfc0777521dba6..cd93f99e939438c572a4258d299a6038ebfc60a8 100644 +--- a/src/main/java/net/minecraft/EnumChatFormat.java ++++ b/src/main/java/net/minecraft/EnumChatFormat.java +@@ -61,6 +61,7 @@ public enum EnumChatFormat { + return !this.A && this != EnumChatFormat.RESET; + } + ++ @Nullable public Integer getHexValue() { return this.e(); } // Paper - OBFHELPER + @Nullable + public Integer e() { + return this.D; +@@ -84,6 +85,18 @@ public enum EnumChatFormat { + return s == null ? null : (EnumChatFormat) EnumChatFormat.w.get(c(s)); + } + ++ // Paper start ++ @Nullable public static EnumChatFormat getByHexValue(int i) { ++ for (EnumChatFormat value : values()) { ++ if (value.getHexValue() != null && value.getHexValue() == i) { ++ return value; ++ } ++ } ++ ++ return null; ++ } ++ // Paper end ++ + @Nullable + public static EnumChatFormat a(int i) { + if (i < 0) { +diff --git a/src/main/java/net/minecraft/nbt/NBTTagString.java b/src/main/java/net/minecraft/nbt/NBTTagString.java +index e26ef49d9dde8ed0fb4267b48cb597563967f313..0e41fdb6ba711fbd2240d62e2030b3a12e14c8d6 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagString.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagString.java +@@ -43,6 +43,7 @@ public class NBTTagString implements NBTBase { + this.data = s; + } + ++ public static NBTTagString create(final String value) { return a(value); } // Paper - OBFHELPER + public static NBTTagString a(String s) { + return s.isEmpty() ? NBTTagString.b : new NBTTagString(s); + } +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java +index 5413bf93f7f0f4491fca1f07c47a925fdace7751..5f1c5dd7902f6cff5acae05e8c6bf58a1ba5bdf1 100644 +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -10,6 +10,7 @@ import io.netty.buffer.ByteBufOutputStream; + import io.netty.handler.codec.DecoderException; + import io.netty.handler.codec.EncoderException; + import io.netty.util.ByteProcessor; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import java.io.DataInput; + import java.io.DataOutput; + import java.io.IOException; +@@ -44,6 +45,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit + public class PacketDataSerializer extends ByteBuf { + + private final ByteBuf a; ++ public java.util.Locale adventure$locale; // Paper + + public PacketDataSerializer(ByteBuf bytebuf) { + this.a = bytebuf; +@@ -165,8 +167,15 @@ public class PacketDataSerializer extends ByteBuf { + return IChatBaseComponent.ChatSerializer.a(this.e(262144)); + } + ++ // Paper start ++ public PacketDataSerializer writeComponent(final net.kyori.adventure.text.Component component) { ++ return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); ++ } ++ // Paper end ++ + public PacketDataSerializer a(IChatBaseComponent ichatbasecomponent) { +- return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); ++ //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment ++ return this.writeUtf(PaperAdventure.asJsonString(ichatbasecomponent, this.adventure$locale), 262144); // Paper + } + + public > T a(Class oclass) { +@@ -349,6 +358,7 @@ public class PacketDataSerializer extends ByteBuf { + return this.a(s, 32767); + } + ++ public PacketDataSerializer writeUtf(final String string, final int maxLength) { return this.a(string, maxLength); } // Paper - OBFHELPER + public PacketDataSerializer a(String s, int i) { + byte[] abyte = s.getBytes(StandardCharsets.UTF_8); + +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java +index dc8cc8d6c00176c8562086282f726dc1b24b2c65..2f6da89d6b25ba5144ec15b1bf0e8ed13278e85e 100644 +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java +@@ -3,6 +3,7 @@ package net.minecraft.network; + import io.netty.buffer.ByteBuf; + import io.netty.channel.ChannelHandlerContext; + import io.netty.handler.codec.MessageToByteEncoder; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import java.io.IOException; + import net.minecraft.network.protocol.EnumProtocolDirection; + import net.minecraft.network.protocol.Packet; +@@ -37,6 +38,7 @@ public class PacketEncoder extends MessageToByteEncoder> { + throw new IOException("Can't serialize unregistered packet"); + } else { + PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); ++ packetdataserializer.adventure$locale = channelhandlercontext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper + + packetdataserializer.d(integer); + +diff --git a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java +index 85140d961722e86abfe7006a0ad752751e73c721..c7c191b0a9889450fdf495f5aa45d59f159f1401 100644 +--- a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java ++++ b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.network.chat; + ++import io.papermc.paper.adventure.AdventureComponent; // Paper + import com.google.gson.Gson; + import com.google.gson.GsonBuilder; + import com.google.gson.JsonArray; +@@ -111,6 +112,7 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable { + + private IChatBaseComponent a; ++ public net.kyori.adventure.text.Component adventure$message; // Paper + public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot + private ChatMessageType b; + private UUID c; +@@ -31,6 +32,11 @@ public class PacketPlayOutChat implements Packet { + + @Override + public void b(PacketDataSerializer packetdataserializer) throws IOException { ++ // Paper start ++ if (this.adventure$message != null) { ++ packetdataserializer.writeComponent(this.adventure$message); ++ } else ++ // Paper end + // Spigot start + if (components != null) { + packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java +index 0268b8e6595ee919bcd55a74ba872a2b7d2a17d8..4ff73a4fc5e8a8739e57d2bac65076812cbe5132 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutPlayerListHeaderFooter.java +@@ -9,6 +9,10 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet { + + private PacketPlayOutTitle.EnumTitleAction a; + private IChatBaseComponent b; ++ public net.kyori.adventure.text.Component adventure$text; // Paper + private int c; + private int d; + private int e; +@@ -51,6 +52,11 @@ public class PacketPlayOutTitle implements Packet { + public void b(PacketDataSerializer packetdataserializer) throws IOException { + packetdataserializer.a((Enum) this.a); + if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) { ++ // Paper start ++ if (this.adventure$text != null) { ++ packetdataserializer.writeComponent(this.adventure$text); ++ } else ++ // Paper end + packetdataserializer.a(this.b); + } + +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index e818bf022b74cae34a512d8c98b47ec3e5c74b9a..0ff92d701d6ee5ce56eec624eece11de15195b41 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -143,6 +143,7 @@ import net.minecraft.world.item.enchantment.EnchantmentManager; + import net.minecraft.world.level.block.BlockChest; + import net.minecraft.world.level.dimension.DimensionManager; + import net.minecraft.world.scores.Scoreboard; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import org.bukkit.Bukkit; + import org.bukkit.GameMode; + import org.bukkit.Location; +@@ -211,6 +212,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + // CraftBukkit start + public String displayName; ++ public net.kyori.adventure.text.Component adventure$displayName; // Paper + public IChatBaseComponent listName; + public org.bukkit.Location compassTarget; + public int newExp = 0; +@@ -241,6 +243,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + // CraftBukkit start + this.displayName = this.getName(); ++ this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getName()); // Paper + this.canPickUpLoot = true; + this.maxHealthCache = this.getMaxHealth(); + } +@@ -694,23 +697,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); + +- String deathmessage = defaultMessage.getString(); +- org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); ++ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure + + // SPIGOT-943 - only call if they have an inventory open + if (this.activeContainer != this.defaultContainer) { + this.closeInventory(); + } + +- String deathMessage = event.getDeathMessage(); ++ net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure + +- if (deathMessage != null && deathMessage.length() > 0 && flag) { // TODO: allow plugins to override? +- IChatBaseComponent ichatbasecomponent; +- if (deathMessage.equals(deathmessage)) { +- ichatbasecomponent = this.getCombatTracker().getDeathMessage(); +- } else { +- ichatbasecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromStringOrNull(deathMessage); +- } ++ if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override? ++ IChatBaseComponent ichatbasecomponent = PaperAdventure.asVanilla(deathMessage); // Paper - Adventure + + this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> { + if (!future.isSuccess()) { +@@ -1682,6 +1679,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + + public String locale = "en_us"; // CraftBukkit - add, lowercase ++ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper + public void a(PacketPlayInSettings packetplayinsettings) { + // CraftBukkit start + if (getMainHand() != packetplayinsettings.getMainHand()) { +@@ -1693,6 +1691,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + this.server.server.getPluginManager().callEvent(event); + } + this.locale = packetplayinsettings.locale; ++ // Paper start ++ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.locale); ++ this.playerConnection.networkManager.channel.attr(PaperAdventure.LOCALE_ATTRIBUTE).set(this.adventure$locale); ++ // Paper end + this.clientViewDistance = packetplayinsettings.viewDistance; + // CraftBukkit end + this.bY = packetplayinsettings.d(); +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 49f6b20ceee1b58e66e72d161d20226fa17850fd..c4e3dd34c20c97ae1397cf51125f51a5b77d9437 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -37,6 +37,7 @@ import org.apache.logging.log4j.Logger; + + // CraftBukkit start + import net.minecraft.network.chat.ChatComponentText; ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import org.bukkit.craftbukkit.util.Waitable; + import org.bukkit.event.player.AsyncPlayerPreLoginEvent; + import org.bukkit.event.player.PlayerPreLoginEvent; +@@ -300,7 +301,7 @@ public class LoginListener implements PacketLoginInListener { + if (PlayerPreLoginEvent.getHandlerList().getRegisteredListeners().length != 0) { + final PlayerPreLoginEvent event = new PlayerPreLoginEvent(playerName, address, uniqueId); + if (asyncEvent.getResult() != PlayerPreLoginEvent.Result.ALLOWED) { +- event.disallow(asyncEvent.getResult(), asyncEvent.getKickMessage()); ++ event.disallow(asyncEvent.getResult(), asyncEvent.kickMessage()); // Paper - Adventure + } + Waitable waitable = new Waitable() { + @Override +@@ -311,12 +312,12 @@ public class LoginListener implements PacketLoginInListener { + + LoginListener.this.server.processQueue.add(waitable); + if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { +- disconnect(event.getKickMessage()); ++ disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure + return; + } + } else { + if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { +- disconnect(asyncEvent.getKickMessage()); ++ disconnect(PaperAdventure.asVanilla(asyncEvent.kickMessage())); // Paper - Adventure + return; + } + } +diff --git a/src/main/java/net/minecraft/server/network/PacketStatusListener.java b/src/main/java/net/minecraft/server/network/PacketStatusListener.java +index 2a96564c1656d42a74c331a6178e511cd5347a66..d219eda271a71f786808a6958b829fca40a1aaba 100644 +--- a/src/main/java/net/minecraft/server/network/PacketStatusListener.java ++++ b/src/main/java/net/minecraft/server/network/PacketStatusListener.java +@@ -56,7 +56,7 @@ public class PacketStatusListener implements PacketStatusInListener { + CraftIconCache icon = minecraftServer.server.getServerIcon(); + + ServerListPingEvent() { +- super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.getMotd(), minecraftServer.getPlayerList().getMaxPlayers()); ++ super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.server.motd(), minecraftServer.getPlayerList().getMaxPlayers()); // Paper - Adventure + } + + @Override +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index db155011112aba2b1e3ec5b337db25dfb7b511fb..c417250f66805788d63434e2c360349a39996176 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -159,6 +159,8 @@ import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + + // CraftBukkit start ++import io.papermc.paper.adventure.ChatProcessor; // Paper ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import java.util.concurrent.ExecutionException; + import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; + import net.minecraft.network.protocol.game.PacketPlayOutAttachEntity; +@@ -388,21 +390,24 @@ public class PlayerConnection implements PacketListenerPlayIn { + return this.minecraftServer.a(this.player.getProfile()); + } + +- // CraftBukkit start +- @Deprecated +- public void disconnect(IChatBaseComponent ichatbasecomponent) { +- disconnect(CraftChatMessage.fromComponent(ichatbasecomponent)); ++ public void disconnect(String s) { ++ // Paper start ++ this.disconnect(PaperAdventure.LEGACY_SECTION_UXRC.deserialize(s)); + } +- // CraftBukkit end + +- public void disconnect(String s) { ++ public void disconnect(final IChatBaseComponent reason) { ++ this.disconnect(PaperAdventure.asAdventure(reason)); ++ } ++ ++ public void disconnect(net.kyori.adventure.text.Component reason) { ++ // Paper end + // CraftBukkit start - fire PlayerKickEvent + if (this.processedDisconnect) { + return; + } +- String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game."; ++ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, this.player.getBukkitEntity().displayName()); // Paper - Adventure + +- PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage); ++ PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), reason, leaveMessage); // Paper - Adventure + + if (this.server.getServer().isRunning()) { + this.server.getPluginManager().callEvent(event); +@@ -413,8 +418,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + return; + } + // Send the possibly modified leave message +- s = event.getReason(); +- final IChatBaseComponent ichatbasecomponent = CraftChatMessage.fromString(s, true)[0]; ++ final IChatBaseComponent ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure + // CraftBukkit end + + this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(ichatbasecomponent), (future) -> { +@@ -1630,9 +1634,11 @@ public class PlayerConnection implements PacketListenerPlayIn { + */ + + this.player.p(); +- String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); +- if ((quitMessage != null) && (quitMessage.length() > 0)) { +- this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage)); ++ // Paper start - Adventure ++ net.kyori.adventure.text.Component quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); ++ if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) { ++ this.minecraftServer.getPlayerList().sendMessage(PaperAdventure.asVanilla(quitMessage)); ++ // Paper end + } + // CraftBukkit end + ITextFilter itextfilter = this.player.Q(); +@@ -1848,8 +1854,13 @@ public class PlayerConnection implements PacketListenerPlayIn { + this.handleCommand(s); + } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { + // Do nothing, this is coming from a plugin +- } else { +- Player player = this.getPlayer(); ++ // Paper start ++ } else if (true) { ++ final ChatProcessor cp = new ChatProcessor(this.minecraftServer, this.player, s, async); ++ cp.process(); ++ // Paper end ++ } else if (false) { // Paper ++ Player player = this.getPlayer(); // Paper + AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(minecraftServer)); + this.server.getPluginManager().callEvent(event); + +@@ -2656,21 +2667,20 @@ public class PlayerConnection implements PacketListenerPlayIn { + return; + } + +- // CraftBukkit start +- Player player = this.server.getPlayer(this.player); +- int x = packetplayinupdatesign.b().getX(); +- int y = packetplayinupdatesign.b().getY(); +- int z = packetplayinupdatesign.b().getZ(); +- String[] lines = new String[4]; ++ // CraftBukkit start // Paper start - Adventure ++ List lines = new java.util.ArrayList<>(); + + for (int i = 0; i < list.size(); ++i) { +- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString()); ++ lines.add(net.kyori.adventure.text.Component.text(list.get(i))); + } +- SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); ++ SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines); + this.server.getPluginManager().callEvent(event); + + if (!event.isCancelled()) { +- System.arraycopy(org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines()), 0, tileentitysign.lines, 0, 4); ++ for (int i = 0; i < 4; i++) { ++ tileentitysign.a(i, PaperAdventure.asVanilla(event.line(i))); ++ } ++ // Paper end + tileentitysign.isEditable = false; + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index c601a5c577e438a3fa8dd4c5f36dbe9494b03d52..15418868c2b92498139e66d913ee1c35b3abf0cf 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile; + import com.mojang.serialization.DataResult; + import com.mojang.serialization.Dynamic; + import io.netty.buffer.Unpooled; ++import io.papermc.paper.adventure.PaperAdventure; + import java.io.File; + import java.net.SocketAddress; + import java.text.SimpleDateFormat; +@@ -92,6 +93,7 @@ import org.apache.logging.log4j.LogManager; + import org.apache.logging.log4j.Logger; + + // CraftBukkit start ++import io.papermc.paper.adventure.PaperAdventure; // Paper + import com.google.common.base.Predicate; + import com.google.common.collect.Iterables; + +@@ -255,7 +257,7 @@ public abstract class PlayerList { + } + // CraftBukkit start + chatmessage.a(EnumChatFormat.YELLOW); +- String joinMessage = CraftChatMessage.fromComponent(chatmessage); ++ IChatBaseComponent joinMessage = chatmessage; // Paper - Adventure + + playerconnection.a(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch); + this.players.add(entityplayer); +@@ -264,19 +266,18 @@ public abstract class PlayerList { + // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below + + // CraftBukkit start +- PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage); ++ PlayerJoinEvent playerJoinEvent = new org.bukkit.event.player.PlayerJoinEvent(cserver.getPlayer(entityplayer), PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure + cserver.getPluginManager().callEvent(playerJoinEvent); + + if (!entityplayer.playerConnection.networkManager.isConnected()) { + return; + } + +- joinMessage = playerJoinEvent.getJoinMessage(); ++ final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); + +- if (joinMessage != null && joinMessage.length() > 0) { +- for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) { +- server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b)); +- } ++ if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure ++ joinMessage = PaperAdventure.asVanilla(jm); // Paper - Adventure ++ server.getPlayerList().sendAll(new PacketPlayOutChat(joinMessage, ChatMessageType.SYSTEM, SystemUtils.b)); // Paper - Adventure + } + // CraftBukkit end + +@@ -473,7 +474,7 @@ public abstract class PlayerList { + + } + +- public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string ++ public net.kyori.adventure.text.Component disconnect(EntityPlayer entityplayer) { // Paper - return Component + WorldServer worldserver = entityplayer.getWorldServer(); + + entityplayer.a(StatisticList.LEAVE_GAME); +@@ -484,7 +485,7 @@ public abstract class PlayerList { + entityplayer.closeInventory(); + } + +- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game"); ++ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getName()))); + cserver.getPluginManager().callEvent(playerQuitEvent); + entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); + +@@ -545,7 +546,7 @@ public abstract class PlayerList { + cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); + // CraftBukkit end + +- return playerQuitEvent.getQuitMessage(); // CraftBukkit ++ return playerQuitEvent.quitMessage(); // Paper - Adventure + } + + // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer +@@ -591,10 +592,10 @@ public abstract class PlayerList { + } + + // return chatmessage; +- if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot ++ if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure + } else if (!this.isWhitelisted(gameprofile)) { + chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); +- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot ++ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure + } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { + IpBanEntry ipbanentry = this.l.get(socketaddress); + +@@ -604,17 +605,17 @@ public abstract class PlayerList { + } + + // return chatmessage; +- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); ++ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure + } else { + // return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null; + if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) { +- event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot ++ event.disallow(PlayerLoginEvent.Result.KICK_FULL, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure + } + } + + cserver.getPluginManager().callEvent(event); + if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { +- loginlistener.disconnect(event.getKickMessage()); ++ loginlistener.disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure + return null; + } + return entity; +@@ -1135,7 +1136,7 @@ public abstract class PlayerList { + public void shutdown() { + // CraftBukkit start - disconnect safely + for (EntityPlayer player : this.players) { +- player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message ++ player.playerConnection.disconnect(PaperAdventure.asVanilla(this.server.server.shutdownMessage())); // CraftBukkit - add custom shutdown message // Paper - Adventure + } + // CraftBukkit end + +diff --git a/src/main/java/net/minecraft/world/BossBattle.java b/src/main/java/net/minecraft/world/BossBattle.java +index f9154b306379c45f15fe55406aaa00351b0471e8..1fb9fea7683075f427edfa411c7747d60928d537 100644 +--- a/src/main/java/net/minecraft/world/BossBattle.java ++++ b/src/main/java/net/minecraft/world/BossBattle.java +@@ -1,5 +1,6 @@ + package net.minecraft.world; +import io.papermc.paper.adventure.PaperAdventure; import java.util.UUID; - - public abstract class BossBattle { -@@ -12,6 +13,7 @@ public abstract class BossBattle { + import net.minecraft.EnumChatFormat; + import net.minecraft.network.chat.IChatBaseComponent; +@@ -14,6 +15,7 @@ public abstract class BossBattle { protected boolean e; protected boolean f; protected boolean g; @@ -923,7 +1515,7 @@ index 715c6d9f4820f700cb931f549756d2af2005667b..04477938aeae32b221c15c3491fb9a80 public BossBattle(UUID uuid, IChatBaseComponent ichatbasecomponent, BossBattle.BarColor bossbattle_barcolor, BossBattle.BarStyle bossbattle_barstyle) { this.h = uuid; -@@ -26,61 +28,75 @@ public abstract class BossBattle { +@@ -28,61 +30,75 @@ public abstract class BossBattle { } public IChatBaseComponent j() { @@ -999,11 +1591,11 @@ index 715c6d9f4820f700cb931f549756d2af2005667b..04477938aeae32b221c15c3491fb9a80 return this.g; } -diff --git a/src/main/java/net/minecraft/server/Enchantment.java b/src/main/java/net/minecraft/server/Enchantment.java -index 7e2162fc78168adb96ed20651e1a3e061c29f96d..8e94a62916574bc2e5e93c5cf2e5ea7950d61e2e 100644 ---- a/src/main/java/net/minecraft/server/Enchantment.java -+++ b/src/main/java/net/minecraft/server/Enchantment.java -@@ -83,6 +83,7 @@ public abstract class Enchantment { +diff --git a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java +index 0134bbda9e6fc900b7eefa05442e25539bab3431..b76ef55145336cc8dc4857b79767f5a738ad5144 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/Enchantment.java +@@ -94,6 +94,7 @@ public abstract class Enchantment { return this.f(); } @@ -1011,601 +1603,11 @@ index 7e2162fc78168adb96ed20651e1a3e061c29f96d..8e94a62916574bc2e5e93c5cf2e5ea79 public IChatBaseComponent d(int i) { ChatMessage chatmessage = new ChatMessage(this.g()); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 37a84b44a46e1490f7b79839b04aef012ddc9fa3..a48b6b292c3472f3ac484eb9fba60a63c3c5625e 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -16,6 +16,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - - // CraftBukkit start -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import org.bukkit.Bukkit; - import org.bukkit.GameMode; - import org.bukkit.Location; -@@ -84,6 +85,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - // CraftBukkit start - public String displayName; -+ public net.kyori.adventure.text.Component adventure$displayName; // Paper - public IChatBaseComponent listName; - public org.bukkit.Location compassTarget; - public int newExp = 0; -@@ -114,6 +116,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - // CraftBukkit start - this.displayName = this.getName(); -+ this.adventure$displayName = net.kyori.adventure.text.Component.text(this.getName()); // Paper - this.canPickUpLoot = true; - this.maxHealthCache = this.getMaxHealth(); - } -@@ -567,23 +570,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); - -- String deathmessage = defaultMessage.getString(); -- org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, deathmessage, keepInventory); -+ org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure - - // SPIGOT-943 - only call if they have an inventory open - if (this.activeContainer != this.defaultContainer) { - this.closeInventory(); - } - -- String deathMessage = event.getDeathMessage(); -+ net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure - -- if (deathMessage != null && deathMessage.length() > 0 && flag) { // TODO: allow plugins to override? -- IChatBaseComponent ichatbasecomponent; -- if (deathMessage.equals(deathmessage)) { -- ichatbasecomponent = this.getCombatTracker().getDeathMessage(); -- } else { -- ichatbasecomponent = org.bukkit.craftbukkit.util.CraftChatMessage.fromStringOrNull(deathMessage); -- } -+ if (deathMessage != null && deathMessage != net.kyori.adventure.text.Component.empty() && flag) { // Paper - Adventure // TODO: allow plugins to override? -+ IChatBaseComponent ichatbasecomponent = PaperAdventure.asVanilla(deathMessage); // Paper - Adventure - - this.playerConnection.a((Packet) (new PacketPlayOutCombatEvent(this.getCombatTracker(), PacketPlayOutCombatEvent.EnumCombatEventType.ENTITY_DIED, ichatbasecomponent)), (future) -> { - if (!future.isSuccess()) { -@@ -1555,6 +1552,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - - public String locale = "en_us"; // CraftBukkit - add, lowercase -+ public java.util.Locale adventure$locale = java.util.Locale.US; // Paper - public void a(PacketPlayInSettings packetplayinsettings) { - // CraftBukkit start - if (getMainHand() != packetplayinsettings.getMainHand()) { -@@ -1566,6 +1564,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - this.server.server.getPluginManager().callEvent(event); - } - this.locale = packetplayinsettings.locale; -+ // Paper start -+ this.adventure$locale = net.kyori.adventure.translation.Translator.parseLocale(this.locale); -+ this.playerConnection.networkManager.channel.attr(PaperAdventure.LOCALE_ATTRIBUTE).set(this.adventure$locale); -+ // Paper end - this.clientViewDistance = packetplayinsettings.viewDistance; - // CraftBukkit end - this.bY = packetplayinsettings.d(); -diff --git a/src/main/java/net/minecraft/server/EnumChatFormat.java b/src/main/java/net/minecraft/server/EnumChatFormat.java -index 68a5a0cbe88795f59ce96035da45371a5a366f5a..c186af518ef43e9efaf086233e1da8a1cf293c66 100644 ---- a/src/main/java/net/minecraft/server/EnumChatFormat.java -+++ b/src/main/java/net/minecraft/server/EnumChatFormat.java -@@ -61,6 +61,7 @@ public enum EnumChatFormat { - return !this.A && this != EnumChatFormat.RESET; - } - -+ @Nullable public Integer getHexValue() { return this.e(); } // Paper - OBFHELPER - @Nullable - public Integer e() { - return this.D; -@@ -84,6 +85,18 @@ public enum EnumChatFormat { - return s == null ? null : (EnumChatFormat) EnumChatFormat.w.get(c(s)); - } - -+ // Paper start -+ @Nullable public static EnumChatFormat getByHexValue(int i) { -+ for (EnumChatFormat value : values()) { -+ if (value.getHexValue() != null && value.getHexValue() == i) { -+ return value; -+ } -+ } -+ -+ return null; -+ } -+ // Paper end -+ - @Nullable - public static EnumChatFormat a(int i) { - if (i < 0) { -diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java -index e312078162c7132635995aa47237df0b495d9320..921fe6399745318c18570360fb438c45762b1b8e 100644 ---- a/src/main/java/net/minecraft/server/IChatBaseComponent.java -+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import io.papermc.paper.adventure.AdventureComponent; // Paper - import com.google.gson.Gson; - import com.google.gson.GsonBuilder; - import com.google.gson.JsonArray; -@@ -107,6 +108,7 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable waitable = new Waitable() { - @Override -@@ -293,12 +294,12 @@ public class LoginListener implements PacketLoginInListener { - - LoginListener.this.server.processQueue.add(waitable); - if (waitable.get() != PlayerPreLoginEvent.Result.ALLOWED) { -- disconnect(event.getKickMessage()); -+ disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure - return; - } - } else { - if (asyncEvent.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { -- disconnect(asyncEvent.getKickMessage()); -+ disconnect(PaperAdventure.asVanilla(asyncEvent.kickMessage())); // Paper - Adventure - return; - } - } -diff --git a/src/main/java/net/minecraft/server/NBTTagString.java b/src/main/java/net/minecraft/server/NBTTagString.java -index 7ef2378311edd0645472d895cf3756426f25605d..f36e1bd69270bdfd9fa3de4626dc0f48cad8007b 100644 ---- a/src/main/java/net/minecraft/server/NBTTagString.java -+++ b/src/main/java/net/minecraft/server/NBTTagString.java -@@ -40,6 +40,7 @@ public class NBTTagString implements NBTBase { - this.data = s; - } - -+ public static NBTTagString create(final String value) { return a(value); } // Paper - OBFHELPER - public static NBTTagString a(String s) { - return s.isEmpty() ? NBTTagString.b : new NBTTagString(s); - } -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 2976e8cc2da6e54e08e50ca1f5de5669823ef3f7..6c9aed49d5e63d6df608719ed17e813f86e93fcc 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -10,6 +10,7 @@ import io.netty.buffer.ByteBufOutputStream; - import io.netty.handler.codec.DecoderException; - import io.netty.handler.codec.EncoderException; - import io.netty.util.ByteProcessor; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.DataInput; - import java.io.DataOutput; - import java.io.IOException; -@@ -31,6 +32,7 @@ import org.bukkit.craftbukkit.inventory.CraftItemStack; // CraftBukkit - public class PacketDataSerializer extends ByteBuf { - - private final ByteBuf a; -+ public java.util.Locale adventure$locale; // Paper - - public PacketDataSerializer(ByteBuf bytebuf) { - this.a = bytebuf; -@@ -152,8 +154,15 @@ public class PacketDataSerializer extends ByteBuf { - return IChatBaseComponent.ChatSerializer.a(this.e(262144)); - } - -+ // Paper start -+ public PacketDataSerializer writeComponent(final net.kyori.adventure.text.Component component) { -+ return this.writeUtf(PaperAdventure.asJsonString(component, this.adventure$locale), 262144); -+ } -+ // Paper end -+ - public PacketDataSerializer a(IChatBaseComponent ichatbasecomponent) { -- return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); -+ //return this.a(IChatBaseComponent.ChatSerializer.a(ichatbasecomponent), 262144); // Paper - comment -+ return this.writeUtf(PaperAdventure.asJsonString(ichatbasecomponent, this.adventure$locale), 262144); // Paper - } - - public > T a(Class oclass) { -@@ -336,6 +345,7 @@ public class PacketDataSerializer extends ByteBuf { - return this.a(s, 32767); - } - -+ public PacketDataSerializer writeUtf(final String string, final int maxLength) { return this.a(string, maxLength); } // Paper - OBFHELPER - public PacketDataSerializer a(String s, int i) { - byte[] abyte = s.getBytes(StandardCharsets.UTF_8); - -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index 63c4dbd327beb7b6ab42eb44650d68accd3b0de6..d3c6bdbefb89b3e668477e0d771015e9b25c24a8 100644 ---- a/src/main/java/net/minecraft/server/PacketEncoder.java -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -3,6 +3,7 @@ package net.minecraft.server; - import io.netty.buffer.ByteBuf; - import io.netty.channel.ChannelHandlerContext; - import io.netty.handler.codec.MessageToByteEncoder; -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.io.IOException; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -35,6 +36,7 @@ public class PacketEncoder extends MessageToByteEncoder> { - throw new IOException("Can't serialize unregistered packet"); - } else { - PacketDataSerializer packetdataserializer = new PacketDataSerializer(bytebuf); -+ packetdataserializer.adventure$locale = channelhandlercontext.channel().attr(PaperAdventure.LOCALE_ATTRIBUTE).get(); // Paper - - packetdataserializer.d(integer); - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 9ae419f9ad971ee5c743ee931426ab482b6184f1..47328ca5e3f1e71ed25ba89df5b666f041e49b76 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -6,6 +6,7 @@ import java.util.UUID; - public class PacketPlayOutChat implements Packet { - - private IChatBaseComponent a; -+ public net.kyori.adventure.text.Component adventure$message; // Paper - public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot - private ChatMessageType b; - private UUID c; -@@ -27,6 +28,11 @@ public class PacketPlayOutChat implements Packet { - - @Override - public void b(PacketDataSerializer packetdataserializer) throws IOException { -+ // Paper start -+ if (this.adventure$message != null) { -+ packetdataserializer.writeComponent(this.adventure$message); -+ } else -+ // Paper end - // Spigot start - if (components != null) { - packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -index bb15a104c5ec5b12a28078369dc12257105f89bd..e3a8e1353bf8cd00fab439ca8ee25d1bc428503c 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutPlayerListHeaderFooter.java -@@ -6,6 +6,10 @@ public class PacketPlayOutPlayerListHeaderFooter implements Packet { - - private PacketPlayOutTitle.EnumTitleAction a; - private IChatBaseComponent b; -+ public net.kyori.adventure.text.Component adventure$text; // Paper - private int c; - private int d; - private int e; -@@ -48,6 +49,11 @@ public class PacketPlayOutTitle implements Packet { - public void b(PacketDataSerializer packetdataserializer) throws IOException { - packetdataserializer.a((Enum) this.a); - if (this.a == PacketPlayOutTitle.EnumTitleAction.TITLE || this.a == PacketPlayOutTitle.EnumTitleAction.SUBTITLE || this.a == PacketPlayOutTitle.EnumTitleAction.ACTIONBAR) { -+ // Paper start -+ if (this.adventure$text != null) { -+ packetdataserializer.writeComponent(this.adventure$text); -+ } else -+ // Paper end - packetdataserializer.a(this.b); - } - -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 055555cb5ce63d41cb9a7f4114341b0685879b9e..7875d4c08969b3adc6f95504686cc9fe99e3f29a 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -43,7 +43,7 @@ public class PacketStatusListener implements PacketStatusInListener { - CraftIconCache icon = minecraftServer.server.getServerIcon(); - - ServerListPingEvent() { -- super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.getMotd(), minecraftServer.getPlayerList().getMaxPlayers()); -+ super(((InetSocketAddress) networkManager.getSocketAddress()).getAddress(), minecraftServer.server.motd(), minecraftServer.getPlayerList().getMaxPlayers()); // Paper - Adventure - } - - @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d34e91887cd73009bf852fb849e495a8affed7a9..5636a76f1a893dc0609f16a240ae559396a4b46d 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -25,6 +25,8 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - - // CraftBukkit start -+import io.papermc.paper.adventure.ChatProcessor; // Paper -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.util.concurrent.ExecutionException; - import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; - import org.bukkit.Location; -@@ -243,21 +245,24 @@ public class PlayerConnection implements PacketListenerPlayIn { - return this.minecraftServer.a(this.player.getProfile()); - } - -- // CraftBukkit start -- @Deprecated -- public void disconnect(IChatBaseComponent ichatbasecomponent) { -- disconnect(CraftChatMessage.fromComponent(ichatbasecomponent)); -+ public void disconnect(String s) { -+ // Paper start -+ this.disconnect(PaperAdventure.LEGACY_SECTION_UXRC.deserialize(s)); - } -- // CraftBukkit end - -- public void disconnect(String s) { -+ public void disconnect(final IChatBaseComponent reason) { -+ this.disconnect(PaperAdventure.asAdventure(reason)); -+ } -+ -+ public void disconnect(net.kyori.adventure.text.Component reason) { -+ // Paper end - // CraftBukkit start - fire PlayerKickEvent - if (this.processedDisconnect) { - return; - } -- String leaveMessage = EnumChatFormat.YELLOW + this.player.getName() + " left the game."; -+ net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, this.player.getBukkitEntity().displayName()); // Paper - Adventure - -- PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), s, leaveMessage); -+ PlayerKickEvent event = new PlayerKickEvent(this.server.getPlayer(this.player), reason, leaveMessage); // Paper - Adventure - - if (this.server.getServer().isRunning()) { - this.server.getPluginManager().callEvent(event); -@@ -268,8 +273,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - return; - } - // Send the possibly modified leave message -- s = event.getReason(); -- final IChatBaseComponent ichatbasecomponent = CraftChatMessage.fromString(s, true)[0]; -+ final IChatBaseComponent ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure - // CraftBukkit end - - this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(ichatbasecomponent), (future) -> { -@@ -1485,9 +1489,11 @@ public class PlayerConnection implements PacketListenerPlayIn { - */ - - this.player.p(); -- String quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); -- if ((quitMessage != null) && (quitMessage.length() > 0)) { -- this.minecraftServer.getPlayerList().sendMessage(CraftChatMessage.fromString(quitMessage)); -+ // Paper start - Adventure -+ net.kyori.adventure.text.Component quitMessage = this.minecraftServer.getPlayerList().disconnect(this.player); -+ if ((quitMessage != null) && !quitMessage.equals(net.kyori.adventure.text.Component.empty())) { -+ this.minecraftServer.getPlayerList().sendMessage(PaperAdventure.asVanilla(quitMessage)); -+ // Paper end - } - // CraftBukkit end - ITextFilter itextfilter = this.player.Q(); -@@ -1703,8 +1709,13 @@ public class PlayerConnection implements PacketListenerPlayIn { - this.handleCommand(s); - } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { - // Do nothing, this is coming from a plugin -- } else { -- Player player = this.getPlayer(); -+ // Paper start -+ } else if (true) { -+ final ChatProcessor cp = new ChatProcessor(this.minecraftServer, this.player, s, async); -+ cp.process(); -+ // Paper end -+ } else if (false) { // Paper -+ Player player = this.getPlayer(); // Paper - AsyncPlayerChatEvent event = new AsyncPlayerChatEvent(async, player, s, new LazyPlayerSet(minecraftServer)); - this.server.getPluginManager().callEvent(event); - -@@ -2511,21 +2522,20 @@ public class PlayerConnection implements PacketListenerPlayIn { - return; - } - -- // CraftBukkit start -- Player player = this.server.getPlayer(this.player); -- int x = packetplayinupdatesign.b().getX(); -- int y = packetplayinupdatesign.b().getY(); -- int z = packetplayinupdatesign.b().getZ(); -- String[] lines = new String[4]; -+ // CraftBukkit start // Paper start - Adventure -+ List lines = new java.util.ArrayList<>(); - - for (int i = 0; i < list.size(); ++i) { -- lines[i] = EnumChatFormat.a(new ChatComponentText(EnumChatFormat.a((String) list.get(i))).getString()); -+ lines.add(net.kyori.adventure.text.Component.text(list.get(i))); - } -- SignChangeEvent event = new SignChangeEvent((org.bukkit.craftbukkit.block.CraftBlock) player.getWorld().getBlockAt(x, y, z), this.server.getPlayer(this.player), lines); -+ SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines); - this.server.getPluginManager().callEvent(event); - - if (!event.isCancelled()) { -- System.arraycopy(org.bukkit.craftbukkit.block.CraftSign.sanitizeLines(event.getLines()), 0, tileentitysign.lines, 0, 4); -+ for (int i = 0; i < 4; i++) { -+ tileentitysign.a(i, PaperAdventure.asVanilla(event.line(i))); -+ } -+ // Paper end - tileentitysign.isEditable = false; - } - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index e712f33fe733b805098174558bb9319aa33572f0..d1b26d753774ef89638a1c5130b10f16a6c743d8 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -8,6 +8,7 @@ import com.mojang.authlib.GameProfile; - import com.mojang.serialization.DataResult; - import com.mojang.serialization.Dynamic; - import io.netty.buffer.Unpooled; -+import io.papermc.paper.adventure.PaperAdventure; - import java.io.File; - import java.net.SocketAddress; - import java.text.SimpleDateFormat; -@@ -23,6 +24,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - - // CraftBukkit start -+import io.papermc.paper.adventure.PaperAdventure; // Paper - import com.google.common.base.Predicate; - import com.google.common.collect.Iterables; - -@@ -183,7 +185,7 @@ public abstract class PlayerList { - } - // CraftBukkit start - chatmessage.a(EnumChatFormat.YELLOW); -- String joinMessage = CraftChatMessage.fromComponent(chatmessage); -+ IChatBaseComponent joinMessage = chatmessage; // Paper - Adventure - - playerconnection.a(entityplayer.locX(), entityplayer.locY(), entityplayer.locZ(), entityplayer.yaw, entityplayer.pitch); - this.players.add(entityplayer); -@@ -192,19 +194,18 @@ public abstract class PlayerList { - // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below - - // CraftBukkit start -- PlayerJoinEvent playerJoinEvent = new PlayerJoinEvent(cserver.getPlayer(entityplayer), joinMessage); -+ PlayerJoinEvent playerJoinEvent = new org.bukkit.event.player.PlayerJoinEvent(cserver.getPlayer(entityplayer), PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure - cserver.getPluginManager().callEvent(playerJoinEvent); - - if (!entityplayer.playerConnection.networkManager.isConnected()) { - return; - } - -- joinMessage = playerJoinEvent.getJoinMessage(); -+ final net.kyori.adventure.text.Component jm = playerJoinEvent.joinMessage(); - -- if (joinMessage != null && joinMessage.length() > 0) { -- for (IChatBaseComponent line : org.bukkit.craftbukkit.util.CraftChatMessage.fromString(joinMessage)) { -- server.getPlayerList().sendAll(new PacketPlayOutChat(line, ChatMessageType.SYSTEM, SystemUtils.b)); -- } -+ if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure -+ joinMessage = PaperAdventure.asVanilla(jm); // Paper - Adventure -+ server.getPlayerList().sendAll(new PacketPlayOutChat(joinMessage, ChatMessageType.SYSTEM, SystemUtils.b)); // Paper - Adventure - } - // CraftBukkit end - -@@ -401,7 +402,7 @@ public abstract class PlayerList { - - } - -- public String disconnect(EntityPlayer entityplayer) { // CraftBukkit - return string -+ public net.kyori.adventure.text.Component disconnect(EntityPlayer entityplayer) { // Paper - return Component - WorldServer worldserver = entityplayer.getWorldServer(); - - entityplayer.a(StatisticList.LEAVE_GAME); -@@ -412,7 +413,7 @@ public abstract class PlayerList { - entityplayer.closeInventory(); - } - -- PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), "\u00A7e" + entityplayer.getName() + " left the game"); -+ PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getName()))); - cserver.getPluginManager().callEvent(playerQuitEvent); - entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); - -@@ -473,7 +474,7 @@ public abstract class PlayerList { - cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); - // CraftBukkit end - -- return playerQuitEvent.getQuitMessage(); // CraftBukkit -+ return playerQuitEvent.quitMessage(); // Paper - Adventure - } - - // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -519,10 +520,10 @@ public abstract class PlayerList { - } - - // return chatmessage; -- if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); // Spigot -+ if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure - } else if (!this.isWhitelisted(gameprofile)) { - chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); -- event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot -+ event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.whitelistMessage)); // Spigot // Paper - Adventure - } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { - IpBanEntry ipbanentry = this.l.get(socketaddress); - -@@ -532,17 +533,17 @@ public abstract class PlayerList { - } - - // return chatmessage; -- event.disallow(PlayerLoginEvent.Result.KICK_BANNED, CraftChatMessage.fromComponent(chatmessage)); -+ event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure - } else { - // return this.players.size() >= this.maxPlayers && !this.f(gameprofile) ? new ChatMessage("multiplayer.disconnect.server_full") : null; - if (this.players.size() >= this.maxPlayers && !this.f(gameprofile)) { -- event.disallow(PlayerLoginEvent.Result.KICK_FULL, org.spigotmc.SpigotConfig.serverFullMessage); // Spigot -+ event.disallow(PlayerLoginEvent.Result.KICK_FULL, PaperAdventure.LEGACY_SECTION_UXRC.deserialize(org.spigotmc.SpigotConfig.serverFullMessage)); // Spigot // Paper - Adventure - } - } - - cserver.getPluginManager().callEvent(event); - if (event.getResult() != PlayerLoginEvent.Result.ALLOWED) { -- loginlistener.disconnect(event.getKickMessage()); -+ loginlistener.disconnect(PaperAdventure.asVanilla(event.kickMessage())); // Paper - Adventure - return null; - } - return entity; -@@ -1063,7 +1064,7 @@ public abstract class PlayerList { - public void shutdown() { - // CraftBukkit start - disconnect safely - for (EntityPlayer player : this.players) { -- player.playerConnection.disconnect(this.server.server.getShutdownMessage()); // CraftBukkit - add custom shutdown message -+ player.playerConnection.disconnect(PaperAdventure.asVanilla(this.server.server.shutdownMessage())); // CraftBukkit - add custom shutdown message // Paper - Adventure - } - // CraftBukkit end - -diff --git a/src/main/java/net/minecraft/server/WorldMap.java b/src/main/java/net/minecraft/server/WorldMap.java -index e6d97e7ffae3eadac586bad078123cd4aaa69916..d11725d61b888ceb08c4ea30f23d563170ce944d 100644 ---- a/src/main/java/net/minecraft/server/WorldMap.java -+++ b/src/main/java/net/minecraft/server/WorldMap.java -@@ -12,6 +12,7 @@ import org.apache.logging.log4j.LogManager; +diff --git a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java +index 7ec93ddd7e7c9dc54e3e4dcfe0d1654c0b0a8536..3f057f0bd23bc1c693c8f04ee8acd6626c620008 100644 +--- a/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java ++++ b/src/main/java/net/minecraft/world/level/saveddata/maps/WorldMap.java +@@ -32,6 +32,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; // CraftBukkit start @@ -1613,7 +1615,7 @@ index e6d97e7ffae3eadac586bad078123cd4aaa69916..d11725d61b888ceb08c4ea30f23d5631 import java.util.UUID; import org.bukkit.craftbukkit.CraftServer; -@@ -453,7 +454,7 @@ public class WorldMap extends PersistentBase { +@@ -473,7 +474,7 @@ public class WorldMap extends PersistentBase { for ( org.bukkit.map.MapCursor cursor : render.cursors) { if (cursor.isVisible()) { @@ -1623,7 +1625,7 @@ index e6d97e7ffae3eadac586bad078123cd4aaa69916..d11725d61b888ceb08c4ea30f23d5631 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0e8de6b3a6acd37064209b6890270ae7f64e7f28..17f4e5a6fcf58ba74678f8a004fc3d5f4a81ae50 100644 +index 6d68610d8ffdef4357cf61ac2f4cf6bf54157b15..2f6b49e3ae7a7407eaec9810af8bf72e3a4896de 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -563,8 +563,11 @@ public final class CraftServer implements Server { @@ -1739,7 +1741,7 @@ index 0e8de6b3a6acd37064209b6890270ae7f64e7f28..17f4e5a6fcf58ba74678f8a004fc3d5f + // Paper start + @Override + public net.kyori.adventure.text.Component motd() { -+ return io.papermc.paper.adventure.PaperAdventure.asAdventure(new net.minecraft.server.ChatComponentText(console.getMotd())); ++ return io.papermc.paper.adventure.PaperAdventure.asAdventure(new net.minecraft.network.chat.ChatComponentText(console.getMotd())); + } + // Paper end @Override @@ -1762,7 +1764,7 @@ index 0e8de6b3a6acd37064209b6890270ae7f64e7f28..17f4e5a6fcf58ba74678f8a004fc3d5f // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java -index 21ebceafbf27125761aa08cfe0785f6f05c77592..252b03e287cbe9212c7ec80be049647c4c77d37a 100644 +index ae735836accc6bf6f0831f72ff882720b69df792..d3ae5cadd88f9012203d2c04cbe38af9b215ef0b 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java @@ -70,6 +70,19 @@ public class CraftBeacon extends CraftBlockEntityState impleme @@ -1786,18 +1788,10 @@ index 21ebceafbf27125761aa08cfe0785f6f05c77592..252b03e287cbe9212c7ec80be049647c public String getCustomName() { TileEntityBeacon beacon = this.getSnapshot(); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java -index 36ba813e56c6e75528507c415d11e5a57a5f4ae3..a76fa169b0efbf02a4aebbfbd8e38c8f429eba83 100644 +index e8ce890c551c9b809e8ba3f7449dc33f3a3a6b80..c99a59573653ee5d14e780137c769116bf781ea7 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftContainer.java -@@ -1,6 +1,7 @@ - package org.bukkit.craftbukkit.block; - - import net.minecraft.server.ChestLock; -+import net.minecraft.server.TileEntityBeacon; - import net.minecraft.server.TileEntityContainer; - import org.bukkit.Material; - import org.bukkit.block.Block; -@@ -32,6 +33,19 @@ public abstract class CraftContainer extends Craf +@@ -32,6 +32,19 @@ public abstract class CraftContainer extends Craf this.getSnapshot().chestLock = (key == null) ? ChestLock.a : new ChestLock(key); } @@ -1818,7 +1812,7 @@ index 36ba813e56c6e75528507c415d11e5a57a5f4ae3..a76fa169b0efbf02a4aebbfbd8e38c8f public String getCustomName() { T container = this.getSnapshot(); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java -index 3a782294c15e2c2592976858e28ec33f049cb65e..772c6b2fa50deac27e5ed112e6d9f9ddd32f668e 100644 +index a559a77aae870988f4dd5e6f5f1f08feb3fad054..75ee5cc96c0e54f99e2ce820289bb74f57c426a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftEnchantingTable.java @@ -16,6 +16,19 @@ public class CraftEnchantingTable extends CraftBlockEntityState event = net.minecraft.server.IRegistry.SOUND_EVENT.getOptional(name); ++ final java.util.Optional event = net.minecraft.core.IRegistry.SOUND_EVENT.getOptional(name); + if (event.isPresent()) { + this.getHandle().playerConnection.sendPacket(new PacketPlayOutNamedSoundEffect(event.get(), io.papermc.paper.adventure.PaperAdventure.asVanilla(sound.source()), x, y, z, sound.volume(), sound.pitch())); + } else { @@ -2369,14 +2355,14 @@ index 4bfdd900bae4c886360b24fcc8563e1d2e73ebf0..f5520a793cd1d2d56f8c890b74ef50ce + @Override + public void openBook(final net.kyori.adventure.inventory.Book book) { + final java.util.Locale locale = this.getHandle().adventure$locale; -+ final net.minecraft.server.ItemStack item = io.papermc.paper.adventure.PaperAdventure.asItemStack(book, locale); ++ final net.minecraft.world.item.ItemStack item = io.papermc.paper.adventure.PaperAdventure.asItemStack(book, locale); + final EntityPlayer player = this.getHandle(); + final PlayerConnection connection = player.playerConnection; -+ final net.minecraft.server.PlayerInventory inventory = player.inventory; ++ final net.minecraft.world.entity.player.PlayerInventory inventory = player.inventory; + final int slot = inventory.items.size() + inventory.itemInHandIndex; -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, item)); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutOpenBook(net.minecraft.server.EnumHand.MAIN_HAND)); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutSetSlot(0, slot, item)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutOpenBook(net.minecraft.world.EnumHand.MAIN_HAND)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); + } + // Paper end + @@ -2384,7 +2370,7 @@ index 4bfdd900bae4c886360b24fcc8563e1d2e73ebf0..f5520a793cd1d2d56f8c890b74ef50ce private final Player.Spigot spigot = new Player.Spigot() { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index de912d8f521acda1f9e5ec39d20ed28abe2bd01f..b4302fe96d4b2ad6db47fc9d350495cc20a26478 100644 +index 74b5aaa87e74d1270adba7d3e66bccc40c1f2a0f..788617eaeab9985c426f80e9f4cdbb912383c049 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -767,9 +767,9 @@ public class CraftEventFactory { @@ -2409,7 +2395,7 @@ index de912d8f521acda1f9e5ec39d20ed28abe2bd01f..b4302fe96d4b2ad6db47fc9d350495cc return event; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java -index 8c714c7430c0a6b8fd7f4a158d9a271e1642bd7a..9c49d9c21630c48ae6783bfc0f9cbe455862d686 100644 +index 384520dd734449d4e4f5243fbaad5f666b0c965c..614ab2d73db2293116f2272f6cd5c16da446132d 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftContainer.java @@ -39,6 +39,7 @@ public class CraftContainer extends Container { @@ -2477,7 +2463,7 @@ index 8c714c7430c0a6b8fd7f4a158d9a271e1642bd7a..9c49d9c21630c48ae6783bfc0f9cbe45 } return true; diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java -index e1dfdb23f7d755b19cf14c0bf15358095406e9a0..b350a57a28757b48895dcff30e0abfa6099c6691 100644 +index a537cc4ac5d052168f96a1ae73b6b17a380436ab..21347cf02cc01c90a81e7dd8264ef11968d9f145 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryCustom.java @@ -19,6 +19,12 @@ public class CraftInventoryCustom extends CraftInventory { @@ -2563,7 +2549,7 @@ index e1dfdb23f7d755b19cf14c0bf15358095406e9a0..b350a57a28757b48895dcff30e0abfa6 return title; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java -index 4c6492a92821916fa98d6409a8ebf17f255535ad..80759d640d5af1620712aadbfb5f1ab7bc379f4b 100644 +index 04073ed45f8068d80e58d3927b5ebc3160c6a8c6..9949bb8cac73b2f1f02b51079c0e244f923af8e9 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryView.java @@ -64,6 +64,13 @@ public class CraftInventoryView extends InventoryView { @@ -2581,7 +2567,7 @@ index 4c6492a92821916fa98d6409a8ebf17f255535ad..80759d640d5af1620712aadbfb5f1ab7 public String getTitle() { return CraftChatMessage.fromComponent(container.getTitle()); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 89a3617068421bb86baf4e8bfd9df2d0626adff7..a50eb746b8774a089c39652d534920acf708b137 100644 +index 89a3617068421bb86baf4e8bfd9df2d0626adff7..6d320bbe0c75cc0df504faacf0f7d24804b90d5f 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -334,4 +334,12 @@ public final class CraftItemFactory implements ItemFactory { @@ -2592,13 +2578,13 @@ index 89a3617068421bb86baf4e8bfd9df2d0626adff7..a50eb746b8774a089c39652d534920ac + // Paper start + @Override + public net.kyori.adventure.text.event.HoverEvent asHoverEvent(final ItemStack item, final java.util.function.UnaryOperator op) { -+ final net.minecraft.server.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); ++ final net.minecraft.nbt.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); + return net.kyori.adventure.text.event.HoverEvent.showItem(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowItem.of(item.getType().getKey(), item.getAmount(), io.papermc.paper.adventure.PaperAdventure.asBinaryTagHolder(tag)))); + } + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java -index 9f6e797d34e5ad21a496c89f5a45ddb0638d3adc..115ee3785b4e0ba6a235bbb31b643aa596705401 100644 +index ef10c7ab1d615cdba182eca63eb14309339a5314..206c133ebc6c44038585236b0628543b8bed278c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantCustom.java @@ -14,10 +14,17 @@ import org.apache.commons.lang.Validate; @@ -2638,7 +2624,7 @@ index 9f6e797d34e5ad21a496c89f5a45ddb0638d3adc..115ee3785b4e0ba6a235bbb31b643aa5 @Override public CraftMerchant getCraftMerchant() { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java -index 422c61215601a5f4014b490bd608ec97f3ef3572..123616ed018fbc4d69f46e65d5ff15734008a00d 100644 +index 4cdc504df4cad6f7725f6d18482e88433523943a..af1f45bb8bbe380eec1dcdef1beacb06c9d932a8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBook.java @@ -1,8 +1,9 @@ @@ -2798,7 +2784,7 @@ index 422c61215601a5f4014b490bd608ec97f3ef3572..123616ed018fbc4d69f46e65d5ff1573 if (hasTitle()) { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java -index 0bd396ebee14bd4014744983b273dad832211178..06eec130166f7fef7674ea402123f2edf9f4e455 100644 +index 0835541f51e643ae824c197be7100d5849b5e92a..0d58ec9834797ad7b9acaae6353dcf0385c53fd4 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaBookSigned.java @@ -1,6 +1,6 @@ @@ -2807,7 +2793,7 @@ index 0bd396ebee14bd4014744983b273dad832211178..06eec130166f7fef7674ea402123f2ed -import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.ImmutableMap; // Paper import java.util.Map; - import net.minecraft.server.NBTTagCompound; + import net.minecraft.nbt.NBTTagCompound; import org.bukkit.Material; @@ -84,7 +84,7 @@ class CraftMetaBookSigned extends CraftMetaBook implements BookMeta { } @@ -2819,7 +2805,7 @@ index 0bd396ebee14bd4014744983b273dad832211178..06eec130166f7fef7674ea402123f2ed return builder; } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 60e04343b4b10b1de0bbd033b148a9da41b66aad..ac6be3da812c927a5486809c096b5a2e1aba617b 100644 +index 928328c292a1322cab478bc748761baf8608e4b0..7a11b2ddfa4244459253c918315aaab78ef2eb4a 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -745,6 +745,18 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -2938,7 +2924,7 @@ index b51321c8dd70a90ab149f456c7ffb4587c4fbd34..94d807c5d09f165c6eedd0a1c4026c2b } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java -index ad91eabb47511268d0cf307d941070800ce9bd3f..b99ce1217461595f5ccc8c7565ec3b65d1df83d9 100644 +index f35e66dab9ff63ca05d7e303c71106c0e9971309..2bd4e644ffbde2e1133b25824a2829bc6b33fa84 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/util/CraftTileInventoryConverter.java @@ -31,6 +31,18 @@ public abstract class CraftTileInventoryConverter implements CraftInventoryCreat @@ -2996,7 +2982,7 @@ index ad91eabb47511268d0cf307d941070800ce9bd3f..b99ce1217461595f5ccc8c7565ec3b65 public Inventory createInventory(InventoryHolder holder, InventoryType type, String title) { // BrewingStand does not extend TileEntityLootable diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java -index 5eaea24d253d92078709af2a7d7fd0beda3e5520..37faafaf7136e02aa1c76d841b8f47c0f6b9a36c 100644 +index 8fedca656af0783f3d97a7ccde3a113f97911084..df3deee12b11508b76c5f8f927fac8db54a7e397 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftObjective.java @@ -31,6 +31,21 @@ final class CraftObjective extends CraftScoreboardComponent implements Objective @@ -3022,7 +3008,7 @@ index 5eaea24d253d92078709af2a7d7fd0beda3e5520..37faafaf7136e02aa1c76d841b8f47c0 public String getDisplayName() throws IllegalStateException { CraftScoreboard scoreboard = checkState(); diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java -index e3036fe23fa2be100044332c432d1ad5b4872823..5178981cd561be45b8f93e7060b13874fbd41fcf 100644 +index 954389b818de93cf0ab046edc5dc032fceea391b..6ea491f6308317059c4bc6735abbdce370df0f34 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -28,6 +28,27 @@ public final class CraftScoreboard implements org.bukkit.scoreboard.Scoreboard { @@ -3073,7 +3059,7 @@ index e3036fe23fa2be100044332c432d1ad5b4872823..5178981cd561be45b8f93e7060b13874 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java -index 6c24db0d2583c5f348d1d96c39139cc44af828d8..d641a9cd493ff7039db592d90d7cad1b5cf459bb 100644 +index a213c2e3b2680c6d1bd38853580cbdb52ae7779e..c631934fe9d205a06956c900d5b58a1d8a781c19 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftTeam.java @@ -29,6 +29,55 @@ final class CraftTeam extends CraftScoreboardComponent implements Team { @@ -3133,7 +3119,7 @@ index 6c24db0d2583c5f348d1d96c39139cc44af828d8..d641a9cd493ff7039db592d90d7cad1b @Override public String getDisplayName() throws IllegalStateException { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java -index 1582a799e456402453c43c2e0c6b8a194951a9dd..0dfb9ddad426e962db1216d1f490c1c5e2210adf 100644 +index 6a0b4cd36ac54df41642e8499c50e59f2b347b48..666af6cc91bd12ba5d5a846d663a5aabf861fbc4 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftChatMessage.java @@ -290,6 +290,7 @@ public final class CraftChatMessage { @@ -3145,7 +3131,7 @@ index 1582a799e456402453c43c2e0c6b8a194951a9dd..0dfb9ddad426e962db1216d1f490c1c5 boolean hadFormat = false; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d63a160f1b00de8d67ae1eb4fefbd5ca06835de7..47370fc3a623a38fbd24dfe484db065a64d44204 100644 +index 65131f0977fa55c4761c34ce52720170feb61a72..229c6c18be548dde8057288b59ba2329604a8c50 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -59,6 +59,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/Spigot-Server-Patches/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch b/Spigot-Server-Patches/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch index 9fd80ba088..d40ff9f6bf 100644 --- a/Spigot-Server-Patches/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch +++ b/Spigot-Server-Patches/0011-Configurable-cactus-bamboo-and-reed-growth-heights.patch @@ -28,11 +28,11 @@ index b31109d2dadd29e8852468c19265066b773d2be0..3618cc017feb60e257a28f67cbddca3f + + } } -diff --git a/src/main/java/net/minecraft/server/BlockBamboo.java b/src/main/java/net/minecraft/server/BlockBamboo.java -index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb1f94a5cd 100644 ---- a/src/main/java/net/minecraft/server/BlockBamboo.java -+++ b/src/main/java/net/minecraft/server/BlockBamboo.java -@@ -99,7 +99,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockBamboo.java b/src/main/java/net/minecraft/world/level/block/BlockBamboo.java +index 00bae3689c4d53ef8e6055c16995e6069acba049..21be9869bf995e6235c874ebb269f3918382e18c 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockBamboo.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockBamboo.java +@@ -124,7 +124,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { if (random.nextInt(Math.max(1, (int) (100.0F / worldserver.spigotConfig.bambooModifier) * 3)) == 0 && worldserver.isEmpty(blockposition.up()) && worldserver.getLightLevel(blockposition.up(), 0) >= 9) { // Spigot int i = this.b(worldserver, blockposition) + 1; @@ -41,7 +41,7 @@ index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb this.a(iblockdata, (World) worldserver, blockposition, random, i); } } -@@ -130,7 +130,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -155,7 +155,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { int i = this.a(iblockaccess, blockposition); int j = this.b(iblockaccess, blockposition); @@ -50,7 +50,7 @@ index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb } @Override -@@ -149,7 +149,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -174,7 +174,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { BlockPosition blockposition1 = blockposition.up(i); IBlockData iblockdata1 = worldserver.getType(blockposition1); @@ -59,7 +59,7 @@ index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb return; } -@@ -190,7 +190,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -215,7 +215,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { } int j = (Integer) iblockdata.get(BlockBamboo.d) != 1 && !iblockdata2.a(Blocks.BAMBOO) ? 0 : 1; @@ -68,7 +68,7 @@ index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb // CraftBukkit start if (org.bukkit.craftbukkit.event.CraftEventFactory.handleBlockSpreadEvent(world, blockposition, blockposition.up(), (IBlockData) ((IBlockData) ((IBlockData) this.getBlockData().set(BlockBamboo.d, j)).set(BlockBamboo.e, blockpropertybamboosize)).set(BlockBamboo.f, k), 3)) { -@@ -205,7 +205,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -230,7 +230,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { protected int a(IBlockAccess iblockaccess, BlockPosition blockposition) { int i; @@ -77,7 +77,7 @@ index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb ; } -@@ -215,7 +215,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { +@@ -240,7 +240,7 @@ public class BlockBamboo extends Block implements IBlockFragilePlantElement { protected int b(IBlockAccess iblockaccess, BlockPosition blockposition) { int i; @@ -86,11 +86,11 @@ index f208ab50985d71996c65fcf31615052b967acc93..535535214119c2c0f080c328b70a02bb ; } -diff --git a/src/main/java/net/minecraft/server/BlockCactus.java b/src/main/java/net/minecraft/server/BlockCactus.java -index 4a3049575ad78e1c75d1b43a35311974c1d489de..13e4517bd04096001ca1caf32b9949abb3cf9c7f 100644 ---- a/src/main/java/net/minecraft/server/BlockCactus.java -+++ b/src/main/java/net/minecraft/server/BlockCactus.java -@@ -35,7 +35,7 @@ public class BlockCactus extends Block { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockCactus.java b/src/main/java/net/minecraft/world/level/block/BlockCactus.java +index c2316e346f9b647edae4c9709defa4531e04eaa6..9f1e9fc5361cd051b909e2e1b2095722064185da 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockCactus.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockCactus.java +@@ -55,7 +55,7 @@ public class BlockCactus extends Block { ; } @@ -99,11 +99,11 @@ index 4a3049575ad78e1c75d1b43a35311974c1d489de..13e4517bd04096001ca1caf32b9949ab int j = (Integer) iblockdata.get(BlockCactus.AGE); if (j >= (byte) range(3, ((100.0F / worldserver.spigotConfig.cactusModifier) * 15) + 0.5F, 15)) { // Spigot -diff --git a/src/main/java/net/minecraft/server/BlockReed.java b/src/main/java/net/minecraft/server/BlockReed.java -index 30282f73d263a96a14bd7bf7d3ac520e315b093a..c051decd19ff763a061822bc2a4b03289dfe3ac7 100644 ---- a/src/main/java/net/minecraft/server/BlockReed.java -+++ b/src/main/java/net/minecraft/server/BlockReed.java -@@ -35,7 +35,7 @@ public class BlockReed extends Block { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockReed.java b/src/main/java/net/minecraft/world/level/block/BlockReed.java +index eb95d65e1a37b91a71a9ad8968710ba9047f3980..a4ede7968ba0134f0d2cf880a6b4a6b9a81f2fcd 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockReed.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockReed.java +@@ -51,7 +51,7 @@ public class BlockReed extends Block { ; } diff --git a/Spigot-Server-Patches/0012-Configurable-baby-zombie-movement-speed.patch b/Spigot-Server-Patches/0012-Configurable-baby-zombie-movement-speed.patch index 4826066677..060f23376f 100644 --- a/Spigot-Server-Patches/0012-Configurable-baby-zombie-movement-speed.patch +++ b/Spigot-Server-Patches/0012-Configurable-baby-zombie-movement-speed.patch @@ -24,11 +24,11 @@ index 3618cc017feb60e257a28f67cbddca3f792a9833..796c17e0941922a9716212c6eae91643 + log("Baby zombies will move at the speed of " + babyZombieMovementModifier); + } } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 3533df35b9fc942b0e34f162a0524a65857370a7..f8b969b203cec7341382abf884a084cb4adbd7f9 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -20,7 +20,7 @@ import org.bukkit.event.entity.EntityTransformEvent; +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index daa6d1ca20f952971a2ad6a0c4cba0bef6e43bf6..219e3b1626d68ede57b08a706d24bb6bc4b13fac 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -82,7 +82,7 @@ import org.bukkit.event.entity.EntityTransformEvent; public class EntityZombie extends EntityMonster { private static final UUID b = UUID.fromString("B9766B59-9566-4402-BC1F-2EE2A276D836"); @@ -37,7 +37,7 @@ index 3533df35b9fc942b0e34f162a0524a65857370a7..f8b969b203cec7341382abf884a084cb private static final DataWatcherObject d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); public static final DataWatcherObject DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); -@@ -123,9 +123,9 @@ public class EntityZombie extends EntityMonster { +@@ -185,9 +185,9 @@ public class EntityZombie extends EntityMonster { if (this.world != null && !this.world.isClientSide) { AttributeModifiable attributemodifiable = this.getAttributeInstance(GenericAttributes.MOVEMENT_SPEED); diff --git a/Spigot-Server-Patches/0013-Configurable-fishing-time-ranges.patch b/Spigot-Server-Patches/0013-Configurable-fishing-time-ranges.patch index ba89913e73..7d7162311a 100644 --- a/Spigot-Server-Patches/0013-Configurable-fishing-time-ranges.patch +++ b/Spigot-Server-Patches/0013-Configurable-fishing-time-ranges.patch @@ -21,11 +21,11 @@ index 796c17e0941922a9716212c6eae91643d8360418..78948c42b13194005bdbbbc69c2b7ae0 + log("Fishing time ranges are between " + fishingMinTicks +" and " + fishingMaxTicks + " ticks"); + } } -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 99a18a6c4d42b05cdcfd154c4ff24d9764e73057..b9243b0a2d429828f2a2b68c221129e23c6212ca 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -47,6 +47,10 @@ public class EntityFishingHook extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +index 2b75eab985b0f39e1624e5f4cab7e5b5bde6ae14..bcc411107d531529dbce9d1d43896a3c70e63012 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +@@ -85,6 +85,10 @@ public class EntityFishingHook extends IProjectile { entityhuman.hookedFish = this; this.an = Math.max(0, i); this.lureLevel = Math.max(0, j); diff --git a/Spigot-Server-Patches/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch b/Spigot-Server-Patches/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch index ce8b05c302..cbf2e1e52c 100644 --- a/Spigot-Server-Patches/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch +++ b/Spigot-Server-Patches/0014-Allow-nerfed-mobs-to-jump-and-take-water-damage.patch @@ -18,23 +18,11 @@ index 78948c42b13194005bdbbbc69c2b7ae0732a78c5..b41e7922dd96c3358eb849ab39982a75 + nerfedMobsShouldJump = getBoolean("spawner-nerfed-mobs-should-jump", false); + } } -diff --git a/src/main/java/net/minecraft/server/ControllerJump.java b/src/main/java/net/minecraft/server/ControllerJump.java -index 2e869004c8c6b8bfbb002fb4eda04519d50390c8..22eb89df768819f0a18f91b806b56acec8489281 100644 ---- a/src/main/java/net/minecraft/server/ControllerJump.java -+++ b/src/main/java/net/minecraft/server/ControllerJump.java -@@ -13,6 +13,7 @@ public class ControllerJump { - this.a = true; - } - -+ public final void jumpIfSet() { this.b(); } // Paper - OBFHELPER - public void b() { - this.b.setJumping(this.a); - this.a = false; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ace7d5a36c0a44763d554d5d83cee7817f77fcc1..b6ca0c88fbfec5cc0a3d06a33f1ab7cddd52cbe3 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1020,6 +1020,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index db8970539f7f69c9087abe43286bca008cb4594d..0b86c697541e3ee6083b3c10ab3618ef740b1904 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1105,6 +1105,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.isInWater() || this.isInRain(); } @@ -42,11 +30,11 @@ index ace7d5a36c0a44763d554d5d83cee7817f77fcc1..b6ca0c88fbfec5cc0a3d06a33f1ab7cd public boolean aG() { return this.isInWater() || this.isInRain() || this.k(); } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 03bfd29c12e7dd6e359481ffb56fddad1a44492a..be24030f9c23da21e2f7c98cb0df5e7229109d26 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -33,6 +33,7 @@ public abstract class EntityInsentient extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index dbfcdc3cc7c1dccf785f5e13634e84c5af088985..28aa0a9361e8a32763d7fe1af060f0016e8c1e50 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -98,6 +98,7 @@ public abstract class EntityInsentient extends EntityLiving { private final EntityAIBodyControl c; protected NavigationAbstract navigation; public PathfinderGoalSelector goalSelector; @@ -54,7 +42,7 @@ index 03bfd29c12e7dd6e359481ffb56fddad1a44492a..be24030f9c23da21e2f7c98cb0df5e72 public PathfinderGoalSelector targetSelector; private EntityLiving goalTarget; private final EntitySenses bo; -@@ -719,7 +720,17 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -784,7 +785,17 @@ public abstract class EntityInsentient extends EntityLiving { @Override protected final void doTick() { ++this.ticksFarFromPlayer; @@ -73,11 +61,23 @@ index 03bfd29c12e7dd6e359481ffb56fddad1a44492a..be24030f9c23da21e2f7c98cb0df5e72 this.world.getMethodProfiler().enter("sensing"); this.bo.a(); this.world.getMethodProfiler().exit(); -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -index fd861cbc007c164f9a18ebfe7e4d0e4fe01db54c..8030376804823264bb5a701c1304414ac932af9c 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalFloat.java -@@ -8,15 +8,18 @@ public class PathfinderGoalFloat extends PathfinderGoal { +diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java +index 9767ac416fcd60a8a57b648dcb3f1e427bacd54d..1a9b3e0e0c090683e332dfa53708f8a62c8f14e0 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java ++++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerJump.java +@@ -15,6 +15,7 @@ public class ControllerJump { + this.a = true; + } + ++ public final void jumpIfSet() { this.b(); } // Paper - OBFHELPER + public void b() { + this.b.setJumping(this.a); + this.a = false; +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java +index 8dfa1a6ade7f51e5d68b290f5376d999bb4c60ab..a6c8763139ed18fe73b2d6f6ec511e59666dc843 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalFloat.java +@@ -11,15 +11,18 @@ public class PathfinderGoalFloat extends PathfinderGoal { public PathfinderGoalFloat(EntityInsentient entityinsentient) { this.a = entityinsentient; diff --git a/Spigot-Server-Patches/0015-Add-configurable-despawn-distances-for-living-entiti.patch b/Spigot-Server-Patches/0015-Add-configurable-despawn-distances-for-living-entiti.patch index cbea564739..edb9677fb5 100644 --- a/Spigot-Server-Patches/0015-Add-configurable-despawn-distances-for-living-entiti.patch +++ b/Spigot-Server-Patches/0015-Add-configurable-despawn-distances-for-living-entiti.patch @@ -29,11 +29,11 @@ index b41e7922dd96c3358eb849ab39982a75736e3476..2f0d582baf0eb2bb477944d0cb1369db + hardDespawnDistance = hardDespawnDistance*hardDespawnDistance; + } } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index be24030f9c23da21e2f7c98cb0df5e7229109d26..15b0d48e9dfe707b2859564b33206085f5a4e0db 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -698,14 +698,14 @@ public abstract class EntityInsentient extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 28aa0a9361e8a32763d7fe1af060f0016e8c1e50..f93af56f68d5fd27eca38d333ca429ce22fc397b 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -763,14 +763,14 @@ public abstract class EntityInsentient extends EntityLiving { int i = this.getEntityType().e().f(); int j = i * i; diff --git a/Spigot-Server-Patches/0016-Allow-for-toggling-of-spawn-chunks.patch b/Spigot-Server-Patches/0016-Allow-for-toggling-of-spawn-chunks.patch index 33345d1fce..126f048726 100644 --- a/Spigot-Server-Patches/0016-Allow-for-toggling-of-spawn-chunks.patch +++ b/Spigot-Server-Patches/0016-Allow-for-toggling-of-spawn-chunks.patch @@ -19,11 +19,11 @@ index 2f0d582baf0eb2bb477944d0cb1369db6ca33956..89e76dd73811fd0f6f8c8e7e5af804d5 + log("Keep spawn chunk loaded: " + keepSpawnInMemory); + } } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b4aeea40ee04fd2ed10484f40d25dbd2a3a01b53..ab1285ed371f7848cddd959c33019a8ff10e1c28 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -165,6 +165,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 1b03c69fa7ffeca4083470a179e18be828b0a957..62735e7908f86e31f7a89ce2071ddebe176c0385 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -217,6 +217,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }); // CraftBukkit end timings = new co.aikar.timings.WorldTimingsHandler(this); // Paper - code below can generate new world and access timings diff --git a/Spigot-Server-Patches/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch b/Spigot-Server-Patches/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch index 7efdc6ea58..26dfa439bc 100644 --- a/Spigot-Server-Patches/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch +++ b/Spigot-Server-Patches/0017-Drop-falling-block-and-tnt-entities-at-the-specified.patch @@ -24,11 +24,11 @@ index 89e76dd73811fd0f6f8c8e7e5af804d5a4bb5a75..d16ae924bcbe31c964f7fb448757c748 + if (entityTNTHeightNerf != 0) log("TNT Entity Height Limit set to Y: " + entityTNTHeightNerf); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ae96ff73f78a514328862de86d3ecdb29fa9c145..09bab3828197e3078a4ed95e7c8a9f34e8bf1b8d 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1765,6 +1765,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 0b86c697541e3ee6083b3c10ab3618ef740b1904..d7dfb89faa47817c51257bb124cfb3806c5e27da 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1850,6 +1850,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.a(itemstack, 0.0F); } @@ -36,11 +36,11 @@ index ae96ff73f78a514328862de86d3ecdb29fa9c145..09bab3828197e3078a4ed95e7c8a9f34 @Nullable public EntityItem a(ItemStack itemstack, float f) { if (itemstack.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 55e6d9a94c648bac68b80a76eda041fb952db09f..6b226c04d40adff8b0f1d28c0cc79439df002b3d 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -85,6 +85,17 @@ public class EntityFallingBlock extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +index b3dea8d65c3d1e27e59be142ec9e2ebb4164aed0..901522f24b8bc58861e46eda400dbab92bb6401d 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +@@ -124,6 +124,17 @@ public class EntityFallingBlock extends Entity { } this.move(EnumMoveType.SELF, this.getMot()); @@ -58,28 +58,11 @@ index 55e6d9a94c648bac68b80a76eda041fb952db09f..6b226c04d40adff8b0f1d28c0cc79439 if (!this.world.isClientSide) { blockposition = this.getChunkCoordinates(); boolean flag = this.block.getBlock() instanceof BlockConcretePowder; -diff --git a/src/main/java/net/minecraft/server/EntityMinecartTNT.java b/src/main/java/net/minecraft/server/EntityMinecartTNT.java -index 50d7c2899deb707dbbe333242e049b963d9b549c..3dfe3d13ac713c963256a662b52f54716e397672 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartTNT.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartTNT.java -@@ -26,6 +26,12 @@ public class EntityMinecartTNT extends EntityMinecartAbstract { - public void tick() { - super.tick(); - if (this.b > 0) { -+ // Paper start - Configurable TNT entity height nerf -+ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) { -+ this.die(); -+ return; -+ } -+ // Paper end - --this.b; - this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D); - } else if (this.b == 0) { -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 7064fd8e8318797a94b5292d675992a902b681ab..914ff5b7a9787ae5e8d5b8829e6888ba2637cc26 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -55,6 +55,12 @@ public class EntityTNTPrimed extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java +index c2e7161dc103c971908ff217eaf972e9f175d044..4f4b2b8d58223fa22d6a7af5c94cfb36399b9641 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java +@@ -70,6 +70,12 @@ public class EntityTNTPrimed extends Entity { } this.move(EnumMoveType.SELF, this.getMot()); @@ -92,3 +75,20 @@ index 7064fd8e8318797a94b5292d675992a902b681ab..914ff5b7a9787ae5e8d5b8829e6888ba this.setMot(this.getMot().a(0.98D)); if (this.onGround) { this.setMot(this.getMot().d(0.7D, -0.5D, 0.7D)); +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +index ee31704ffb88ab68702657554d386e8ebfa05d03..4bec5c1d504b9456dafe1b76bdbb523d0a324abe 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartTNT.java +@@ -47,6 +47,12 @@ public class EntityMinecartTNT extends EntityMinecartAbstract { + public void tick() { + super.tick(); + if (this.b > 0) { ++ // Paper start - Configurable TNT entity height nerf ++ if (this.world.paperConfig.entityTNTHeightNerf != 0 && this.locY() > this.world.paperConfig.entityTNTHeightNerf) { ++ this.die(); ++ return; ++ } ++ // Paper end + --this.b; + this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D); + } else if (this.b == 0) { diff --git a/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch b/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch index 1c93f1798d..2a4b45caf9 100644 --- a/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch +++ b/Spigot-Server-Patches/0018-Show-Paper-in-client-crashes-server-lists-and-Mojang.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Show 'Paper' in client crashes, server lists, and Mojang diff --git a/src/main/java/net/minecraft/server/EULA.java b/src/main/java/net/minecraft/server/EULA.java -index aab33df7a36eb69300fedfce733985d6c239ca01..550232cb3819138b3bae0fa1c51429485e8bc593 100644 +index a5171d28b960b12c2743ea68a36d747bc967697d..a0f53c9eff04a40780b3ba568dbfc5bbe9bd8504 100644 --- a/src/main/java/net/minecraft/server/EULA.java +++ b/src/main/java/net/minecraft/server/EULA.java -@@ -70,7 +70,7 @@ public class EULA { +@@ -72,7 +72,7 @@ public class EULA { Properties properties = new Properties(); properties.setProperty("eula", "false"); @@ -19,10 +19,10 @@ index aab33df7a36eb69300fedfce733985d6c239ca01..550232cb3819138b3bae0fa1c5142948 throwable = throwable1; throw throwable1; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c1a651a1c2d5ffed80e4517e465901bb39274548..82768ab4663b6dc220212581f92bf8c5188c73b5 100644 +index 422ee5fb0d917399b2b1e5d893219405c5dbe82d..60a768ea8ffa965dd309c05bebddf5563b5e1992 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1225,7 +1225,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant affectsSpawning = (entity) -> { ++ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning; ++ }; ++ // Paper end ++ + public static Predicate a(double d0, double d1, double d2, double d3) { + double d4 = d3 * d3; + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java b/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java +index 0b3b430766fba602e74727f78173567ca10fabc6..e1fcb1be102822e87eaf7757fbd64a516b2f58ac 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySilverfish.java +@@ -122,7 +122,7 @@ public class EntitySilverfish extends EntityMonster { + if (c(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { + EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true); + +- return entityhuman == null; ++ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API + } else { + return false; + } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 1017ee73b8617ce2b6734469fa49aaff7563c2b1..f42e16589476c1bd10b13214dda5ac7bb3e52131 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -164,6 +164,9 @@ public abstract class EntityHuman extends EntityLiving { private final ItemCooldown bM; @Nullable public EntityFishingHook hookedFish; @@ -30,37 +73,11 @@ index 1a4f49a019134ecd50542f0099e44f164aa9b690..dcc9984665a1b6458cee317bb79a3343 // CraftBukkit start public boolean fauxSleeping; -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 15b0d48e9dfe707b2859564b33206085f5a4e0db..a819fc46bebc4b1aaae63f822087574e976e2ab8 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -691,7 +691,7 @@ public abstract class EntityInsentient extends EntityLiving { - if (this.world.getDifficulty() == EnumDifficulty.PEACEFUL && this.L()) { - this.die(); - } else if (!this.isPersistent() && !this.isSpecialPersistence()) { -- EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D); -+ EntityHuman entityhuman = this.world.findNearbyPlayer(this, -1.0D, IEntitySelector.affectsSpawning); // Paper - - if (entityhuman != null) { - double d0 = entityhuman.h((Entity) this); // CraftBukkit - decompile error -diff --git a/src/main/java/net/minecraft/server/EntitySilverfish.java b/src/main/java/net/minecraft/server/EntitySilverfish.java -index f5899fc014cfcc4b7e769d51e867ce1eaf625188..28b490cc14f5881eb83acfbd6f30f9163ffe1926 100644 ---- a/src/main/java/net/minecraft/server/EntitySilverfish.java -+++ b/src/main/java/net/minecraft/server/EntitySilverfish.java -@@ -95,7 +95,7 @@ public class EntitySilverfish extends EntityMonster { - if (c(entitytypes, generatoraccess, enummobspawn, blockposition, random)) { - EntityHuman entityhuman = generatoraccess.a((double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, 5.0D, true); - -- return entityhuman == null; -+ return !(entityhuman != null && !entityhuman.affectsSpawning) && entityhuman == null; // Paper - Affects Spawning API - } else { - return false; - } -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index f433e1f6e6d430bd35a0fb54ee85295ea06f53bd..14400d0e4b0713e852861ed55e289e4dead95cea 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -83,8 +83,9 @@ public interface IEntityAccess { +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index 4ece69851e7b05016f52c291ce911eb791cf3a23..6d5d4c3df65995b9a13b66d070ba08d553cc98a2 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java +@@ -92,8 +92,9 @@ public interface IEntityAccess { } } @@ -72,7 +89,7 @@ index f433e1f6e6d430bd35a0fb54ee85295ea06f53bd..14400d0e4b0713e852861ed55e289e4d double d4 = -1.0D; EntityHuman entityhuman = null; Iterator iterator = this.getPlayers().iterator(); -@@ -117,6 +118,27 @@ public interface IEntityAccess { +@@ -126,6 +127,27 @@ public interface IEntityAccess { return this.a(d0, d1, d2, d3, predicate); } @@ -100,28 +117,11 @@ index f433e1f6e6d430bd35a0fb54ee85295ea06f53bd..14400d0e4b0713e852861ed55e289e4d default boolean isPlayerNearby(double d0, double d1, double d2, double d3) { Iterator iterator = this.getPlayers().iterator(); -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 143cfd9e99e9e0639bc32dd19efa84535a1fe03d..ff1ddb4db5406f81453a8f075033d00e06bce6a5 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -24,6 +24,12 @@ public final class IEntitySelector { - return !entity.isSpectator(); - }; - -+ // Paper start -+ public static final Predicate affectsSpawning = (entity) -> { -+ return !entity.isSpectator() && entity.isAlive() && (entity instanceof EntityPlayer) && ((EntityPlayer) entity).affectsSpawning; -+ }; -+ // Paper end -+ - public static Predicate a(double d0, double d1, double d2, double d3) { - double d4 = d3 * d3; - -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 90af43930f9141b0c7f51bb3d887d7b9c4d935eb..1741ec5e241f8ae7a3c30a9021d14cb0224da840 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -49,7 +49,7 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index 33cba4e475edc0573b901f70c61d3659fd63ad62..8d8b03074df1635946f81bec0feae18d2f3e20aa 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -66,7 +66,7 @@ public abstract class MobSpawnerAbstract { private boolean h() { BlockPosition blockposition = this.b(); @@ -131,7 +131,7 @@ index 90af43930f9141b0c7f51bb3d887d7b9c4d935eb..1741ec5e241f8ae7a3c30a9021d14cb0 public void c() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index c0154a14a4da53b933b121fea585d1c1e4d0e87f..5d446eb731621e2205b684923a06b932d41ba421 100644 +index 137870c7d18c9ef3ae637e83c5457d42ec40c669..e9f5ef73de6fd100dda7ed006dde6635f65b1ab5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1767,8 +1767,20 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0022-Remove-invalid-mob-spawner-tile-entities.patch b/Spigot-Server-Patches/0022-Remove-invalid-mob-spawner-tile-entities.patch index bbd1eaf65c..5abc016389 100644 --- a/Spigot-Server-Patches/0022-Remove-invalid-mob-spawner-tile-entities.patch +++ b/Spigot-Server-Patches/0022-Remove-invalid-mob-spawner-tile-entities.patch @@ -4,11 +4,11 @@ Date: Tue, 1 Mar 2016 15:08:03 -0600 Subject: [PATCH] Remove invalid mob spawner tile entities -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0aea16df16b55b1d4756b51d10c8c22d37aef9a3..0d0f36c62d260390827321aa6472f51a3a204c95 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -614,6 +614,10 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index ac576d268b23148089d404cb22d8c2f9d1a79d6e..0312d68f0f64fa9e5816fe12a09430208ae2b8ce 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -648,6 +648,10 @@ public class Chunk implements IChunkAccess { } // CraftBukkit start @@ -17,5 +17,5 @@ index 0aea16df16b55b1d4756b51d10c8c22d37aef9a3..0d0f36c62d260390827321aa6472f51a + this.tileEntities.remove(blockposition); + // Paper end } else { - System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() + System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ() + " (" + getType(blockposition) + ") where there was no entity tile!"); diff --git a/Spigot-Server-Patches/0023-Optimize-TileEntity-Ticking.patch b/Spigot-Server-Patches/0023-Optimize-TileEntity-Ticking.patch index 141d4043b8..f56bf8b797 100644 --- a/Spigot-Server-Patches/0023-Optimize-TileEntity-Ticking.patch +++ b/Spigot-Server-Patches/0023-Optimize-TileEntity-Ticking.patch @@ -28,11 +28,11 @@ index d4ebcf8f66197299256bd6b65710a1488c90ea41..c9164dfdb27ddf3709129c8aec54903a pair("gamerules", toObjectMapper(world.getWorld().getGameRules(), rule -> { return pair(rule, world.getWorld().getGameRuleValue(rule)); })), -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index 1441d096d44ea653539ba20ccda94eb62ffc32df..fb7c0d45765e36181c809b250ba4eee5d21c5894 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -10,8 +10,8 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java +index 60e7dc1910ae9214d84d65b011cfec278b6b32ae..b229faad99120c67b089f7680d800fbe594fe7da 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java +@@ -54,8 +54,8 @@ import net.minecraft.world.phys.shapes.VoxelShapeCollision; public class BlockChest extends BlockChestAbstract implements IBlockWaterlogged { public static final BlockStateDirection FACING = BlockFacingHorizontal.FACING; @@ -43,23 +43,11 @@ index 1441d096d44ea653539ba20ccda94eb62ffc32df..fb7c0d45765e36181c809b250ba4eee5 protected static final VoxelShape e = Block.a(1.0D, 0.0D, 0.0D, 15.0D, 14.0D, 15.0D); protected static final VoxelShape f = Block.a(1.0D, 0.0D, 1.0D, 15.0D, 14.0D, 16.0D); protected static final VoxelShape g = Block.a(0.0D, 0.0D, 1.0D, 15.0D, 14.0D, 15.0D); -diff --git a/src/main/java/net/minecraft/server/IBlockDataHolder.java b/src/main/java/net/minecraft/server/IBlockDataHolder.java -index 98616f0db75d0e2b2e960dbf88289c87ba426ab6..b19c694cf01bc868dd7c4ec6432b613d19f2ca40 100644 ---- a/src/main/java/net/minecraft/server/IBlockDataHolder.java -+++ b/src/main/java/net/minecraft/server/IBlockDataHolder.java -@@ -83,6 +83,7 @@ public abstract class IBlockDataHolder { - return Collections.unmodifiableCollection(this.b.keySet()); - } - -+ public > boolean contains(IBlockState iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER - public > boolean b(IBlockState iblockstate) { - return this.b.containsKey(iblockstate); - } -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d107c7a72d 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -8,7 +8,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java +index eed95b370d1d624ffc6b7a35357b7028ec58c584..aafd1f7c6c811f9eb2796d865e327f374be9b461 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java +@@ -33,7 +33,7 @@ import org.bukkit.craftbukkit.entity.CraftHumanEntity; import org.bukkit.entity.HumanEntity; // CraftBukkit end @@ -68,7 +56,7 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 private NonNullList items; protected float a; -@@ -86,14 +86,20 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { +@@ -111,14 +111,20 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { return nbttagcompound; } @@ -91,7 +79,7 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 this.b = this.a; float f = 0.1F; -@@ -107,8 +113,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { +@@ -132,8 +138,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { if (this.viewingCount > 0 && this.a == 0.0F) { this.playOpenSound(SoundEffects.BLOCK_CHEST_OPEN); } @@ -104,7 +92,7 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 float f1 = this.a; if (this.viewingCount > 0) { -@@ -124,8 +133,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { +@@ -149,8 +158,11 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { float f2 = 0.5F; if (this.a < 0.5F && f1 >= 0.5F) { @@ -117,7 +105,7 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 if (this.a < 0.0F) { this.a = 0.0F; -@@ -164,6 +176,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { +@@ -189,6 +201,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { } public void playOpenSound(SoundEffect soundeffect) { @@ -125,7 +113,7 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 BlockPropertyChestType blockpropertychesttype = (BlockPropertyChestType) this.getBlock().get(BlockChest.c); if (blockpropertychesttype != BlockPropertyChestType.LEFT) { -@@ -202,6 +215,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { +@@ -227,6 +240,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { ++this.viewingCount; if (this.world == null) return; // CraftBukkit @@ -133,7 +121,7 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 // CraftBukkit start - Call redstone event if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) { -@@ -224,6 +238,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { +@@ -249,6 +263,7 @@ public class TileEntityChest extends TileEntityLootable implements ITickable { --this.viewingCount; // CraftBukkit start - Call redstone event @@ -141,19 +129,20 @@ index 8e5ceacf7f6ed0d639d7850334d8a01a74aef6e3..54cad33750efd80b104664723e1115d1 if (this.getBlock().getBlock() == Blocks.TRAPPED_CHEST) { int newPower = Math.max(0, Math.min(15, this.viewingCount)); -diff --git a/src/main/java/net/minecraft/server/TileEntityEnderChest.java b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -index 4ee3520882df2f6f358f3f61dc42c20129984b72..80440aa24f546dd151e89b705322d9c3e906b139 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEnderChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityEnderChest.java -@@ -1,6 +1,6 @@ - package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java +index 930f1bd091d9754f7ca5d9e36cdf49b2be03eb23..385aed0f8bd9992e0c30d8fca5be4f49bc321183 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEnderChest.java +@@ -5,7 +5,7 @@ import net.minecraft.sounds.SoundEffects; + import net.minecraft.world.entity.player.EntityHuman; + import net.minecraft.world.level.block.Blocks; -public class TileEntityEnderChest extends TileEntity implements ITickable { +public class TileEntityEnderChest extends TileEntity { // Paper - Remove ITickable public float a; public float b; -@@ -11,18 +11,28 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { +@@ -16,18 +16,28 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { super(TileEntityTypes.ENDER_CHEST); } @@ -183,7 +172,7 @@ index 4ee3520882df2f6f358f3f61dc42c20129984b72..80440aa24f546dd151e89b705322d9c3 if (this.c > 0 && this.a == 0.0F) { double d1 = (double) i + 0.5D; -@@ -30,8 +40,17 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { +@@ -35,8 +45,17 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { d0 = (double) k + 0.5D; this.world.playSound((EntityHuman) null, d1, (double) j + 0.5D, d0, SoundEffects.BLOCK_ENDER_CHEST_OPEN, SoundCategory.BLOCKS, 0.5F, this.world.random.nextFloat() * 0.1F + 0.9F); } @@ -202,7 +191,7 @@ index 4ee3520882df2f6f358f3f61dc42c20129984b72..80440aa24f546dd151e89b705322d9c3 float f1 = this.a; if (this.c > 0) { -@@ -47,11 +66,14 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { +@@ -52,11 +71,14 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { float f2 = 0.5F; if (this.a < 0.5F && f1 >= 0.5F) { @@ -218,7 +207,7 @@ index 4ee3520882df2f6f358f3f61dc42c20129984b72..80440aa24f546dd151e89b705322d9c3 if (this.a < 0.0F) { this.a = 0.0F; -@@ -79,11 +101,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { +@@ -84,11 +106,13 @@ public class TileEntityEnderChest extends TileEntity implements ITickable { public void d() { ++this.c; this.world.playBlockAction(this.position, Blocks.ENDER_CHEST, 1, this.c); @@ -232,3 +221,15 @@ index 4ee3520882df2f6f358f3f61dc42c20129984b72..80440aa24f546dd151e89b705322d9c3 } public boolean a(EntityHuman entityhuman) { +diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +index e4b59a85ee9b435b2e86d4c7d78b7224773f6967..ba046cffdd8331c7e0427f19fa54d0c7a99077d9 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java ++++ b/src/main/java/net/minecraft/world/level/block/state/IBlockDataHolder.java +@@ -84,6 +84,7 @@ public abstract class IBlockDataHolder { + return Collections.unmodifiableCollection(this.b.keySet()); + } + ++ public > boolean contains(IBlockState iblockstate) { return this.b(iblockstate); } // Paper - OBFHELPER + public > boolean b(IBlockState iblockstate) { + return this.b.containsKey(iblockstate); + } diff --git a/Spigot-Server-Patches/0024-Further-improve-server-tick-loop.patch b/Spigot-Server-Patches/0024-Further-improve-server-tick-loop.patch index d916dddb7d..10d4ea606d 100644 --- a/Spigot-Server-Patches/0024-Further-improve-server-tick-loop.patch +++ b/Spigot-Server-Patches/0024-Further-improve-server-tick-loop.patch @@ -12,10 +12,10 @@ Previous implementation did not calculate TPS correctly. Switch to a realistic rolling average and factor in std deviation as an extra reporting variable diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 82768ab4663b6dc220212581f92bf8c5188c73b5..f54300a107477e6b6aa79114212f0088dc4f5be5 100644 +index 60a768ea8ffa965dd309c05bebddf5563b5e1992..2b3c32bda846b1a559f9a9d9d6870cb4ec6bfe12 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -146,7 +146,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; public CommandDispatcher vanillaCommandDispatcher; -@@ -155,7 +155,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { + return new int[0]; + } + ++ public final double getDoubleAt(int i) { return this.h(i); } // Paper - OBFHELPER + public double h(int i) { + if (i >= 0 && i < this.list.size()) { + NBTBase nbtbase = (NBTBase) this.list.get(i); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 038944613b6687c057e73eaa038c9492bda7116d..09fa1f8e4e2ccf03fafe477bb9dc32b2a72b41bb 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1244,6 +1244,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.navigators.add(((EntityInsentient) entity).getNavigation()); + } + entity.valid = true; // CraftBukkit ++ // Paper start - Set origin location when the entity is being added to the world ++ if (entity.origin == null) { ++ entity.origin = entity.getBukkitEntity().getLocation(); ++ } ++ // Paper end + } + + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index ca620977666f4d4173089876f506f041ab278bd3..dce47ec1fc186d12ffa30bfd3d71870aecb95d40 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -247,6 +247,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public org.bukkit.projectiles.ProjectileSource projectileSource; // For projectiles only public boolean forceExplosionKnockback; // SPIGOT-949 public boolean persistentInvisibility = false; @@ -16,7 +44,7 @@ index dc996792df6046d442565a7993ec299af6605d92..c6b91de58c0190aca0455aacc04994f8 // Spigot start public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; -@@ -1540,6 +1541,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1625,6 +1626,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.bukkitEntity.storeBukkitValues(nbttagcompound); } // CraftBukkit end @@ -28,7 +56,7 @@ index dc996792df6046d442565a7993ec299af6605d92..c6b91de58c0190aca0455aacc04994f8 return nbttagcompound; } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT"); -@@ -1662,6 +1668,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1747,6 +1753,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } // CraftBukkit end @@ -42,7 +70,7 @@ index dc996792df6046d442565a7993ec299af6605d92..c6b91de58c0190aca0455aacc04994f8 } catch (Throwable throwable) { CrashReport crashreport = CrashReport.a(throwable, "Loading entity NBT"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being loaded"); -@@ -1723,6 +1736,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1808,6 +1821,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne protected abstract void saveData(NBTTagCompound nbttagcompound); @@ -50,11 +78,11 @@ index dc996792df6046d442565a7993ec299af6605d92..c6b91de58c0190aca0455aacc04994f8 protected NBTTagList a(double... adouble) { NBTTagList nbttaglist = new NBTTagList(); double[] adouble1 = adouble; -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 6b226c04d40adff8b0f1d28c0cc79439df002b3d..bdeabfaeb17778a12ab4ad72689a72b043efcff4 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -254,6 +254,14 @@ public class EntityFallingBlock extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +index 901522f24b8bc58861e46eda400dbab92bb6401d..3f10e41b18e09186635fd6f7c653b04db7b39d8e 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +@@ -293,6 +293,14 @@ public class EntityFallingBlock extends Entity { this.block = Blocks.SAND.getBlockData(); } @@ -69,11 +97,11 @@ index 6b226c04d40adff8b0f1d28c0cc79439df002b3d..bdeabfaeb17778a12ab4ad72689a72b0 } public void a(boolean flag) { -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index 914ff5b7a9787ae5e8d5b8829e6888ba2637cc26..f71e82c365947de822be7b87083b46bd7ce4b902 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -105,6 +105,14 @@ public class EntityTNTPrimed extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java +index 4f4b2b8d58223fa22d6a7af5c94cfb36399b9641..535e7d7297d81026b8586d5049b72fa65519b464 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java +@@ -120,6 +120,14 @@ public class EntityTNTPrimed extends Entity { @Override protected void loadData(NBTTagCompound nbttagcompound) { this.setFuseTicks(nbttagcompound.getShort("Fuse")); @@ -88,39 +116,11 @@ index 914ff5b7a9787ae5e8d5b8829e6888ba2637cc26..f71e82c365947de822be7b87083b46bd } @Nullable -diff --git a/src/main/java/net/minecraft/server/NBTTagList.java b/src/main/java/net/minecraft/server/NBTTagList.java -index ad8a506bb430b26fe147a657a2f826daf9bf4d45..ad4807e0bdd6409bd798f995da8f43cec1d0b385 100644 ---- a/src/main/java/net/minecraft/server/NBTTagList.java -+++ b/src/main/java/net/minecraft/server/NBTTagList.java -@@ -188,6 +188,7 @@ public class NBTTagList extends NBTList { - return new int[0]; - } - -+ public final double getDoubleAt(int i) { return this.h(i); } // Paper - OBFHELPER - public double h(int i) { - if (i >= 0 && i < this.list.size()) { - NBTBase nbtbase = (NBTBase) this.list.get(i); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3d915105b277a7cbf330ba2cb3c2f1451ee868e4..02dac635cce43edea05ed4961711ea5394613971 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1135,6 +1135,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.navigators.add(((EntityInsentient) entity).getNavigation()); - } - entity.valid = true; // CraftBukkit -+ // Paper start - Set origin location when the entity is being added to the world -+ if (entity.origin == null) { -+ entity.origin = entity.getBukkitEntity().getLocation(); -+ } -+ // Paper end - } - - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d46ba8d0e3b02a76c02dcc39c87a8bb6c9073149..2ed97dc772535f2364406c298d06fada8167fb74 100644 +index 3cf81734c8580f4d88ea97b6ac737a370b413c84..220bad90bbb9a90c3f23562bf0fb109fce379682 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1063,4 +1063,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1062,4 +1062,12 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return spigot; } // Spigot end diff --git a/Spigot-Server-Patches/0027-Prevent-tile-entity-and-entity-crashes.patch b/Spigot-Server-Patches/0027-Prevent-tile-entity-and-entity-crashes.patch index 5761fad2b6..e725bcb865 100644 --- a/Spigot-Server-Patches/0027-Prevent-tile-entity-and-entity-crashes.patch +++ b/Spigot-Server-Patches/0027-Prevent-tile-entity-and-entity-crashes.patch @@ -4,29 +4,11 @@ Date: Tue, 1 Mar 2016 23:52:34 -0600 Subject: [PATCH] Prevent tile entity and entity crashes -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index c8aa347baf100b25694ed9172590b073db810fe9..5414858ba241c13d4e568191d11111d3d3ec3fc4 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -197,7 +197,12 @@ public abstract class TileEntity implements KeyedObject { // Paper - return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName(); - }); - if (this.world != null) { -- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock()); -+ // Paper start - Prevent TileEntity and Entity crashes -+ IBlockData block = this.getBlock(); -+ if (block != null) { -+ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block); -+ } -+ // Paper end - CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position)); - } - } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 0f602de85bc7002150247b6cb26c6905f0e4f585..bc1946ea3060220f4598aae2e1aed3d84ab18387 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -685,11 +685,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 62735e7908f86e31f7a89ce2071ddebe176c0385..87e37c38825ad20fc11f41ea2a4512753266d2b4 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -737,11 +737,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.exit(); } catch (Throwable throwable) { @@ -45,7 +27,7 @@ index 0f602de85bc7002150247b6cb26c6905f0e4f585..bc1946ea3060220f4598aae2e1aed3d8 // Spigot start } finally { tileentity.tickTimer.stopTiming(); -@@ -754,11 +756,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -806,11 +808,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { consumer.accept(entity); } catch (Throwable throwable) { @@ -63,3 +45,21 @@ index 0f602de85bc7002150247b6cb26c6905f0e4f585..bc1946ea3060220f4598aae2e1aed3d8 } } +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index da39fcb22d7656eedb8bf7d0774f50018b9fb02b..b1c220df7e00af79b548895cc9333ba85d5a447f 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -207,7 +207,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / + return IRegistry.BLOCK_ENTITY_TYPE.getKey(this.getTileType()) + " // " + this.getClass().getCanonicalName(); + }); + if (this.world != null) { +- CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.getBlock()); ++ // Paper start - Prevent TileEntity and Entity crashes ++ IBlockData block = this.getBlock(); ++ if (block != null) { ++ CrashReportSystemDetails.a(crashreportsystemdetails, this.position, block); ++ } ++ // Paper end + CrashReportSystemDetails.a(crashreportsystemdetails, this.position, this.world.getType(this.position)); + } + } diff --git a/Spigot-Server-Patches/0028-Configurable-top-of-nether-void-damage.patch b/Spigot-Server-Patches/0028-Configurable-top-of-nether-void-damage.patch index 9c5fbe6b57..69c1692940 100644 --- a/Spigot-Server-Patches/0028-Configurable-top-of-nether-void-damage.patch +++ b/Spigot-Server-Patches/0028-Configurable-top-of-nether-void-damage.patch @@ -28,11 +28,11 @@ index d16ae924bcbe31c964f7fb448757c748e5c4418c..4bba6977a0287837b8927718c040ac61 + } + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 48ebaa4cdb5d5f52334e7bd4f80309a10ecedfa9..8850047050ca8a608c156b63bc6e05eaef140d03 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -415,9 +415,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index dce47ec1fc186d12ffa30bfd3d71870aecb95d40..cf92de7c138ef9cbbc1263bee29b9d0017b45827 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -500,9 +500,16 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.fallDistance *= 0.5F; } @@ -49,7 +49,7 @@ index 48ebaa4cdb5d5f52334e7bd4f80309a10ecedfa9..8850047050ca8a608c156b63bc6e05ea if (!this.world.isClientSide) { this.setFlag(0, this.fireTicks > 0); -@@ -510,6 +517,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -595,6 +602,17 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.setFireTicks(0); } @@ -67,11 +67,11 @@ index 48ebaa4cdb5d5f52334e7bd4f80309a10ecedfa9..8850047050ca8a608c156b63bc6e05ea protected void an() { this.die(); } -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index dcd381069c2fd4d037ae0bcf710b9ff6ee30bb8f..35b5d41084b47de6a1185e23970ebe21875668d6 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -292,9 +292,15 @@ public abstract class EntityMinecartAbstract extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +index 37785b27c3d9ffd010f09f53b2ca09941f609872..1f94cc096d95129d85a6278b1e369729df93d27d 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +@@ -330,9 +330,15 @@ public abstract class EntityMinecartAbstract extends Entity { this.setDamage(this.getDamage() - 1.0F); } diff --git a/Spigot-Server-Patches/0029-Check-online-mode-before-converting-and-renaming-pla.patch b/Spigot-Server-Patches/0029-Check-online-mode-before-converting-and-renaming-pla.patch index b9d6ee1e6f..386f7f1615 100644 --- a/Spigot-Server-Patches/0029-Check-online-mode-before-converting-and-renaming-pla.patch +++ b/Spigot-Server-Patches/0029-Check-online-mode-before-converting-and-renaming-pla.patch @@ -4,11 +4,11 @@ Date: Wed, 2 Mar 2016 00:03:55 -0600 Subject: [PATCH] Check online mode before converting and renaming player data -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 88e0c5167ce545ef98868947b2722c55bbc46687..6a9e0e644801ddc5f18a47d15d5f6d5b6dc13004 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -49,7 +49,7 @@ public class WorldNBTStorage { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java +index c3a1b5943b0dad8701d566c45b9b474dac7e5c8a..191c9e9a00b9871038f60d54bc22620322f6bdbd 100644 +--- a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java +@@ -56,7 +56,7 @@ public class WorldNBTStorage { File file = new File(this.playerDir, entityhuman.getUniqueIDString() + ".dat"); // Spigot Start boolean usingWrongFile = false; diff --git a/Spigot-Server-Patches/0030-Always-tick-falling-blocks.patch b/Spigot-Server-Patches/0030-Always-tick-falling-blocks.patch index e75c94b5a7..4352384dba 100644 --- a/Spigot-Server-Patches/0030-Always-tick-falling-blocks.patch +++ b/Spigot-Server-Patches/0030-Always-tick-falling-blocks.patch @@ -5,18 +5,10 @@ Subject: [PATCH] Always tick falling blocks diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 093a11b6e355f9e1236ecca921ea55488d70451d..d44ef056bdab3bcff39aea45b40a4c7e9c62398f 100644 +index 69c5d4e51ebf747d931fadc819973e36f001f5bc..58d22363124a9343188d8c19476e5a92f2f0b80b 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -12,6 +12,7 @@ import net.minecraft.server.EntityCreature; - import net.minecraft.server.EntityCreeper; - import net.minecraft.server.EntityEnderCrystal; - import net.minecraft.server.EntityEnderDragon; -+import net.minecraft.server.EntityFallingBlock; // Paper - import net.minecraft.server.EntityFireball; - import net.minecraft.server.EntityFireworks; - import net.minecraft.server.EntityHuman; -@@ -91,6 +92,7 @@ public class ActivationRange +@@ -91,6 +91,7 @@ public class ActivationRange || entity instanceof EntityFireball || entity instanceof EntityLightning || entity instanceof EntityTNTPrimed diff --git a/Spigot-Server-Patches/0031-Configurable-end-credits.patch b/Spigot-Server-Patches/0031-Configurable-end-credits.patch index 73f5065134..2e33269361 100644 --- a/Spigot-Server-Patches/0031-Configurable-end-credits.patch +++ b/Spigot-Server-Patches/0031-Configurable-end-credits.patch @@ -19,11 +19,11 @@ index 4bba6977a0287837b8927718c040ac61463f0469..e6e18f309dc09ea9416ea37dcc697ddc + log("End credits disabled: " + disableEndCredits); + } } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0445bffdd1a6c9548c5c98c1ea4fd2c0c517acf4..317d9688fb4bc8a885314a6879f561d5cb44fa26 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -63,7 +63,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 0ff92d701d6ee5ce56eec624eece11de15195b41..a9eb414843381e7697c46af4b68f61b68755afde 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -190,7 +190,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private long ca = SystemUtils.getMonotonicMillis(); private Entity spectatedEntity; public boolean worldChangeInvuln; @@ -32,7 +32,7 @@ index 0445bffdd1a6c9548c5c98c1ea4fd2c0c517acf4..317d9688fb4bc8a885314a6879f561d5 private final RecipeBookServer recipeBook = new RecipeBookServer(); private Vec3D cf; private int cg; -@@ -768,6 +768,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -895,6 +895,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.decouple(); this.getWorldServer().removePlayer(this); if (!this.viewingCredits) { diff --git a/Spigot-Server-Patches/0032-Fix-lag-from-explosions-processing-dead-entities.patch b/Spigot-Server-Patches/0032-Fix-lag-from-explosions-processing-dead-entities.patch index d0457fefc2..85ee818286 100644 --- a/Spigot-Server-Patches/0032-Fix-lag-from-explosions-processing-dead-entities.patch +++ b/Spigot-Server-Patches/0032-Fix-lag-from-explosions-processing-dead-entities.patch @@ -4,11 +4,11 @@ Date: Wed, 2 Mar 2016 01:39:52 -0600 Subject: [PATCH] Fix lag from explosions processing dead entities -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 583833f8634cb5b02cd8dcbb74c9876fb854bceb..afe61a1ddc75f155836411b6749198f71ed09919 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -154,7 +154,7 @@ public class Explosion { +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index 9c1ad56e4362cd86e7ffe2aef7fd9ec301cf9002..7786a06ba09aacaa70c346e85a9eeed9f2ffec6e 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -182,7 +182,7 @@ public class Explosion { int i1 = MathHelper.floor(this.posY + (double) f2 + 1.0D); int j1 = MathHelper.floor(this.posZ - (double) f2 - 1.0D); int k1 = MathHelper.floor(this.posZ + (double) f2 + 1.0D); diff --git a/Spigot-Server-Patches/0033-Optimize-explosions.patch b/Spigot-Server-Patches/0033-Optimize-explosions.patch index d9eb1389f5..500e22f11b 100644 --- a/Spigot-Server-Patches/0033-Optimize-explosions.patch +++ b/Spigot-Server-Patches/0033-Optimize-explosions.patch @@ -24,11 +24,23 @@ index e6e18f309dc09ea9416ea37dcc697ddc2b571a96..4881b03d470646843bad1bc343eb6a6a + log("Optimize explosions: " + optimizeExplosions); + } } -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index afe61a1ddc75f155836411b6749198f71ed09919..ac39b02ec5f02f6f2db9f293513686d2d29d4036 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -173,7 +173,7 @@ public class Explosion { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 2b3c32bda846b1a559f9a9d9d6870cb4ec6bfe12..2c295e070a0418c7d3bc4a4a531df699acadb0ff 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1316,6 +1316,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0) { diff --git a/Spigot-Server-Patches/0038-Send-absolute-position-the-first-time-an-entity-is-s.patch b/Spigot-Server-Patches/0038-Send-absolute-position-the-first-time-an-entity-is-s.patch index 0f76ae04ba..1842bc6ca3 100644 --- a/Spigot-Server-Patches/0038-Send-absolute-position-the-first-time-an-entity-is-s.patch +++ b/Spigot-Server-Patches/0038-Send-absolute-position-the-first-time-an-entity-is-s.patch @@ -4,10 +4,10 @@ Date: Wed, 2 Mar 2016 23:13:07 -0600 Subject: [PATCH] Send absolute position the first time an entity is seen -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 62a7db8c7d2604d248ec5c1efb3c43356c3d513c..dec48226d713ef0198ef3c679daf553a9d05a099 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index a95867c0ba7dec750e07a4ac623ee30b4522fe55..f5227aa761d326376d057eaadcdbef024ed30241 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java @@ -4,6 +4,7 @@ import com.google.common.collect.Lists; import com.mojang.datafixers.util.Pair; import java.util.Collection; @@ -16,7 +16,7 @@ index 62a7db8c7d2604d248ec5c1efb3c43356c3d513c..dec48226d713ef0198ef3c679daf553a import java.util.Iterator; import java.util.List; import java.util.Set; -@@ -23,7 +24,7 @@ public class EntityTrackerEntry { +@@ -52,7 +53,7 @@ public class EntityTrackerEntry { private final Entity tracker; private final int d; private final boolean e; @@ -25,7 +25,7 @@ index 62a7db8c7d2604d248ec5c1efb3c43356c3d513c..dec48226d713ef0198ef3c679daf553a private long xLoc; private long yLoc; private long zLoc; -@@ -38,8 +39,23 @@ public class EntityTrackerEntry { +@@ -67,8 +68,23 @@ public class EntityTrackerEntry { private boolean r; // CraftBukkit start private final Set trackedPlayers; @@ -49,7 +49,7 @@ index 62a7db8c7d2604d248ec5c1efb3c43356c3d513c..dec48226d713ef0198ef3c679daf553a this.trackedPlayers = trackedPlayers; // CraftBukkit end this.m = Vec3D.ORIGIN; -@@ -161,7 +177,25 @@ public class EntityTrackerEntry { +@@ -190,7 +206,25 @@ public class EntityTrackerEntry { } if (packet1 != null) { @@ -76,11 +76,11 @@ index 62a7db8c7d2604d248ec5c1efb3c43356c3d513c..dec48226d713ef0198ef3c679daf553a } this.c(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 5ca081e8be411aee98efce3e41876efe3bb2e327..2ba10ed683788219c734a565a163ba553ec72c75 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1250,10 +1250,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 8219ffea086a446a682479ae21ca7d56a598751a..21282ce37e55cbca027c7542c148928fd4e69dfc 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -1294,10 +1294,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final Entity tracker; private final int trackingDistance; private SectionPosition e; @@ -97,7 +97,7 @@ index 5ca081e8be411aee98efce3e41876efe3bb2e327..2ba10ed683788219c734a565a163ba55 this.tracker = entity; this.trackingDistance = i; this.e = SectionPosition.a(entity); -@@ -1335,7 +1339,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1379,7 +1383,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entityplayer.removeQueue.remove(Integer.valueOf(this.tracker.getId())); // CraftBukkit end diff --git a/Spigot-Server-Patches/0039-Add-BeaconEffectEvent.patch b/Spigot-Server-Patches/0039-Add-BeaconEffectEvent.patch index 45629e6768..a2c0b8f5b8 100644 --- a/Spigot-Server-Patches/0039-Add-BeaconEffectEvent.patch +++ b/Spigot-Server-Patches/0039-Add-BeaconEffectEvent.patch @@ -4,11 +4,11 @@ Date: Wed, 2 Mar 2016 23:30:53 -0600 Subject: [PATCH] Add BeaconEffectEvent -diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index 1305506d27010e4be03032c9863bed186e2bff06..fdf73eca821bab5ec7a742645893793679b5d42c 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeacon.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -12,6 +12,11 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +index c6914c8d2a3d1057c98537a3538097d3ac6149e0..f9b1ab0e19ff398a16b1452e86f1a165a4b54219 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +@@ -42,6 +42,11 @@ import net.minecraft.world.phys.AxisAlignedBB; import org.bukkit.craftbukkit.potion.CraftPotionUtil; import org.bukkit.potion.PotionEffect; // CraftBukkit end @@ -20,7 +20,7 @@ index 1305506d27010e4be03032c9863bed186e2bff06..fdf73eca821bab5ec7a7426458937936 public class TileEntityBeacon extends TileEntity implements ITileInventory, ITickable { -@@ -238,14 +243,31 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -268,14 +273,31 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic } private void applyEffect(List list, MobEffectList effects, int i, int b0) { @@ -53,7 +53,7 @@ index 1305506d27010e4be03032c9863bed186e2bff06..fdf73eca821bab5ec7a7426458937936 } } } -@@ -268,10 +290,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -298,10 +320,10 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic int i = getLevel(); List list = getHumansInRange(); diff --git a/Spigot-Server-Patches/0040-Configurable-container-update-tick-rate.patch b/Spigot-Server-Patches/0040-Configurable-container-update-tick-rate.patch index 3701ee14fc..dba7f990d8 100644 --- a/Spigot-Server-Patches/0040-Configurable-container-update-tick-rate.patch +++ b/Spigot-Server-Patches/0040-Configurable-container-update-tick-rate.patch @@ -18,11 +18,11 @@ index 4de86b09c6bc3c1974ce61b550ccb73d37f6f170..5a4c3a8c511f22c8c3240c9c7cd83a65 + containerUpdateTickRate = getInt("container-update-tick-rate", 1); + } } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 317d9688fb4bc8a885314a6879f561d5cb44fa26..5dd83b62d8d6f8f7b8483064be5658a439824052 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -82,6 +82,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index a9eb414843381e7697c46af4b68f61b68755afde..1f31104a1a350f3b53ce45b034cafe528d406291 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -209,6 +209,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean e; public int ping; public boolean viewingCredits; @@ -30,7 +30,7 @@ index 317d9688fb4bc8a885314a6879f561d5cb44fa26..5dd83b62d8d6f8f7b8483064be5658a4 // CraftBukkit start public String displayName; -@@ -406,7 +407,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -533,7 +534,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { --this.noDamageTicks; } diff --git a/Spigot-Server-Patches/0042-Disable-spigot-tick-limiters.patch b/Spigot-Server-Patches/0042-Disable-spigot-tick-limiters.patch index 7699cd6a0f..54851e5ccf 100644 --- a/Spigot-Server-Patches/0042-Disable-spigot-tick-limiters.patch +++ b/Spigot-Server-Patches/0042-Disable-spigot-tick-limiters.patch @@ -4,11 +4,11 @@ Date: Wed, 2 Mar 2016 23:45:17 -0600 Subject: [PATCH] Disable spigot tick limiters -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ca874ef00a925095c01767f5b41737302645f149..564e252a366ed5df602ea4d608f482c80a187606 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -655,9 +655,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 06455fb3916e347c075c6aa84977dca7e25760c2..26d9388badb0328735abf0319a42bd633c90dc4b 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -707,9 +707,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Spigot start // Iterator iterator = this.tileEntityListTick.iterator(); int tilesThisCycle = 0; diff --git a/Spigot-Server-Patches/0043-Add-PlayerInitialSpawnEvent.patch b/Spigot-Server-Patches/0043-Add-PlayerInitialSpawnEvent.patch index dc6e88d617..616ed8869e 100644 --- a/Spigot-Server-Patches/0043-Add-PlayerInitialSpawnEvent.patch +++ b/Spigot-Server-Patches/0043-Add-PlayerInitialSpawnEvent.patch @@ -8,11 +8,11 @@ For modifying a player's initial spawn location as they join the server This is a duplicate API from spigot, so use our duplicate subclass and improve setPosition to use raw -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index d1b26d753774ef89638a1c5130b10f16a6c743d8..c71dea3e51c93cf1ad60b8a76408774d67552de8 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -140,7 +140,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 15418868c2b92498139e66d913ee1c35b3abf0cf..cfd0af520dd3dcf364a3ffd03a74e3b9ee6045af 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -213,7 +213,7 @@ public abstract class PlayerList { // Spigot start - spawn location event Player bukkitPlayer = entityplayer.getBukkitEntity(); @@ -21,12 +21,28 @@ index d1b26d753774ef89638a1c5130b10f16a6c743d8..c71dea3e51c93cf1ad60b8a76408774d cserver.getPluginManager().callEvent(ev); Location loc = ev.getSpawnLocation(); -@@ -148,7 +148,7 @@ public abstract class PlayerList { +@@ -221,7 +221,10 @@ public abstract class PlayerList { entityplayer.spawnIn(worldserver1); entityplayer.playerInteractManager.a((WorldServer) entityplayer.world); -- entityplayer.setPosition(loc.getX(), loc.getY(), loc.getZ()); -+ entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); // Paper - set raw so we aren't fully joined to the world (not added to chunk or world) - entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); +- entityplayer.setLocation(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch()); ++ // Paper start - set raw so we aren't fully joined to the world (not added to chunk or world) ++ entityplayer.setPositionRaw(loc.getX(), loc.getY(), loc.getZ()); ++ entityplayer.setYawPitch(loc.getYaw(), loc.getPitch()); ++ // Paper end // Spigot end + // CraftBukkit - Moved message to after join +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index cf92de7c138ef9cbbc1263bee29b9d0017b45827..10cbf66f06b31c9a4cae2359b3fbb9988abb9278 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -398,7 +398,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + return d1 * d1 + d2 * d2 + d3 * d3 < d0 * d0; + } + +- protected void setYawPitch(float f, float f1) { ++ public void setYawPitch(float f, float f1) { // Paper - protected -> public + // CraftBukkit start - yaw was sometimes set to NaN, so we need to set it back to 0 + if (Float.isNaN(f)) { + f = 0; diff --git a/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch b/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch index b6d28c6b4d..9c34c4ef30 100644 --- a/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch +++ b/Spigot-Server-Patches/0044-Configurable-Disabling-Cat-Chest-Detection.patch @@ -19,11 +19,11 @@ index 5a4c3a8c511f22c8c3240c9c7cd83a65119c1054..70e074cdf2087e638af8e0f3878d0ef8 + disableChestCatDetection = getBoolean("game-mechanics.disable-chest-cat-detection", false); + } } -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index fb7c0d45765e36181c809b250ba4eee5d21c5894..12a0230448dd8d56f6dc20e23cacaf0b8a9433d1 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -268,6 +268,11 @@ public class BlockChest extends BlockChestAbstract implements I +diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java +index b229faad99120c67b089f7680d800fbe594fe7da..b2c29cff5883868cb56a4e376ab946ac929abc94 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java +@@ -312,6 +312,11 @@ public class BlockChest extends BlockChestAbstract implements I } private static boolean b(GeneratorAccess generatoraccess, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0045-Ensure-commands-are-not-ran-async.patch b/Spigot-Server-Patches/0045-Ensure-commands-are-not-ran-async.patch index fde755bb95..eb2bc5f6aa 100644 --- a/Spigot-Server-Patches/0045-Ensure-commands-are-not-ran-async.patch +++ b/Spigot-Server-Patches/0045-Ensure-commands-are-not-ran-async.patch @@ -13,11 +13,11 @@ This change will synchronize the command execution back to the main thread, caus big slowdown in execution but throwing an exception at same time to raise awareness that it is happening so that plugin authors can fix their code to stop executing commands async. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 5636a76f1a893dc0609f16a240ae559396a4b46d..bb74049fb2baffbe67f9e34cc0ee0b83180d02eb 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1706,6 +1706,29 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index c417250f66805788d63434e2c360349a39996176..a70fb56b0f44372cc62adbb9a263684224c264d2 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1851,6 +1851,29 @@ public class PlayerConnection implements PacketListenerPlayIn { } if (!async && s.startsWith("/")) { @@ -48,7 +48,7 @@ index 5636a76f1a893dc0609f16a240ae559396a4b46d..bb74049fb2baffbe67f9e34cc0ee0b83 } else if (this.player.getChatFlags() == EnumChatVisibility.SYSTEM) { // Do nothing, this is coming from a plugin diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 4fdc38de35ce2f3ec20c6892bc9eb39ec0366498..66cbc94b8d5cb9e435e0fb32596f8f3cef0a49a5 100644 +index f84fe5929cb7bcedff5fc587163380172bc1e8be..8e9547fc745e8244ca1f439770571ca1175ff632 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -762,6 +762,29 @@ public final class CraftServer implements Server { @@ -106,7 +106,7 @@ index aeed7697254af17ffefe8e578353ad216e15f9f3..9f7d2ef932ab41cef5d3d0736d20a7c7 public static void catchOp(String reason) { diff --git a/src/main/java/org/spigotmc/RestartCommand.java b/src/main/java/org/spigotmc/RestartCommand.java -index 56445844c7f542dd74c166bb09abd79cc17e1e12..26795b22e3ebc9594af79f93506a3c217cb784e2 100644 +index d76e01d73da7413f192132134caf201d7780e3f1..a45155cdd7d7a302c119f75bfe2b428ae5e8ab47 100644 --- a/src/main/java/org/spigotmc/RestartCommand.java +++ b/src/main/java/org/spigotmc/RestartCommand.java @@ -43,6 +43,7 @@ public class RestartCommand extends Command diff --git a/Spigot-Server-Patches/0046-All-chunks-are-slime-spawn-chunks-toggle.patch b/Spigot-Server-Patches/0046-All-chunks-are-slime-spawn-chunks-toggle.patch index ffb0629259..48622f89ba 100644 --- a/Spigot-Server-Patches/0046-All-chunks-are-slime-spawn-chunks-toggle.patch +++ b/Spigot-Server-Patches/0046-All-chunks-are-slime-spawn-chunks-toggle.patch @@ -18,11 +18,11 @@ index 70e074cdf2087e638af8e0f3878d0ef8eb7305cc..416a6760883cb40367535c7c5acd7797 + allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); + } } -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index d6ecdbfcebeda8e9f599d7ac28e7cdaa8dc852a8..d774a0893b2e6599bade3a9edf22668a30587503 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -286,7 +286,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +index 292789d76da400d15d0742e2e0979f4ac6ec4b75..01d5b0db9a34d88172e8c7c84c4e1d0b2562217c 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +@@ -325,7 +325,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { } ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(blockposition); diff --git a/Spigot-Server-Patches/0049-Player-Tab-List-and-Title-APIs.patch b/Spigot-Server-Patches/0049-Player-Tab-List-and-Title-APIs.patch index 3291612586..25584dbe13 100644 --- a/Spigot-Server-Patches/0049-Player-Tab-List-and-Title-APIs.patch +++ b/Spigot-Server-Patches/0049-Player-Tab-List-and-Title-APIs.patch @@ -4,23 +4,11 @@ Date: Thu, 3 Mar 2016 02:32:10 -0600 Subject: [PATCH] Player Tab List and Title APIs -diff --git a/src/main/java/net/minecraft/server/IChatBaseComponent.java b/src/main/java/net/minecraft/server/IChatBaseComponent.java -index 921fe6399745318c18570360fb438c45762b1b8e..2b8916e3b3ecfd3917b5acf3ea6dfc2793e242c8 100644 ---- a/src/main/java/net/minecraft/server/IChatBaseComponent.java -+++ b/src/main/java/net/minecraft/server/IChatBaseComponent.java -@@ -359,6 +359,7 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable { +diff --git a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java +index c7c191b0a9889450fdf495f5aa45d59f159f1401..e0fe2ba95bd3cb6afcf9c804007438a513c095b7 100644 +--- a/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java ++++ b/src/main/java/net/minecraft/network/chat/IChatBaseComponent.java +@@ -363,6 +363,7 @@ public interface IChatBaseComponent extends Message, IChatFormatted, Iterable { } } @@ -54,7 +54,7 @@ index 772ca6256964692a2b9c12e2edc532d2a8f51f7b..71168d9d0252e93253fa3b3f0bface3a @Override public void b(PacketDataSerializer packetdataserializer) throws IOException { -@@ -52,6 +63,8 @@ public class PacketPlayOutTitle implements Packet { +@@ -55,6 +66,8 @@ public class PacketPlayOutTitle implements Packet { // Paper start if (this.adventure$text != null) { packetdataserializer.writeComponent(this.adventure$text); @@ -64,7 +64,7 @@ index 772ca6256964692a2b9c12e2edc532d2a8f51f7b..71168d9d0252e93253fa3b3f0bface3a // Paper end packetdataserializer.a(this.b); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 2e7e2ed1bb7d42a6ac26a6da965ed4eed9c8b554..efc8f23b43f9b9765b3c49f9dde9fdbe64291cd4 100644 +index 62f8d96f996ece87b7ab8d5d05d1dc214d10dbfa..9837f7364f3efd0aa22d33058bec369c41cd03ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,6 @@ diff --git a/Spigot-Server-Patches/0050-Ensure-inv-drag-is-in-bounds.patch b/Spigot-Server-Patches/0050-Ensure-inv-drag-is-in-bounds.patch index 39967f1538..3d814228e9 100644 --- a/Spigot-Server-Patches/0050-Ensure-inv-drag-is-in-bounds.patch +++ b/Spigot-Server-Patches/0050-Ensure-inv-drag-is-in-bounds.patch @@ -4,11 +4,11 @@ Date: Thu, 3 Mar 2016 02:33:53 -0600 Subject: [PATCH] Ensure inv drag is in bounds -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 4ae2f06f527503bfdd366d8210a55ced073f0c52..1045bd6eaa977b0142b4496c3f872ffae767a0f1 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java -@@ -223,7 +223,7 @@ public abstract class Container { +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java +index 2410214a300407ef20ea14244db5db2ebede2759..e9733fd9dac89d31dbad391cb22a8c84216045db 100644 +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java +@@ -239,7 +239,7 @@ public abstract class Container { this.d(); } } else if (this.h == 1) { diff --git a/Spigot-Server-Patches/0051-Change-implementation-of-tile-entity-removal-list.patch b/Spigot-Server-Patches/0051-Change-implementation-of-tile-entity-removal-list.patch index 2f1303e147..05bc8dac6d 100644 --- a/Spigot-Server-Patches/0051-Change-implementation-of-tile-entity-removal-list.patch +++ b/Spigot-Server-Patches/0051-Change-implementation-of-tile-entity-removal-list.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Change implementation of (tile)entity removal list use sets for faster removal -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 564e252a366ed5df602ea4d608f482c80a187606..895436e36e6ef6f78dfd42e3ef3a0132506663f2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -37,7 +37,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 26d9388badb0328735abf0319a42bd633c90dc4b..33469b719d679c65d4bcb8366008e6e107eb3a0b 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -89,7 +89,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public final List tileEntityList = Lists.newArrayList(); public final List tileEntityListTick = Lists.newArrayList(); protected final List tileEntityListPending = Lists.newArrayList(); diff --git a/Spigot-Server-Patches/0052-Add-configurable-portal-search-radius.patch b/Spigot-Server-Patches/0052-Add-configurable-portal-search-radius.patch index 480af3a30b..7c478fce6a 100644 --- a/Spigot-Server-Patches/0052-Add-configurable-portal-search-radius.patch +++ b/Spigot-Server-Patches/0052-Add-configurable-portal-search-radius.patch @@ -22,11 +22,11 @@ index 416a6760883cb40367535c7c5acd779742bb8af5..670efbe53241a0ae32d618c83da601cc + portalSearchVanillaDimensionScaling = getBoolean("portal-search-vanilla-dimension-scaling", true); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 8850047050ca8a608c156b63bc6e05eaef140d03..295fbae9946fda8061c5c7294cdaefc426d0edce 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2528,7 +2528,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 10cbf66f06b31c9a4cae2359b3fbb9988abb9278..40eb6bae8ca4e2b57d4f91547808eb00ac1fd455 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2613,7 +2613,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne double d4 = DimensionManager.a(this.world.getDimensionManager(), worldserver.getDimensionManager()); BlockPosition blockposition = new BlockPosition(MathHelper.a(this.locX() * d4, d0, d2), this.locY(), MathHelper.a(this.locZ() * d4, d1, d3)); // CraftBukkit start @@ -41,11 +41,11 @@ index 8850047050ca8a608c156b63bc6e05eaef140d03..295fbae9946fda8061c5c7294cdaefc4 if (event == null) { return null; } -diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java -index 150c688262e79b3b675685dbd1754b9e01cb4d75..e10995ec30dd9a10d781b3c1709fd2db5a9becdd 100644 ---- a/src/main/java/net/minecraft/server/PortalTravelAgent.java -+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java -@@ -14,7 +14,7 @@ public class PortalTravelAgent { +diff --git a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java +index 7b8e8a7dae47ecc42a57e3f9444caa2ee5b1ef3b..77dfa7eaf178baa55041a829c9dec4851efeedfc 100644 +--- a/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java ++++ b/src/main/java/net/minecraft/world/level/portal/PortalTravelAgent.java +@@ -31,7 +31,7 @@ public class PortalTravelAgent { public Optional findPortal(BlockPosition blockposition, boolean flag) { // CraftBukkit start diff --git a/Spigot-Server-Patches/0053-Add-velocity-warnings.patch b/Spigot-Server-Patches/0053-Add-velocity-warnings.patch index 8cfcf04b99..eba37e215b 100644 --- a/Spigot-Server-Patches/0053-Add-velocity-warnings.patch +++ b/Spigot-Server-Patches/0053-Add-velocity-warnings.patch @@ -5,7 +5,7 @@ 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 5e97a52222dbccbdde7d478d76363495784facb8..f1aae33917fc8a61e38b410421c205a7bc5a13dd 100644 +index 96d4049f8a42f00dbbc092b391ae11c1326a5501..f6a1d52239216984da4a9c87312c6ed085213935 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -262,6 +262,7 @@ public final class CraftServer implements Server { @@ -17,10 +17,10 @@ index 5e97a52222dbccbdde7d478d76363495784facb8..f1aae33917fc8a61e38b410421c205a7 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 0582d15e14d4fde7630759849b573cb2e08fabe6..14c06298157c4a6c6061df01b213e69b6c3481d5 100644 +index 220bad90bbb9a90c3f23562bf0fb109fce379682..a58626b1a0160983a738a45c8a1d411eb347e6a2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -425,10 +425,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -424,10 +424,41 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public void setVelocity(Vector velocity) { Preconditions.checkArgument(velocity != null, "velocity"); velocity.checkFinite(); @@ -63,12 +63,12 @@ index 0582d15e14d4fde7630759849b573cb2e08fabe6..14c06298157c4a6c6061df01b213e69b public double getHeight() { return getHandle().getHeight(); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index bf240231b70dbaf71f359318e5c0f8ba1490a067..0cb3028872041ce9f75e57fdd84b79636d8809f3 100644 +index 1b3a14784cac8e855633fae6172ad5479ebe9877..69e5054886b5858664fed333aca8c25a76e5cb11 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -80,7 +80,19 @@ public class WatchdogThread extends Thread log.log( Level.SEVERE, "During the run of the server, a physics stackoverflow was supressed" ); - log.log( Level.SEVERE, "near " + net.minecraft.server.World.lastPhysicsProblem ); + log.log( Level.SEVERE, "near " + net.minecraft.world.level.World.lastPhysicsProblem ); } - // + // Paper start - Warn in watchdog if an excessive velocity was ever set diff --git a/Spigot-Server-Patches/0055-Add-exception-reporting-event.patch b/Spigot-Server-Patches/0055-Add-exception-reporting-event.patch index f25971cedc..d2afba5500 100644 --- a/Spigot-Server-Patches/0055-Add-exception-reporting-event.patch +++ b/Spigot-Server-Patches/0055-Add-exception-reporting-event.patch @@ -48,22 +48,141 @@ index 0000000000000000000000000000000000000000..f699ce18ca044f813e194ef2786b7ea8 + return internalTask; + } +} -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0d0f36c62d260390827321aa6472f51a3a204c95..01655fd86f9a3218036f8b5404e233d32e0904a5 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 21282ce37e55cbca027c7542c148928fd4e69dfc..7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -806,6 +806,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); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper + return false; + } + } +diff --git a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java +index 107979178e8be5ee6cf885d42f992fabf3bd00b0..8a343a857dc4661ba256e39cf391dd2c7a1cc970 100644 +--- a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java ++++ b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.server.players; + ++import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.io.Files; +@@ -363,6 +364,7 @@ public class NameReferencingFileConverter { + root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5)); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + } + + if (root != null) { +@@ -376,6 +378,7 @@ public class NameReferencingFileConverter { + NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); + } catch (Exception exception) { + exception.printStackTrace(); ++ ServerInternalException.reportInternalException(exception); // Paper + } + } + // CraftBukkit end +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java +index 928ca3189af1ddaba797628a087cd6c6a9016f5c..eaa97eb11d893266253fb108249ced1e0e96a4dc 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/VillageSiege.java +@@ -1,5 +1,7 @@ + package net.minecraft.world.entity.ai.village; + ++import com.destroystokyo.paper.exception.ServerInternalException; ++ + import java.util.Iterator; + import javax.annotation.Nullable; + import net.minecraft.core.BaseBlockPosition; +@@ -119,6 +121,7 @@ public class VillageSiege implements MobSpawner { + entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); + } catch (Exception exception) { + VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception); ++ ServerInternalException.reportInternalException(exception); // Paper + return; + } + +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +index 2d02b2fc502a0f7e541f7943ed647ff7177acee8..fd0595fd584046326eccacdf0a6afe40c5e84eed 100644 +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +@@ -301,6 +301,7 @@ public final class SpawnerCreature { + } + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper + return null; + } + } +@@ -407,6 +408,7 @@ public final class SpawnerCreature { + entity = biomesettingsmobs_c.c.a((World) worldaccess.getMinecraftWorld()); + } catch (Exception exception) { + SpawnerCreature.LOGGER.warn("Failed to create mob", exception); ++ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper + continue; + } + +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 33469b719d679c65d4bcb8366008e6e107eb3a0b..b0ad55f35285cc1bc339859a8deae65e930082b8 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -1,5 +1,10 @@ + package net.minecraft.world.level; + ++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; +@@ -737,8 +742,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + gameprofilerfiller.exit(); + } catch (Throwable throwable) { + // Paper start - Prevent tile entity and entity crashes +- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); ++ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); ++ System.err.println(msg); + throwable.printStackTrace(); ++ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); ++ // Paper end + tilesThisCycle--; + this.tileEntityListTick.remove(tileTickPosition--); + continue; +@@ -808,8 +816,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + consumer.accept(entity); + } catch (Throwable throwable) { + // Paper start - Prevent tile entity and entity crashes +- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ()); ++ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ(); ++ System.err.println(msg); + throwable.printStackTrace(); ++ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); + entity.dead = true; + return; + // Paper end +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 0312d68f0f64fa9e5816fe12a09430208ae2b8ce..4f86aa618ab0b497b1ad46cc9a4443c6874d388b 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -1,5 +1,6 @@ + package net.minecraft.world.level.chunk; +import com.destroystokyo.paper.exception.ServerInternalException; import com.google.common.collect.Maps; import com.google.common.collect.Sets; import it.unimi.dsi.fastutil.longs.LongOpenHashSet; -@@ -619,10 +620,15 @@ public class Chunk implements IChunkAccess { +@@ -653,10 +654,15 @@ public class Chunk implements IChunkAccess { this.tileEntities.remove(blockposition); // Paper end } else { -- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ() +- System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.getPosition().getX() + "," + tileentity.getPosition().getY() + "," + tileentity.getPosition().getZ() - + " (" + getType(blockposition) + ") where there was no entity tile!"); - System.out.println("Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); - new Exception().printStackTrace(); @@ -79,50 +198,11 @@ index 0d0f36c62d260390827321aa6472f51a3a204c95..01655fd86f9a3218036f8b5404e233d3 // CraftBukkit end } } -diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -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 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.exception.ServerInternalException; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.io.Files; -@@ -353,6 +354,7 @@ public class NameReferencingFileConverter { - root = NBTCompressedStreamTools.a(new java.io.FileInputStream(file5)); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - - if (root != null) { -@@ -366,6 +368,7 @@ public class NameReferencingFileConverter { - NBTCompressedStreamTools.a(root, new java.io.FileOutputStream(file2)); - } catch (Exception exception) { - exception.printStackTrace(); -+ ServerInternalException.reportInternalException(exception); // Paper - } - } - // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 2ba10ed683788219c734a565a163ba553ec72c75..612eb16bce1bce1cad40ea0f279d2b8397263dea 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -762,6 +762,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); -+ com.destroystokyo.paper.exception.ServerInternalException.reportInternalException(exception); // Paper - return false; - } - } -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 135f38cc5d5d2fa3866aa1063df49a96b5e72ac2..f722b148464b7b8e515dba25aeffe8dfd3c0d6c3 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -261,6 +261,7 @@ public class RegionFile implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index f2694e46123ac2edcfdc53ef1abae283227eaa51..7f695f2b49df3400cd263fd6ffff77e753a65ea1 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -264,6 +264,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -130,7 +210,7 @@ index 135f38cc5d5d2fa3866aa1063df49a96b5e72ac2..f722b148464b7b8e515dba25aeffe8df return false; } } -@@ -333,6 +334,7 @@ public class RegionFile implements AutoCloseable { +@@ -336,6 +337,7 @@ public class RegionFile implements AutoCloseable { filechannel.write(bytebuffer); } catch (Throwable throwable1) { throwable = throwable1; @@ -138,99 +218,11 @@ index 135f38cc5d5d2fa3866aa1063df49a96b5e72ac2..f722b148464b7b8e515dba25aeffe8df throw throwable1; } 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 d787fab2c25e31ca6caa56c5e47409512c5ac568..137ee1b453b80e96c1a8fa3271f6350f9294cafb 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -14,6 +14,7 @@ import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; - - // CraftBukkit start -+import com.destroystokyo.paper.exception.ServerInternalException; - import org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason; - // CraftBukkit end - -@@ -268,6 +269,7 @@ public final class SpawnerCreature { - } - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); -+ ServerInternalException.reportInternalException(exception); // Paper - return null; - } - } -@@ -374,6 +376,7 @@ public final class SpawnerCreature { - entity = biomesettingsmobs_c.c.a((World) worldaccess.getMinecraftWorld()); - } catch (Exception exception) { - SpawnerCreature.LOGGER.warn("Failed to create mob", exception); -+ ServerInternalException.reportInternalException(exception); // Paper - continue; - } - -diff --git a/src/main/java/net/minecraft/server/VillageSiege.java b/src/main/java/net/minecraft/server/VillageSiege.java -index 1844a6504acc420bdfaaf8f045c569e970d055db..d6aadbda5c5a17976659f57ee04cf9b917e09160 100644 ---- a/src/main/java/net/minecraft/server/VillageSiege.java -+++ b/src/main/java/net/minecraft/server/VillageSiege.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.exception.ServerInternalException; -+ - import java.util.Iterator; - import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; -@@ -104,6 +106,7 @@ public class VillageSiege implements MobSpawner { - entityzombie.prepare(worldserver, worldserver.getDamageScaler(entityzombie.getChunkCoordinates()), EnumMobSpawn.EVENT, (GroupDataEntity) null, (NBTTagCompound) null); - } catch (Exception exception) { - VillageSiege.LOGGER.warn("Failed to create zombie for village siege at {}", vec3d, exception); -+ ServerInternalException.reportInternalException(exception); // Paper - return; - } - -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index eb0af6775d60e2cd610dde6e7c4874d4b01d6054..3638ae7c0eba5b1ef811bc1629334e9c483bef6f 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1,5 +1,10 @@ - package net.minecraft.server; - -+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; -@@ -685,8 +690,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - gameprofilerfiller.exit(); - } catch (Throwable throwable) { - // Paper start - Prevent tile entity and entity crashes -- System.err.println("TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()); -+ String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); -+ System.err.println(msg); - throwable.printStackTrace(); -+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); -+ // Paper end - tilesThisCycle--; - this.tileEntityListTick.remove(tileTickPosition--); - continue; -@@ -756,8 +764,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - consumer.accept(entity); - } catch (Throwable throwable) { - // Paper start - Prevent tile entity and entity crashes -- System.err.println("Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ()); -+ String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ(); -+ System.err.println(msg); - throwable.printStackTrace(); -+ getServer().getPluginManager().callEvent(new ServerExceptionEvent(new ServerInternalException(msg, throwable))); - entity.dead = true; - return; - // Paper end -diff --git a/src/main/java/net/minecraft/server/WorldPersistentData.java b/src/main/java/net/minecraft/server/WorldPersistentData.java -index 141a8e31151010e5a0bd8d4661033f109f6a2e67..138c6d707e33cd352aa4b26dfb279c5b77448de0 100644 ---- a/src/main/java/net/minecraft/server/WorldPersistentData.java -+++ b/src/main/java/net/minecraft/server/WorldPersistentData.java -@@ -144,6 +144,7 @@ public class WorldPersistentData { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java +index 3910daeaa177639fa8055301304634c2014dc20f..d61960d80599dc5e7b70cc990e4b0b174eb6e34e 100644 +--- a/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldPersistentData.java +@@ -150,6 +150,7 @@ public class WorldPersistentData { } } catch (Throwable throwable6) { throwable = throwable6; diff --git a/Spigot-Server-Patches/0056-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch b/Spigot-Server-Patches/0056-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch index 79fef10215..08ec688be1 100644 --- a/Spigot-Server-Patches/0056-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch +++ b/Spigot-Server-Patches/0056-Don-t-nest-if-we-don-t-need-to-when-cerealising-text.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Don't nest if we don't need to when cerealising text components -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index 47328ca5e3f1e71ed25ba89df5b666f041e49b76..b9cb21c5eb6f4a0318c3c63ec66f88b1750782ac 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -35,7 +35,14 @@ public class PacketPlayOutChat implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +index bc7de641a37b2f4c8fe7ed8272c55a30ac4bc313..c47427fd2eed173726cb856aae62c02a2b46bbf0 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +@@ -39,7 +39,14 @@ public class PacketPlayOutChat implements Packet { // Paper end // Spigot start if (components != null) { diff --git a/Spigot-Server-Patches/0057-Disable-Scoreboards-for-non-players-by-default.patch b/Spigot-Server-Patches/0057-Disable-Scoreboards-for-non-players-by-default.patch index 45e3b09d45..6f434c23a4 100644 --- a/Spigot-Server-Patches/0057-Disable-Scoreboards-for-non-players-by-default.patch +++ b/Spigot-Server-Patches/0057-Disable-Scoreboards-for-non-players-by-default.patch @@ -24,11 +24,11 @@ index abbbe1786eb68af02f9d39650aad730ac44aac8a..3ac2ac3db9b1c271b3c21930bb137166 + nonPlayerEntitiesOnScoreboards = getBoolean("allow-non-player-entities-on-scoreboards", false); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 295fbae9946fda8061c5c7294cdaefc426d0edce..31857636a08eeb281b4d21dd72811d40eb00055c 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2199,6 +2199,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 40eb6bae8ca4e2b57d4f91547808eb00ac1fd455..b7df4d8eb3ccb9e8dc85898352f41c5c20abcb34 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2284,6 +2284,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne @Nullable public ScoreboardTeamBase getScoreboardTeam() { @@ -36,11 +36,11 @@ index 295fbae9946fda8061c5c7294cdaefc426d0edce..31857636a08eeb281b4d21dd72811d40 return this.world.getScoreboard().getPlayerTeam(this.getName()); } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 9295f72aa5a2a95efa89fdc90ae7106540403042..276f06982b3c17b8ae29497e1f561bb7d1559e29 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -648,6 +648,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 3598db4144141a8701a2879be13a81a8ee48018c..318c96ee92fc8c6f5926aeadaa597d32ad590974 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -741,6 +741,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/0059-Complete-resource-pack-API.patch b/Spigot-Server-Patches/0059-Complete-resource-pack-API.patch index 0fb20a4b98..26f3c0a622 100644 --- a/Spigot-Server-Patches/0059-Complete-resource-pack-API.patch +++ b/Spigot-Server-Patches/0059-Complete-resource-pack-API.patch @@ -4,11 +4,11 @@ Date: Sat, 4 Apr 2015 23:17:52 -0400 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 bb74049fb2baffbe67f9e34cc0ee0b83180d02eb..9a9847c217a6f7a2e2bc09b68b3d2821fcecbbc3 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1457,7 +1457,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index a70fb56b0f44372cc62adbb9a263684224c264d2..98189c2f4c973427563c48a231bf8e6c21e0391d 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1602,7 +1602,11 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit start public void a(PacketPlayInResourcePackStatus packetplayinresourcepackstatus) { PlayerConnectionUtils.ensureMainThread(packetplayinresourcepackstatus, this, this.player.getWorldServer()); @@ -22,7 +22,7 @@ index bb74049fb2baffbe67f9e34cc0ee0b83180d02eb..9a9847c217a6f7a2e2bc09b68b3d2821 // 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 928492e9dd30cf75aff891ac098cac653b46d822..15a515535d6c8c71e0de4a7ab4c0a8759ca3537f 100644 +index da193bfc1d98e489eedc373ee87ab58b75d4377e..144faef77e69c6c3bf963327179a51bb4c37cc18 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -138,6 +138,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0060-Chunk-Save-Reattempt.patch b/Spigot-Server-Patches/0060-Chunk-Save-Reattempt.patch index 6021773c6d..93b118d8c9 100644 --- a/Spigot-Server-Patches/0060-Chunk-Save-Reattempt.patch +++ b/Spigot-Server-Patches/0060-Chunk-Save-Reattempt.patch @@ -5,11 +5,11 @@ 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 f722b148464b7b8e515dba25aeffe8dfd3c0d6c3..be7165098fcb814d7b301a1670c33c78461d8d95 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -261,7 +261,7 @@ public class RegionFile implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 7f695f2b49df3400cd263fd6ffff77e753a65ea1..6efbb8a3502f86e105d4dfb9cef114a790966e95 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -264,7 +264,7 @@ public class RegionFile implements AutoCloseable { return true; } } catch (IOException ioexception) { @@ -18,11 +18,11 @@ index f722b148464b7b8e515dba25aeffe8dfd3c0d6c3..be7165098fcb814d7b301a1670c33c78 return false; } } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index caa1eb3ea5d2e97944adc735895708a76215ee7b..26fabb4e5d3945ace851cf6e4474e91611c45b1d 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -88,6 +88,7 @@ public final class RegionFileCache implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +index de125077656f249d5cf9b76f07981b55e690e015..44c09e3b8d5abe4fdf9c4a46c21bc82e9dfefa0b 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +@@ -92,6 +92,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 caa1eb3ea5d2e97944adc735895708a76215ee7b..26fabb4e5d3945ace851cf6e4474e916 DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair); Throwable throwable = null; -@@ -111,6 +112,18 @@ public final class RegionFileCache implements AutoCloseable { +@@ -115,6 +116,18 @@ public final class RegionFileCache implements AutoCloseable { } diff --git a/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch b/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch index 57b2d03628..e87ee15fe2 100644 --- a/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch +++ b/Spigot-Server-Patches/0064-Handle-Item-Meta-Inconsistencies.patch @@ -17,10 +17,10 @@ was added, resulting in 2 different ways to modify an items enchantments. 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 7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd..eee69f9ac8936cf7ad84629aba91bf09371762f3 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 4010152dccc93019f2e7f284d80b92bae0d91c34..d7c5065457d910f3e5481fda046d368d5f66f67b 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java @@ -9,6 +9,8 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import java.text.DecimalFormat; @@ -30,7 +30,7 @@ index 7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd..eee69f9ac8936cf7ad84629aba91bf09 import java.util.Locale; import java.util.Objects; import java.util.Optional; -@@ -66,6 +68,23 @@ public final class ItemStack { +@@ -120,6 +122,23 @@ public final class ItemStack { private ShapeDetectorBlock n; private boolean o; @@ -54,7 +54,7 @@ index 7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd..eee69f9ac8936cf7ad84629aba91bf09 public ItemStack(IMaterial imaterial) { this(imaterial, 1); } -@@ -108,6 +127,7 @@ public final class ItemStack { +@@ -162,6 +181,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(); @@ -62,7 +62,7 @@ index 7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd..eee69f9ac8936cf7ad84629aba91bf09 this.getItem().b(this.tag); // CraftBukkit end } -@@ -626,6 +646,7 @@ public final class ItemStack { +@@ -680,6 +700,7 @@ public final class ItemStack { // Paper end public void setTag(@Nullable NBTTagCompound nbttagcompound) { this.tag = nbttagcompound; @@ -70,7 +70,7 @@ index 7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd..eee69f9ac8936cf7ad84629aba91bf09 if (this.getItem().usesDurability()) { this.setDamage(this.getDamage()); } -@@ -716,6 +737,7 @@ public final class ItemStack { +@@ -770,6 +791,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 7d98fe348d6b4a3bc2972217f9a9f0c9d902edbd..eee69f9ac8936cf7ad84629aba91bf09 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 721a1c6bd4505cb132e7004c45b795d4959389e3..9913d0136841dac35b6649cb1afbe1e93b36bf4c 100644 +index 275b943a59ef28c831a068987e111e84ebba3bb7..7221ac52c9f66ae0af6f6cbf15c8d47f9c0291a0 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 { @@ -115,7 +115,7 @@ index 721a1c6bd4505cb132e7004c45b795d4959389e3..9913d0136841dac35b6649cb1afbe1e9 + // Paper end } - static boolean makeTag(net.minecraft.server.ItemStack item) { + static boolean makeTag(net.minecraft.world.item.ItemStack item) { @@ -216,66 +199,33 @@ public final class CraftItemStack extends ItemStack { @Override @@ -192,9 +192,9 @@ index 721a1c6bd4505cb132e7004c45b795d4959389e3..9913d0136841dac35b6649cb1afbe1e9 + return hasItemMeta() ? getItemMeta().getEnchants() : ImmutableMap.of(); // Paper - use Item Meta } - static Map getEnchantments(net.minecraft.server.ItemStack item) { + static Map getEnchantments(net.minecraft.world.item.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 ac6be3da812c927a5486809c096b5a2e1aba617b..da1af372453b0e32177454d87437bda5c5b530d0 100644 +index 7a11b2ddfa4244459253c918315aaab78ef2eb4a..57a6e66866ea82caccbbbfd55948a081f50f6bbe 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; 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 71a33044a7..0cc21d37c3 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 @@ -29,11 +29,11 @@ index 3ac2ac3db9b1c271b3c21930bb13716669ff64d3..3c78d3234054ce2dc46ef77decb6adb0 + log("Creative Arrow Despawn Rate: " + creativeArrowDespawnRate); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 1bd522f84f034552e4a82fc07f93ce32c5532f81..2a86d4b8af5e436e82e003f50c1929702af700c4 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -245,7 +245,7 @@ public abstract class EntityArrow extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +index a05ee898bd360f49ea2807d06f93e27ada11ef63..9bd4a283a99f86c9a26f73e0bad0c3414d66ad55 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +@@ -283,7 +283,7 @@ public abstract class EntityArrow extends IProjectile { protected void h() { ++this.despawnCounter; diff --git a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch index ebd45acb9d..e8f87bb7d5 100644 --- a/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch +++ b/Spigot-Server-Patches/0066-Add-World-Util-Methods.patch @@ -5,11 +5,24 @@ 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 1c54c081c6ea1f422c19db1aa9e1935ce066d910..4aa4a8d10b5126125ae420037c5e1faabdbe147b 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -245,11 +245,27 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index eddfbd25953e8ef410f1617a1edecbc7d07696c0..b04a6cd626fceed26aec6121e20fb1b6dd1c716d 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -197,7 +197,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; + +- public Chunk getChunkIfLoaded(int x, int z) { ++ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); + } + +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index b0ad55f35285cc1bc339859a8deae65e930082b8..067f5e46ad2f28ab119db77b19c4897bed9b3d80 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -297,11 +297,27 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } @Override @@ -38,11 +51,11 @@ index 1c54c081c6ea1f422c19db1aa9e1935ce066d910..4aa4a8d10b5126125ae420037c5e1faa // Paper end @Override -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index bb0f30f182856d2701fde9b1a65eeb987462104a..717f495abd63218bb7ce9241e7cfeac809ef02de 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -21,6 +21,7 @@ public class WorldBorder { +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +index 2bb03f1cb9671a7754a68059219f783d4508eeb9..f16c76df5d7b184d57f4cc397f069eac9cc430cb 100644 +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -31,6 +31,7 @@ public class WorldBorder { public WorldBorder() {} @@ -50,16 +63,3 @@ index bb0f30f182856d2701fde9b1a65eeb987462104a..717f495abd63218bb7ce9241e7cfeac8 public boolean a(BlockPosition blockposition) { return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h(); } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 07f2cf8461343f054828a32f8bf48563321e666a..6a57b9337d3f345197a127b16e3799d0c58fab2d 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -88,7 +88,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - public final Convertable.ConversionSession convertable; - public final UUID uuid; - -- public Chunk getChunkIfLoaded(int x, int z) { -+ @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI - return this.chunkProvider.getChunkAt(x, z, false); - } - diff --git a/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch b/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch index 3ae3f50257..defeebd3fc 100644 --- a/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch +++ b/Spigot-Server-Patches/0067-Custom-replacement-for-eaten-items.patch @@ -4,11 +4,11 @@ Date: Sun, 21 Jun 2015 15:07:20 -0400 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 276f06982b3c17b8ae29497e1f561bb7d1559e29..a001629eda462ba34555aed6fe162078c18e0c02 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3112,9 +3112,10 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 318c96ee92fc8c6f5926aeadaa597d32ad590974..9b12e15a6c377ae90193596a35114dd452cf6e0c 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3205,9 +3205,10 @@ public abstract class EntityLiving extends Entity { this.b(this.activeItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; @@ -20,7 +20,7 @@ index 276f06982b3c17b8ae29497e1f561bb7d1559e29..a001629eda462ba34555aed6fe162078 world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { -@@ -3128,6 +3129,13 @@ public abstract class EntityLiving extends Entity { +@@ -3221,6 +3222,13 @@ public abstract class EntityLiving extends Entity { } else { itemstack = this.activeItem.a(this.world, this); } @@ -34,7 +34,7 @@ index 276f06982b3c17b8ae29497e1f561bb7d1559e29..a001629eda462ba34555aed6fe162078 // CraftBukkit end if (itemstack != this.activeItem) { -@@ -3135,6 +3143,11 @@ public abstract class EntityLiving extends Entity { +@@ -3228,6 +3236,11 @@ public abstract class EntityLiving extends Entity { } this.clearActiveItem(); 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 ffcb14b001..318262bd90 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 @@ -4,11 +4,11 @@ Date: Sun, 27 Sep 2015 01:18:02 -0400 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 7c74a13d875d12d4264e394c682ab515a14f8915..1fb7e29b29adef72bd5a49c87d954973f46f9c81 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -609,7 +609,13 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 9b12e15a6c377ae90193596a35114dd452cf6e0c..acbd10432b09172f7541b2f4081d1aa9812194ac 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -702,7 +702,13 @@ public abstract class EntityLiving extends Entity { @Override public void loadData(NBTTagCompound nbttagcompound) { @@ -23,7 +23,7 @@ index 7c74a13d875d12d4264e394c682ab515a14f8915..1fb7e29b29adef72bd5a49c87d954973 if (nbttagcompound.hasKeyOfType("Attributes", 9) && this.world != null && !this.world.isClientSide) { this.getAttributeMap().a(nbttagcompound.getList("Attributes", 10)); } -@@ -1058,6 +1064,10 @@ public abstract class EntityLiving extends Entity { +@@ -1151,6 +1157,10 @@ public abstract class EntityLiving extends Entity { } public void setHealth(float f) { @@ -34,7 +34,7 @@ index 7c74a13d875d12d4264e394c682ab515a14f8915..1fb7e29b29adef72bd5a49c87d954973 // CraftBukkit start - Handle scaled health if (this instanceof EntityPlayer) { org.bukkit.craftbukkit.entity.CraftPlayer player = ((EntityPlayer) this).getBukkitEntity(); -@@ -2952,7 +2962,7 @@ public abstract class EntityLiving extends Entity { +@@ -3045,7 +3055,7 @@ public abstract class EntityLiving extends Entity { } public void setAbsorptionHearts(float f) { @@ -44,7 +44,7 @@ index 7c74a13d875d12d4264e394c682ab515a14f8915..1fb7e29b29adef72bd5a49c87d954973 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 15a515535d6c8c71e0de4a7ab4c0a8759ca3537f..0a24eab942354a03d5ddf4899cf7a80401b669a4 100644 +index 144faef77e69c6c3bf963327179a51bb4c37cc18..b4a2758ee246252d6076e861b45d11dae6e33096 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1682,6 +1682,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch b/Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch index 7224678d23..1579a0057c 100644 --- a/Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch +++ b/Spigot-Server-Patches/0069-Use-a-Shared-Random-for-Entities.patch @@ -5,11 +5,11 @@ 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 31857636a08eeb281b4d21dd72811d40eb00055c..dba28796a921beda2e5d15ba1565c55f54e36435 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 +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index b7df4d8eb3ccb9e8dc85898352f41c5c20abcb34..6cbb797cb0de4b26d8ddd7f0bf567f49bd36f9c0 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -143,6 +143,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return tag.hasKey("Bukkit.updateLevel") && tag.getInt("Bukkit.updateLevel") >= level; } @@ -31,7 +31,7 @@ index 31857636a08eeb281b4d21dd72811d40eb00055c..dba28796a921beda2e5d15ba1565c55f private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -@@ -187,7 +202,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -272,7 +287,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.x = Vec3D.ORIGIN; this.am = 1.0F; this.an = 1.0F; diff --git a/Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch b/Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch index 96b9850011..f87fe58b3c 100644 --- a/Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch +++ b/Spigot-Server-Patches/0070-Configurable-spawn-chances-for-skeleton-horses.patch @@ -21,11 +21,11 @@ index 3c78d3234054ce2dc46ef77decb6adb0cbd10620..cd64fb9d0c6d123e1c86cb33f12cd9ce + } + } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6a57b9337d3f345197a127b16e3799d0c58fab2d..4029f090d7b01c10b4f3f99004ab92f04653e884 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -479,7 +479,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index b04a6cd626fceed26aec6121e20fb1b6dd1c716d..3403ed91e7ec98116438398fb7247e7f05171feb 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -588,7 +588,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/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch b/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch index d4c2fb09ff..f5214b7a93 100644 --- a/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch +++ b/Spigot-Server-Patches/0071-Optimize-isValidLocation-getType-and-getBlockData-fo.patch @@ -12,11 +12,11 @@ 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 f6a5ebd4c7ec045c8dd6841831f8fcc0b32d964e..63a9ce32fb8b98695e104f7d820cd9b1a8f230b1 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -20,6 +20,15 @@ public class BaseBlockPosition implements Comparable { +diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java +index 25fdd55a7548cfaa45a541ad77f22f33c33e7471..4b56683336fdab06804efdc8ca1f7c130b77291f 100644 +--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java +@@ -22,6 +22,15 @@ public class BaseBlockPosition implements Comparable { private int b;public final void setY(final int y) { this.b = y; } // Paper - OBFHELPER private int e;public final void setZ(final int z) { this.e = z; } // Paper - OBFHELPER @@ -32,11 +32,24 @@ index f6a5ebd4c7ec045c8dd6841831f8fcc0b32d964e..63a9ce32fb8b98695e104f7d820cd9b1 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 81c6ce3ba87da692675bca8b2831a90fabfa4e37..b6ff6095543d720382786e159a9f1cdd6eb6f166 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -312,12 +312,27 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 067f5e46ad2f28ab119db77b19c4897bed9b3d80..07b5ff3ae319776bc1d85d113007a9afbad1c29a 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -239,7 +239,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + + public static boolean isValidLocation(BlockPosition blockposition) { +- return !isOutsideWorld(blockposition) && D(blockposition); ++ return blockposition.isValidLocation(); // Paper - use better/optimized check + } + + public static boolean l(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 4f86aa618ab0b497b1ad46cc9a4443c6874d388b..ace0566626338f02cbfcc8b40d29dc6a66ede58d 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -346,12 +346,27 @@ public class Chunk implements IChunkAccess { return this.sections; } @@ -68,11 +81,11 @@ index 81c6ce3ba87da692675bca8b2831a90fabfa4e37..b6ff6095543d720382786e159a9f1cdd 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 -index 84207e7da6df97246f756940142a2af9eb9ca815..ed22ff28ea6c0978ec0d9d1ecf7baa3f422ed677 100644 ---- a/src/main/java/net/minecraft/server/ChunkEmpty.java -+++ b/src/main/java/net/minecraft/server/ChunkEmpty.java -@@ -7,7 +7,7 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java +index 395d21afaabcbd99f9ce0551d647f5db9507a518..89efd0b68b04457e1cd617dcc8bb1a6ea1c4717c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java +@@ -23,7 +23,7 @@ import net.minecraft.world.phys.AxisAlignedBB; public class ChunkEmpty extends Chunk { @@ -81,7 +94,7 @@ index 84207e7da6df97246f756940142a2af9eb9ca815..ed22ff28ea6c0978ec0d9d1ecf7baa3f Arrays.fill(abiomebase, BiomeRegistry.a); }); -@@ -15,6 +15,11 @@ public class ChunkEmpty extends Chunk { +@@ -31,6 +31,11 @@ public class ChunkEmpty extends Chunk { super(world, chunkcoordintpair, new BiomeStorage(world.r().b(IRegistry.ay), ChunkEmpty.b)); } @@ -93,11 +106,11 @@ index 84207e7da6df97246f756940142a2af9eb9ca815..ed22ff28ea6c0978ec0d9d1ecf7baa3f @Override 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 882c2733beaff1df68b892d44fc77cacf4364ff4..5c7068cd93806d67c643ed6aabdfcab8888ed94e 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -7,10 +7,10 @@ public class ChunkSection { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index a4e2eb1a753e8fcb48982d78fe80e505bce5c476..eea4a30428293eaf7afbe303a37adec60b44c2b4 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -13,10 +13,10 @@ public class ChunkSection { public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); private final int yPos; @@ -110,7 +123,7 @@ index 882c2733beaff1df68b892d44fc77cacf4364ff4..5c7068cd93806d67c643ed6aabdfcab8 public ChunkSection(int i) { this(i, (short) 0, (short) 0, (short) 0); -@@ -24,8 +24,8 @@ public class ChunkSection { +@@ -30,8 +30,8 @@ public class ChunkSection { this.blockIds = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); } @@ -121,11 +134,11 @@ index 882c2733beaff1df68b892d44fc77cacf4364ff4..5c7068cd93806d67c643ed6aabdfcab8 } 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 32849e360a396128bd228db269ad1a8f7c6583a8..eabc9d7b934f27c823e012f3f10fffc23b461292 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -124,7 +124,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index e397b871b846c3a90bc75d0e1cf0683b6a3d0ca9..8928157b01bb4f0dfe043732777b33708c23cda7 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +@@ -133,7 +133,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } public T a(int i, int j, int k) { @@ -134,11 +147,11 @@ index 32849e360a396128bd228db269ad1a8f7c6583a8..eabc9d7b934f27c823e012f3f10fffc2 } 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 e0672c3c0bf30d88ea1cc609459050499a7271f3..887366f4c2ab608974113e75760b58c47f2afa00 100644 ---- a/src/main/java/net/minecraft/server/IChunkAccess.java -+++ b/src/main/java/net/minecraft/server/IChunkAccess.java -@@ -12,6 +12,7 @@ import org.apache.logging.log4j.LogManager; +diff --git a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java +index 2cd04abd72f1135446182ad6294003e526f99a4b..e570dc58efa56bd0aa5ada5575b4054ee38d505e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java ++++ b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java +@@ -25,6 +25,7 @@ import org.apache.logging.log4j.LogManager; public interface IChunkAccess extends IBlockAccess, IStructureAccess { @@ -146,11 +159,11 @@ index e0672c3c0bf30d88ea1cc609459050499a7271f3..887366f4c2ab608974113e75760b58c4 @Nullable IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index e356bd73901ac7f230492e654af579d21c8fc086..2bcd26ccccf4503241c6b77600ed6ce1d94ccfcc 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -95,16 +95,18 @@ public class ProtoChunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +index 7572ca53a5cca8ca5085d18c24048b85dda4daa9..9eeb99a21a6ed7f71ff64cf4cfdff646d31abbcf 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +@@ -113,16 +113,18 @@ public class ProtoChunk implements IChunkAccess { @Override public IBlockData getType(BlockPosition blockposition) { @@ -175,11 +188,11 @@ index e356bd73901ac7f230492e654af579d21c8fc086..2bcd26ccccf4503241c6b77600ed6ce1 @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 5cfddbfe0bd84c994ed7fa4968bcf4fc13381001..420bf7116def909d3dd7dc9a799723446ddf8f7f 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 { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java +index c059d3d055c35b492680556e8605966e2caaf7fd..9351e6ba541d440c485b6e4a3209170c5756e31e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java +@@ -42,6 +42,11 @@ public class ProtoChunkExtension extends ProtoChunk { public IBlockData getType(BlockPosition blockposition) { return this.a.getType(blockposition); } @@ -191,16 +204,3 @@ index 5cfddbfe0bd84c994ed7fa4968bcf4fc13381001..420bf7116def909d3dd7dc9a79972344 @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 4aa4a8d10b5126125ae420037c5e1faabdbe147b..096a1d3bf0e9c51244ecd9ad2fbd240f3e01f461 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -187,7 +187,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - - public static boolean isValidLocation(BlockPosition blockposition) { -- return !isOutsideWorld(blockposition) && D(blockposition); -+ return blockposition.isValidLocation(); // Paper - use better/optimized check - } - - public static boolean l(BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch b/Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch index 7f1c4204ef..c30710c0bd 100644 --- a/Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch +++ b/Spigot-Server-Patches/0072-Only-process-BlockPhysicsEvent-if-a-plugin-has-a-lis.patch @@ -5,37 +5,11 @@ 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 47e370667926e59f036be3f2befe8820668cf892..a830305f0e334ad87e6b9ed94230ff611d997d7e 100644 ---- a/src/main/java/net/minecraft/server/BlockPlant.java -+++ b/src/main/java/net/minecraft/server/BlockPlant.java -@@ -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)) { -- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { -+ if (!(generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper - return Blocks.AIR.getBlockData(); - } - } -diff --git a/src/main/java/net/minecraft/server/BlockTallPlant.java b/src/main/java/net/minecraft/server/BlockTallPlant.java -index 48eb9c8a68d45c88c7a42e8e400446a374fb4fc9..2c8d49501664862559ed8974b4821bdd36fabebf 100644 ---- a/src/main/java/net/minecraft/server/BlockTallPlant.java -+++ b/src/main/java/net/minecraft/server/BlockTallPlant.java -@@ -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 - return; - } - // CraftBukkit end diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 38b0863bf470682b9afaab016c5c41af65800e5d..575b4e670810b0be51067ba3e4c838e547a1f1dc 100644 +index 2c295e070a0418c7d3bc4a4a531df699acadb0ff..555b99c45e0785750c48b0db2bc0b8da98c52295 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1175,6 +1175,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { 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 7c6127739f1d88ee0dc411db5fcaa37d7fff36f7..5ce86030a71c181c4c28b8934be4fa8c7eafc299 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -406,7 +406,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 3403ed91e7ec98116438398fb7247e7f05171feb..3b82b358d53454dcde4e64123e6262a68a5ed1b0 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -196,6 +196,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + private int tickPosition; + public final Convertable.ConversionSession convertable; + public final UUID uuid; ++ boolean hasPhysicsEvent = true; // Paper + + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI + return this.chunkProvider.getChunkAt(x, z, false); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 07b5ff3ae319776bc1d85d113007a9afbad1c29a..70db5312ac556ea53247efdbc7759910ba0c9a95 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -458,7 +458,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start iblockdata1.b(this, blockposition, k, j - 1); // Don't call an event for the old block to limit event spam CraftWorld world = ((WorldServer) this).getWorld(); @@ -56,7 +42,7 @@ index 7c6127739f1d88ee0dc411db5fcaa37d7fff36f7..5ce86030a71c181c4c28b8934be4fa8c BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata)); this.getServer().getPluginManager().callEvent(event); -@@ -508,7 +508,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -560,7 +560,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { try { // CraftBukkit start CraftWorld world = ((WorldServer) this).getWorld(); @@ -65,15 +51,29 @@ index 7c6127739f1d88ee0dc411db5fcaa37d7fff36f7..5ce86030a71c181c4c28b8934be4fa8c BlockPhysicsEvent event = new BlockPhysicsEvent(world.getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()), CraftBlockData.fromData(iblockdata), world.getBlockAt(blockposition1.getX(), blockposition1.getY(), blockposition1.getZ())); 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 a7b78b317dc70816fb0b23989bebe30a300ed561..7a1f6d446fb62b0aa72212b44899606c8ec99b55 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -87,6 +87,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - private int tickPosition; - public final Convertable.ConversionSession convertable; - public final UUID uuid; -+ boolean hasPhysicsEvent = true; // Paper +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPlant.java b/src/main/java/net/minecraft/world/level/block/BlockPlant.java +index 33a5c5a4dc1478ab211dbb2e09df87570b06644f..81fbdda5e87b07259db206316cb4b423d9acdc3c 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockPlant.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPlant.java +@@ -23,7 +23,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)) { +- if (!org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { ++ if (!(generatoraccess instanceof WorldServer && ((WorldServer) generatoraccess).hasPhysicsEvent) || !org.bukkit.craftbukkit.event.CraftEventFactory.callBlockPhysicsEvent(generatoraccess, blockposition).isCancelled()) { // Paper + return Blocks.AIR.getBlockData(); + } + } +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java +index ca22187625f7ac6c43b663fd4d66cbf0c943c655..7c34cc7c0b74a336d0f0e705deab6d0f86e2e5f8 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTallPlant.java +@@ -83,7 +83,7 @@ public class BlockTallPlant extends BlockPlant { - @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI - return this.chunkProvider.getChunkAt(x, z, false); + 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 + return; + } + // CraftBukkit end diff --git a/Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch b/Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch index f25be7ea0d..f26860a90a 100644 --- a/Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch +++ b/Spigot-Server-Patches/0073-Entity-AddTo-RemoveFrom-World-Events.patch @@ -4,11 +4,11 @@ Date: Mon, 28 Mar 2016 20:32:58 -0400 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 7e44af3e933f16fc00cd2b43e913f87380fb1cae..d199191220b5afc42d639f316878501c91514a50 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1103,7 +1103,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 3b82b358d53454dcde4e64123e6262a68a5ed1b0..acff0752aba49bb360d944e5f648b80a82bc984d 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1212,7 +1212,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity instanceof EntityInsentient) { this.navigators.remove(((EntityInsentient) entity).getNavigation()); } @@ -17,7 +17,7 @@ index 7e44af3e933f16fc00cd2b43e913f87380fb1cae..d199191220b5afc42d639f316878501c entity.valid = false; // CraftBukkit } -@@ -1141,6 +1141,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1250,6 +1250,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { entity.origin = entity.getBukkitEntity().getLocation(); } // Paper end diff --git a/Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch b/Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch index f3ecbeea8b..d0aaee3807 100644 --- a/Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch +++ b/Spigot-Server-Patches/0074-Configurable-Chunk-Inhabited-Time.patch @@ -29,11 +29,11 @@ index cd64fb9d0c6d123e1c86cb33f12cd9cefc9f80d0..74ba5dbb83c13ce1721619b755036a78 + fixedInhabitedTime = getInt("fixed-chunk-inhabited-time", -1); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 9ef17a2ad31c8e11ba433b49aa9a31cf8df57dc8..83858165764a7459843433de1a077037692a2a97 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -986,7 +986,7 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index ace0566626338f02cbfcc8b40d29dc6a66ede58d..c24315a329b3076a022fdf2aa7459e7117323e20 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -1020,7 +1020,7 @@ public class Chunk implements IChunkAccess { @Override public long getInhabitedTime() { diff --git a/Spigot-Server-Patches/0075-EntityPathfindEvent.patch b/Spigot-Server-Patches/0075-EntityPathfindEvent.patch index c8ea612f68..3984fbe891 100644 --- a/Spigot-Server-Patches/0075-EntityPathfindEvent.patch +++ b/Spigot-Server-Patches/0075-EntityPathfindEvent.patch @@ -5,11 +5,11 @@ 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 95f916d5a08a7781278080c4f4abd4e152a945b5..da15615a19474d5db9bd46c3d772f467ec58b133 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 { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java b/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java +index 942e03578836524ba746bc37699677eb06cc7803..703d06b2b29f1500301d82df78dc377141085145 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/Navigation.java +@@ -75,7 +75,7 @@ public class Navigation extends NavigationAbstract { @Override public PathEntity a(Entity entity, int i) { @@ -18,11 +18,11 @@ index 95f916d5a08a7781278080c4f4abd4e152a945b5..da15615a19474d5db9bd46c3d772f467 } private int u() { -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index edcc8af6ee36b937f61d3e52cb001b24fa16f690..48cf95db7226b23fc688aba47aea3b378faec14c 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; +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +index 8848a7552a0ef3944560a71f71620c6bd0f08c10..8c699279a3553da2888669c64269a1dfd8152e22 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +@@ -28,7 +28,7 @@ import net.minecraft.world.phys.Vec3D; public abstract class NavigationAbstract { @@ -31,7 +31,7 @@ index edcc8af6ee36b937f61d3e52cb001b24fa16f690..48cf95db7226b23fc688aba47aea3b37 protected final World b; @Nullable protected PathEntity c; -@@ -95,16 +95,26 @@ public abstract class NavigationAbstract { +@@ -115,16 +115,26 @@ public abstract class NavigationAbstract { @Nullable public PathEntity a(BlockPosition blockposition, int i) { @@ -60,7 +60,7 @@ index edcc8af6ee36b937f61d3e52cb001b24fa16f690..48cf95db7226b23fc688aba47aea3b37 if (set.isEmpty()) { return null; } else if (this.a.locY() < 0.0D) { -@@ -114,6 +124,23 @@ public abstract class NavigationAbstract { +@@ -134,6 +144,23 @@ public abstract class NavigationAbstract { } else if (this.c != null && !this.c.c() && set.contains(this.p)) { return this.c; } else { @@ -84,11 +84,11 @@ index edcc8af6ee36b937f61d3e52cb001b24fa16f690..48cf95db7226b23fc688aba47aea3b37 this.b.getMethodProfiler().enter("pathfind"); 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 feed11b62a4df63c1782e7124a3f006d7a8019a3..013bdfe5540ae594a7f9cbe3ef8dc54dfb25afd4 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 { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java +index 2e1efe7a048f64d494260d10a4ae5dba86af5e6c..f5664b8c0762f775f3cd106d156eb74b48bcedc2 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationFlying.java +@@ -37,7 +37,7 @@ public class NavigationFlying extends NavigationAbstract { @Override public PathEntity a(Entity entity, int i) { diff --git a/Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch b/Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch index 0c2b08c29b..eac05ac95a 100644 --- a/Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch +++ b/Spigot-Server-Patches/0076-Sanitise-RegionFileCache-and-make-configurable.patch @@ -24,11 +24,11 @@ index 716f285e67019b8a62922d09c15883c99f9421aa..439dcc6effdc91830d2b7ede90639829 + regionFileCacheSize = Math.max(getInt("settings.region-file-cache-size", 256), 4); + } } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 26fabb4e5d3945ace851cf6e4474e91611c45b1d..6be04e230fe96c1f2345a00de4f648d9eb712a82 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -28,7 +28,7 @@ public final class RegionFileCache implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +index 44c09e3b8d5abe4fdf9c4a46c21bc82e9dfefa0b..13d0d6e7e03322f20ef5666d5299d26d51d1714c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +@@ -32,7 +32,7 @@ public final class RegionFileCache implements AutoCloseable { if (regionfile != null) { return regionfile; } else { diff --git a/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch b/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch index 002aa8ab0b..4fb82e5e9a 100644 --- a/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch +++ b/Spigot-Server-Patches/0077-Do-not-load-chunks-for-Pathfinding.patch @@ -4,11 +4,11 @@ Date: Thu, 31 Mar 2016 19:17:58 -0400 Subject: [PATCH] Do not load chunks for Pathfinding -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 48cf95db7226b23fc688aba47aea3b378faec14c..5a8fbad220ed535a79539a4e25830c370ca1c89c 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -27,7 +27,7 @@ public abstract class NavigationAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +index 8c699279a3553da2888669c64269a1dfd8152e22..c50d792c3ef3277ecab229e866f052854edac19d 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +@@ -47,7 +47,7 @@ public abstract class NavigationAbstract { private BlockPosition p; private int q; private float r; @@ -17,11 +17,11 @@ index 48cf95db7226b23fc688aba47aea3b378faec14c..5a8fbad220ed535a79539a4e25830c37 private boolean t; public NavigationAbstract(EntityInsentient entityinsentient, World world) { -diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java -index 8ba6dd459a863717c91dd59f3f2ee5e3a5ed8170..b31d1f73ce0f067e352868b53eab7557c34b17eb 100644 ---- a/src/main/java/net/minecraft/server/Pathfinder.java -+++ b/src/main/java/net/minecraft/server/Pathfinder.java -@@ -17,7 +17,7 @@ public class Pathfinder { +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java +index 39cd22a820fdc4c75aefb625b45b0c8c6ce1f199..5784be69098805e4d550a0923ac8daa5aada73f9 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java +@@ -20,7 +20,7 @@ public class Pathfinder { private final PathPoint[] a = new PathPoint[32]; private final int b; @@ -30,11 +30,11 @@ index 8ba6dd459a863717c91dd59f3f2ee5e3a5ed8170..b31d1f73ce0f067e352868b53eab7557 private final Path d = new Path(); public Pathfinder(PathfinderAbstract pathfinderabstract, int i) { -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index 449665f52c5f241d2119919abe4d4cde638ebe6f..07b021bd1fb174d1c1a0c83b415c84e582c4f681 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -456,7 +456,12 @@ public class PathfinderNormal extends PathfinderAbstract { +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java +index ed9c1dfbc84b9573784e6531186b3cd9513ddf75..d14f2800237c2a80912bf6f2d418a9ba9031070d 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java +@@ -479,7 +479,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); @@ -48,7 +48,7 @@ index 449665f52c5f241d2119919abe4d4cde638ebe6f..07b021bd1fb174d1c1a0c83b415c84e5 if (iblockdata.a(Blocks.CACTUS)) { return PathType.DANGER_CACTUS; -@@ -473,6 +478,7 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -496,6 +501,7 @@ public class PathfinderNormal extends PathfinderAbstract { if (iblockaccess.getFluid(blockposition_mutableblockposition).a((Tag) TagsFluid.WATER)) { return PathType.WATER_BORDER; } @@ -56,7 +56,7 @@ index 449665f52c5f241d2119919abe4d4cde638ebe6f..07b021bd1fb174d1c1a0c83b415c84e5 } } } -@@ -482,7 +488,8 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -505,7 +511,8 @@ public class PathfinderNormal extends PathfinderAbstract { } protected static PathType b(IBlockAccess iblockaccess, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch b/Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch index 0109071b81..1f01d6599f 100644 --- a/Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch +++ b/Spigot-Server-Patches/0078-Add-PlayerUseUnknownEntityEvent.patch @@ -4,11 +4,11 @@ Date: Sat, 2 Apr 2016 05:09:16 -0400 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 49c911e54eb3b20d820f3e1895c057eead6d312b..09c757a3bb1d9a49343cf58e18f736e1fa9e10c7 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; +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java +index 9f3f8568ef9484ba226deaa6429f819c325b7a26..ce63f3e5ac4d1a4311c0ebeb7574d999d45987d9 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInUseEntity.java +@@ -11,7 +11,7 @@ import net.minecraft.world.phys.Vec3D; public class PacketPlayInUseEntity implements Packet { @@ -17,11 +17,11 @@ index 49c911e54eb3b20d820f3e1895c057eead6d312b..09c757a3bb1d9a49343cf58e18f736e1 private PacketPlayInUseEntity.EnumEntityUseAction action; 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 2436ee100bdf7cb2166595f41af61af806ecdd46..f021568601198ddcf4c1c312eb5d3eef4b9eb5e5 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2052,6 +2052,16 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 98189c2f4c973427563c48a231bf8e6c21e0391d..7aec9a349ea941153863d95eb8df4f8c884b5617 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2197,6 +2197,16 @@ public class PlayerConnection implements PacketListenerPlayIn { } } } diff --git a/Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch b/Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch index 8dbf9dbe32..063b7e7b45 100644 --- a/Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch +++ b/Spigot-Server-Patches/0079-Fix-reducedDebugInfo-not-initialized-on-client.patch @@ -4,11 +4,11 @@ Date: Sat, 2 Apr 2016 20:37:03 -0400 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 c71dea3e51c93cf1ad60b8a76408774d67552de8..acbdc4736c2f6f181e25b776a2c025bd2af85af2 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -171,6 +171,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index cfd0af520dd3dcf364a3ffd03a74e3b9ee6045af..152aa38788a21638aab7cfe2dc187671f1143bde 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -246,6 +246,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/0080-Configurable-Grass-Spread-Tick-Rate.patch b/Spigot-Server-Patches/0080-Configurable-Grass-Spread-Tick-Rate.patch index 1b7605ccda..b41777f7eb 100644 --- a/Spigot-Server-Patches/0080-Configurable-Grass-Spread-Tick-Rate.patch +++ b/Spigot-Server-Patches/0080-Configurable-Grass-Spread-Tick-Rate.patch @@ -19,11 +19,11 @@ index 74ba5dbb83c13ce1721619b755036a7864a1fb90..db2dddd12f54e6d15916c4cee6236765 + log("Grass Spread Tick Rate: " + grassUpdateRate); + } } -diff --git a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -index 5eb62e9b9a228eaa50526e4203998246783a33d0..7b29d47dfdef7611db58068af285f76d92a9f12a 100644 ---- a/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -+++ b/src/main/java/net/minecraft/server/BlockDirtSnowSpreadable.java -@@ -31,6 +31,7 @@ public abstract class BlockDirtSnowSpreadable extends BlockDirtSnow { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java +index a98392f06e66959ec1b75df8d2ecf3b5267980af..b8b0ac69a4114936cfe86ab90f95bba5bf125069 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockDirtSnowSpreadable.java +@@ -41,6 +41,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/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch b/Spigot-Server-Patches/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch index 118e8cdcbd..d3f898437e 100644 --- a/Spigot-Server-Patches/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch +++ b/Spigot-Server-Patches/0081-Fix-Cancelling-BlockPlaceEvent-triggering-physics.patch @@ -4,11 +4,11 @@ Date: Sun, 3 Apr 2016 17:48:50 -0400 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 e04d2182915ca3ac69353ef967ae3f703ab9fc30..3dd789131e8ebe5ac82b1fac2cd15aa5893704ee 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -466,6 +466,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 70db5312ac556ea53247efdbc7759910ba0c9a95..7611481db980a230d42b3cec1d81fae2622ca634 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -518,6 +518,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public void b(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1) {} public void applyPhysics(BlockPosition blockposition, Block block) { diff --git a/Spigot-Server-Patches/0082-Optimize-DataBits.patch b/Spigot-Server-Patches/0082-Optimize-DataBits.patch index 8b7f3a150e..61a9ac3f61 100644 --- a/Spigot-Server-Patches/0082-Optimize-DataBits.patch +++ b/Spigot-Server-Patches/0082-Optimize-DataBits.patch @@ -10,11 +10,11 @@ After: http://i.imgur.com/nJ46crB.png Optimize redundant converting of static fields into an unsigned long each call by precomputing it in ctor -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 53e7bac2f7a99238f509bb0f871ebed103fda568..2a01a48ad347fb123492218a60404b034cfcfbc5 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -12,8 +12,8 @@ public class DataBits { +diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java +index 0c0576c8730069fb5364d8383dec8ab7e698658d..c4f3b680512fb15cea01ad12d0a00c6e60bf34b7 100644 +--- a/src/main/java/net/minecraft/util/DataBits.java ++++ b/src/main/java/net/minecraft/util/DataBits.java +@@ -13,8 +13,8 @@ public class DataBits { private final long d; private final int e; private final int f; @@ -25,7 +25,7 @@ index 53e7bac2f7a99238f509bb0f871ebed103fda568..2a01a48ad347fb123492218a60404b03 private final int i; public DataBits(int i, int j) { -@@ -28,8 +28,8 @@ public class DataBits { +@@ -29,8 +29,8 @@ public class DataBits { this.f = (char) (64 / i); int k = 3 * (this.f - 1); @@ -36,7 +36,7 @@ index 53e7bac2f7a99238f509bb0f871ebed103fda568..2a01a48ad347fb123492218a60404b03 this.i = DataBits.a[k + 2]; int l = (j + this.f - 1) / this.f; -@@ -46,15 +46,15 @@ public class DataBits { +@@ -47,15 +47,15 @@ public class DataBits { } private int b(int i) { @@ -58,7 +58,7 @@ index 53e7bac2f7a99238f509bb0f871ebed103fda568..2a01a48ad347fb123492218a60404b03 int k = this.b(i); long l = this.b[k]; int i1 = (i - k * this.f) * this.c; -@@ -64,9 +64,9 @@ public class DataBits { +@@ -65,9 +65,9 @@ public class DataBits { return j1; } @@ -71,7 +71,7 @@ index 53e7bac2f7a99238f509bb0f871ebed103fda568..2a01a48ad347fb123492218a60404b03 int k = this.b(i); long l = this.b[k]; int i1 = (i - k * this.f) * this.c; -@@ -74,8 +74,8 @@ public class DataBits { +@@ -75,8 +75,8 @@ public class DataBits { this.b[k] = l & ~(this.d << i1) | ((long) j & this.d) << i1; } diff --git a/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch b/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch index 1a6fe5f06b..e520454f69 100644 --- a/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch +++ b/Spigot-Server-Patches/0083-Option-to-use-vanilla-per-world-scoreboard-coloring-.patch @@ -26,22 +26,22 @@ index db2dddd12f54e6d15916c4cee623676541de37fb..1942f5224aaebb18adb591d6f70a419c + } } diff --git a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -index aa509a1f382991e0f5683b75b0af4094f84d2844..e8d699b01a3bae60720c81e4427a310e2a2b1640 100644 +index d92a454adc9773883563eb0efff9c6445b89c0d4..712ca6b3857c6e5cae25a71228365508e514a0f4 100644 --- a/src/main/java/io/papermc/paper/adventure/ChatProcessor.java +++ b/src/main/java/io/papermc/paper/adventure/ChatProcessor.java -@@ -14,7 +14,11 @@ import net.kyori.adventure.text.event.ClickEvent; - import net.minecraft.server.EntityPlayer; - import net.minecraft.server.IChatBaseComponent; +@@ -16,7 +16,11 @@ import net.kyori.adventure.text.format.TextDecoration; + import net.minecraft.network.chat.IChatBaseComponent; import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.ScoreboardTeam; -+import net.minecraft.server.ScoreboardTeamBase; + import net.minecraft.server.level.EntityPlayer; ++import net.minecraft.world.scores.ScoreboardTeam; ++import net.minecraft.world.scores.ScoreboardTeamBase; import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.util.LazyPlayerSet; import org.bukkit.craftbukkit.util.Waitable; -@@ -175,10 +179,22 @@ public final class ChatProcessor { +@@ -104,10 +108,22 @@ public final class ChatProcessor { } private static String legacyDisplayName(final CraftPlayer player) { diff --git a/Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch b/Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch index 37065934b8..736a0b97ca 100644 --- a/Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch +++ b/Spigot-Server-Patches/0084-Workaround-for-setting-passengers-on-players.patch @@ -6,7 +6,7 @@ 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 0a00d043c1fcddcfab8638eab8feb2993060b9b8..ecec8a27009f2296e078fdb9bf1ed2f1df209de8 100644 +index b4a2758ee246252d6076e861b45d11dae6e33096..facf2a79144a2d0fbea907c084becaea7bbdc48c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -874,6 +874,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -18,7 +18,7 @@ index 0a00d043c1fcddcfab8638eab8feb2993060b9b8..ecec8a27009f2296e078fdb9bf1ed2f1 + public boolean setPassenger(org.bukkit.entity.Entity passenger) { + boolean wasSet = super.setPassenger(passenger); + if (wasSet) { -+ this.getHandle().playerConnection.sendPacket(new net.minecraft.server.PacketPlayOutMount(this.getHandle())); ++ this.getHandle().playerConnection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutMount(this.getHandle())); + } + return wasSet; + } diff --git a/Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch b/Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch index a6188cbf9a..cff05cecd4 100644 --- a/Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch +++ b/Spigot-Server-Patches/0085-Remove-unused-World-Tile-Entity-List.patch @@ -5,11 +5,33 @@ 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 d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b6917a1ae393 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -39,7 +39,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index acff0752aba49bb360d944e5f648b80a82bc984d..e96a92119dce25c34509e502e8dce8596af6fd67 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1720,7 +1720,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); +- bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityList.size())); ++ bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityListTick.size())); // Paper - remove unused list + 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"); +@@ -1859,7 +1859,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); +- Iterator iterator = this.tileEntityList.iterator(); ++ Iterator iterator = this.tileEntityListTick.iterator(); // Paper - remove unused list + + while (iterator.hasNext()) { + TileEntity tileentity = (TileEntity) iterator.next(); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 7611481db980a230d42b3cec1d81fae2622ca634..2bb85896df999675d33f70a90f1c68865099ee83 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -91,7 +91,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public static final ResourceKey THE_NETHER = ResourceKey.a(IRegistry.L, new MinecraftKey("the_nether")); public static final ResourceKey THE_END = ResourceKey.a(IRegistry.L, new MinecraftKey("the_end")); private static final EnumDirection[] a = EnumDirection.values(); @@ -18,7 +40,7 @@ index d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b691 public final List tileEntityListTick = Lists.newArrayList(); protected final List tileEntityListPending = Lists.newArrayList(); protected final java.util.Set tileEntityListUnload = com.google.common.collect.Sets.newHashSet(); -@@ -631,9 +631,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -683,9 +683,9 @@ public abstract class World implements GeneratorAccess, AutoCloseable { }, tileentity::getPosition}); } @@ -30,7 +52,7 @@ index d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b691 this.tileEntityListTick.add(tileentity); } -@@ -669,7 +669,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -721,7 +721,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { this.tileEntityListTick.removeAll(this.tileEntityListUnload); @@ -39,7 +61,7 @@ index d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b691 this.tileEntityListUnload.clear(); } -@@ -729,7 +729,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -781,7 +781,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { tilesThisCycle--; this.tileEntityListTick.remove(tileTickPosition--); // Spigot end @@ -48,7 +70,7 @@ index d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b691 if (this.isLoaded(tileentity.getPosition())) { this.getChunkAtWorldCoords(tileentity.getPosition()).removeTileEntity(tileentity.getPosition()); } -@@ -759,7 +759,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -811,7 +811,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 +79,7 @@ index d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b691 this.a(tileentity1); } // CraftBukkit end -@@ -905,7 +905,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -957,7 +957,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } else { if (tileentity != null) { this.tileEntityListPending.remove(tileentity); @@ -66,25 +88,3 @@ index d6ee6aae693519a379b4a6ba26642d5ef78e4deb..369a6b42a89fd75aeb3da4930f47b691 this.tileEntityListTick.remove(tileentity); } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index dbb022fb186b181b9b1912adfaebbb00fa1c7d4b..486ba1efc934c6851d2b570493af6e1079a7abd5 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1611,7 +1611,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - - bufferedwriter.write(String.format("entities: %d\n", this.entitiesById.size())); -- bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityList.size())); -+ bufferedwriter.write(String.format("block_entities: %d\n", this.tileEntityListTick.size())); // Paper - remove unused list - 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"); -@@ -1750,7 +1750,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); -- Iterator iterator = this.tileEntityList.iterator(); -+ Iterator iterator = this.tileEntityListTick.iterator(); // Paper - remove unused list - - while (iterator.hasNext()) { - TileEntity tileentity = (TileEntity) iterator.next(); diff --git a/Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch b/Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch index 1c814d0fdf..d284e13870 100644 --- a/Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch +++ b/Spigot-Server-Patches/0086-Don-t-tick-Skulls-unused-code.patch @@ -4,12 +4,12 @@ Date: Wed, 13 Apr 2016 00:30:10 -0400 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 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; - import java.util.concurrent.Callable; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java +index 5e778fcc1bce3339890933c0c769701a432240d8..06ab45e0927403beb6b5e11d2b5ea93d4786f1d3 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java +@@ -32,7 +32,7 @@ import net.minecraft.server.MinecraftServer; + import net.minecraft.world.entity.player.EntityHuman; // Spigot end -public class TileEntitySkull extends TileEntity implements ITickable { @@ -17,7 +17,7 @@ index 5528df3d07a2649a5248ff3b26720a2e2a4a0c25..4fae1b3274a96b871b39de083e9b28ab @Nullable private static UserCache userCache; -@@ -127,7 +127,7 @@ public class TileEntitySkull extends TileEntity implements ITickable { +@@ -135,7 +135,7 @@ public class TileEntitySkull extends TileEntity implements ITickable { } diff --git a/Spigot-Server-Patches/0087-Configurable-Player-Collision.patch b/Spigot-Server-Patches/0087-Configurable-Player-Collision.patch index 7cb24bc7b9..3852c395e2 100644 --- a/Spigot-Server-Patches/0087-Configurable-Player-Collision.patch +++ b/Spigot-Server-Patches/0087-Configurable-Player-Collision.patch @@ -18,11 +18,24 @@ index 439dcc6effdc91830d2b7ede9063982998b37120..504efea7b6f50a0d17f4f353781953df + enablePlayerCollisions = getBoolean("settings.enable-player-collisions", true); + } } +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java +index bc40f2cbe1645fd60c4cee106b90f17cd043d32d..c1bb5c325286119891e8d68ce8f7328c99edb486 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutScoreboardTeam.java +@@ -112,7 +112,7 @@ public class PacketPlayOutScoreboardTeam implements Packet playersByName = new java.util.HashMap<>(); @@ -68,7 +68,7 @@ index acbdc4736c2f6f181e25b776a2c025bd2af85af2..5652462008dd857f2dc36b80e3fe5d3d public PlayerList(MinecraftServer minecraftserver, IRegistryCustom.Dimension iregistrycustom_dimension, WorldNBTStorage worldnbtstorage, int i) { this.cserver = minecraftserver.server = new CraftServer((DedicatedServer) minecraftserver, this); -@@ -301,6 +302,13 @@ public abstract class PlayerList { +@@ -376,6 +377,13 @@ public abstract class PlayerList { } entityplayer.syncInventory(); @@ -82,7 +82,7 @@ index acbdc4736c2f6f181e25b776a2c025bd2af85af2..5652462008dd857f2dc36b80e3fe5d3d // CraftBukkit - Moved from above, added world PlayerList.LOGGER.info("{}[{}] logged in with entity id {} at ([{}]{}, {}, {})", entityplayer.getDisplayName().getString(), s1, entityplayer.getId(), worldserver1.worldDataServer.getName(), entityplayer.locX(), entityplayer.locY(), entityplayer.locZ()); } -@@ -421,6 +429,16 @@ public abstract class PlayerList { +@@ -496,6 +504,16 @@ public abstract class PlayerList { entityplayer.playerTick(); // SPIGOT-924 // CraftBukkit end @@ -99,7 +99,7 @@ index acbdc4736c2f6f181e25b776a2c025bd2af85af2..5652462008dd857f2dc36b80e3fe5d3d this.savePlayerFile(entityplayer); if (entityplayer.isPassenger()) { Entity entity = entityplayer.getRootVehicle(); -@@ -1069,6 +1087,13 @@ public abstract class PlayerList { +@@ -1144,6 +1162,13 @@ public abstract class PlayerList { } // CraftBukkit end diff --git a/Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch b/Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch index 3823a16e8b..ec7652c216 100644 --- a/Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch +++ b/Spigot-Server-Patches/0088-Add-handshake-event-to-allow-plugins-to-handle-clien.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Add handshake event to allow plugins to handle client handshaking logic themselves -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 69fd0a7b230c6f6eb46a43477465f77b265cc3c9..bad5d4f165d1e469ed583b036f78e467b94691fd 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 { +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java +index b1714750538a0107d9922812d08471921b755925..31011ec34e5eeae29705f6ec167fb2e832284873 100644 +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java +@@ -25,7 +25,7 @@ public class HandshakeListener implements PacketHandshakingInListener { // CraftBukkit end private static final IChatBaseComponent a = new ChatComponentText("Ignoring status request"); private final MinecraftServer b; @@ -18,7 +18,7 @@ index 69fd0a7b230c6f6eb46a43477465f77b265cc3c9..bad5d4f165d1e469ed583b036f78e467 public HandshakeListener(MinecraftServer minecraftserver, NetworkManager networkmanager) { this.b = minecraftserver; -@@ -73,8 +73,34 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -84,8 +84,34 @@ public class HandshakeListener implements PacketHandshakingInListener { this.c.close(chatmessage); } else { this.c.setPacketListener(new LoginListener(this.b, this.c)); diff --git a/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch b/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch index a20dd2ee95..05f3461032 100644 --- a/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch +++ b/Spigot-Server-Patches/0089-Configurable-RCON-IP-address.patch @@ -5,11 +5,11 @@ 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 ebeea0df593bc82e7740203bec6b45e16318ab35..205d56f88440789df8a028b3827dd388fea56f63 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java -+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java -@@ -61,6 +61,8 @@ public class DedicatedServerProperties extends PropertyManager.EditableProperty whiteList; public final GeneratorSettings generatorSettings; @@ -18,7 +18,7 @@ index ebeea0df593bc82e7740203bec6b45e16318ab35..205d56f88440789df8a028b3827dd388 // CraftBukkit start public DedicatedServerProperties(Properties properties, IRegistryCustom iregistrycustom, OptionSet optionset) { super(properties, optionset); -@@ -112,6 +114,10 @@ public class DedicatedServerProperties extends PropertyManager> { +diff --git a/src/main/java/net/minecraft/server/dedicated/PropertyManager.java b/src/main/java/net/minecraft/server/dedicated/PropertyManager.java +index cb85d8bc1b81f9e5fa95c4dfeffbe689667f56a2..03dd6dc3a1aa8d1be6990c750f96e8a280bc1f25 100644 +--- a/src/main/java/net/minecraft/server/dedicated/PropertyManager.java ++++ b/src/main/java/net/minecraft/server/dedicated/PropertyManager.java +@@ -129,8 +129,8 @@ public abstract class PropertyManager> { }; } @@ -44,11 +44,11 @@ index 3aa05fd2b38562039960b58cab0ea40743ef06bb..2170d539a72a3e254a688e6148b28297 return (String) getOverride(s, this.properties.getProperty(s)); // CraftBukkit } -diff --git a/src/main/java/net/minecraft/server/RemoteControlListener.java b/src/main/java/net/minecraft/server/RemoteControlListener.java -index 44afacf7ebbdf09a25189cc636e9c8149e03c9f2..8006659f167879863b5e89e527813e6f664e90d6 100644 ---- a/src/main/java/net/minecraft/server/RemoteControlListener.java -+++ b/src/main/java/net/minecraft/server/RemoteControlListener.java -@@ -60,7 +60,7 @@ public class RemoteControlListener extends RemoteConnectionThread { +diff --git a/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java b/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java +index 797a450a08da1b799e32fae2a71a7a50bb90d127..3b3e21d1d86629d6c5e06108e53d1c5e807074d8 100644 +--- a/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java ++++ b/src/main/java/net/minecraft/server/rcon/thread/RemoteControlListener.java +@@ -62,7 +62,7 @@ public class RemoteControlListener extends RemoteConnectionThread { @Nullable public static RemoteControlListener a(IMinecraftServer iminecraftserver) { DedicatedServerProperties dedicatedserverproperties = iminecraftserver.getDedicatedServerProperties(); diff --git a/Spigot-Server-Patches/0090-Prevent-Fire-from-loading-chunks-wrongly-spread.patch b/Spigot-Server-Patches/0090-Prevent-Fire-from-loading-chunks-wrongly-spread.patch index 798a8103b1..c379b25eba 100644 --- a/Spigot-Server-Patches/0090-Prevent-Fire-from-loading-chunks-wrongly-spread.patch +++ b/Spigot-Server-Patches/0090-Prevent-Fire-from-loading-chunks-wrongly-spread.patch @@ -8,11 +8,11 @@ bad behavior. This also stops fire from spreading to illegal locations. -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index 3d6aae40cab0cefbfc56389d9d2d37d2f0badd98..e79f3872de2989d0b9b28a8b49cc399968f5bdbf 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java -@@ -115,7 +115,7 @@ public class BlockFire extends BlockFireAbstract { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java +index ee5400fd3e493e1f0518a9e47ddbc997e7a0fb92..c22fad0038fdb0769e23db782e3341206fbd80f9 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java +@@ -135,7 +135,7 @@ public class BlockFire extends BlockFireAbstract { BlockStateBoolean blockstateboolean = (BlockStateBoolean) BlockFire.h.get(enumdirection); if (blockstateboolean != null) { @@ -21,7 +21,7 @@ index 3d6aae40cab0cefbfc56389d9d2d37d2f0badd98..e79f3872de2989d0b9b28a8b49cc3999 } } -@@ -195,6 +195,7 @@ public class BlockFire extends BlockFireAbstract { +@@ -215,6 +215,7 @@ public class BlockFire extends BlockFireAbstract { } blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, l, j1, i1); @@ -29,7 +29,7 @@ index 3d6aae40cab0cefbfc56389d9d2d37d2f0badd98..e79f3872de2989d0b9b28a8b49cc3999 int l1 = this.a((IWorldReader) worldserver, (BlockPosition) blockposition_mutableblockposition); if (l1 > 0) { -@@ -240,10 +241,16 @@ public class BlockFire extends BlockFireAbstract { +@@ -260,10 +261,16 @@ public class BlockFire extends BlockFireAbstract { } private void trySpread(World world, BlockPosition blockposition, int i, Random random, int j, BlockPosition sourceposition) { // CraftBukkit add sourceposition @@ -48,7 +48,7 @@ index 3d6aae40cab0cefbfc56389d9d2d37d2f0badd98..e79f3872de2989d0b9b28a8b49cc3999 // CraftBukkit start org.bukkit.block.Block theBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -@@ -289,7 +296,7 @@ public class BlockFire extends BlockFireAbstract { +@@ -309,7 +316,7 @@ public class BlockFire extends BlockFireAbstract { for (int j = 0; j < i; ++j) { EnumDirection enumdirection = aenumdirection[j]; @@ -57,7 +57,7 @@ index 3d6aae40cab0cefbfc56389d9d2d37d2f0badd98..e79f3872de2989d0b9b28a8b49cc3999 return true; } } -@@ -307,7 +314,12 @@ public class BlockFire extends BlockFireAbstract { +@@ -327,7 +334,12 @@ public class BlockFire extends BlockFireAbstract { for (int k = 0; k < j; ++k) { EnumDirection enumdirection = aenumdirection[k]; @@ -71,7 +71,7 @@ index 3d6aae40cab0cefbfc56389d9d2d37d2f0badd98..e79f3872de2989d0b9b28a8b49cc3999 i = Math.max(this.getFlameChance(iblockdata), i); } -@@ -318,7 +330,7 @@ public class BlockFire extends BlockFireAbstract { +@@ -338,7 +350,7 @@ public class BlockFire extends BlockFireAbstract { @Override protected boolean e(IBlockData iblockdata) { diff --git a/Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch b/Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch index 570f17e7cd..6ac0328a11 100644 --- a/Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch +++ b/Spigot-Server-Patches/0091-Implement-PlayerLocaleChangeEvent.patch @@ -4,11 +4,11 @@ Date: Tue, 19 Apr 2016 14:09:31 -0500 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 74727e9e1d689e4a280fb223db9196fef16103f7..103a7fe192182d92ae21783c728e494b5533917a 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1558,7 +1558,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 1f31104a1a350f3b53ce45b034cafe528d406291..3d5d1b83094b5ca45fae47055db397630fdd4f04 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -1685,7 +1685,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return s; } @@ -17,7 +17,7 @@ index 74727e9e1d689e4a280fb223db9196fef16103f7..103a7fe192182d92ae21783c728e494b public java.util.Locale adventure$locale = java.util.Locale.US; // Paper public void a(PacketPlayInSettings packetplayinsettings) { // CraftBukkit start -@@ -1566,9 +1566,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1693,9 +1693,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); this.server.server.getPluginManager().callEvent(event); } @@ -30,7 +30,7 @@ index 74727e9e1d689e4a280fb223db9196fef16103f7..103a7fe192182d92ae21783c728e494b this.locale = packetplayinsettings.locale; // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index b93e6c6ec058c3cc73c7fec47e081a5295c1ec6b..f2cb1d8d82f07019d79a3b967f999b26270f7c29 100644 +index facf2a79144a2d0fbea907c084becaea7bbdc48c..6d7f1dee9ae2fb0b9620d85969de86eee09020cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1874,8 +1874,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch b/Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch index aec26401da..99e9b4058c 100644 --- a/Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch +++ b/Spigot-Server-Patches/0092-EntityRegainHealthEvent-isFastRegen-API.patch @@ -5,11 +5,11 @@ 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 1fb7e29b29adef72bd5a49c87d954973f46f9c81..f54d05f59342231434a70c3b12b7cf9b73f98508 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1037,10 +1037,16 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index acbd10432b09172f7541b2f4081d1aa9812194ac..ecb07130be80b484e0f2241a368db967775148e8 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -1130,10 +1130,16 @@ public abstract class EntityLiving extends Entity { } public void heal(float f, EntityRegainHealthEvent.RegainReason regainReason) { @@ -27,11 +27,11 @@ index 1fb7e29b29adef72bd5a49c87d954973f46f9c81..f54d05f59342231434a70c3b12b7cf9b // Suppress during worldgen 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 f40b67c8bf3048b24b7c7b16effd3c18646d589c..077ff94ec57278f71ea6afb5d7a0e55ecb0fa5ef 100644 ---- a/src/main/java/net/minecraft/server/FoodMetaData.java -+++ b/src/main/java/net/minecraft/server/FoodMetaData.java -@@ -74,7 +74,7 @@ public class FoodMetaData { +diff --git a/src/main/java/net/minecraft/world/food/FoodMetaData.java b/src/main/java/net/minecraft/world/food/FoodMetaData.java +index 7ed321acba6d46159f7d67b8d10a0a3e06ac88a9..e455b25b0809af15f6fde957121d0110da7eb08f 100644 +--- a/src/main/java/net/minecraft/world/food/FoodMetaData.java ++++ b/src/main/java/net/minecraft/world/food/FoodMetaData.java +@@ -87,7 +87,7 @@ public class FoodMetaData { if (this.foodTickTimer >= this.saturatedRegenRate) { // CraftBukkit float f = Math.min(this.saturationLevel, 6.0F); diff --git a/Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch b/Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch index 132fd8a121..c48a22b74f 100644 --- a/Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch +++ b/Spigot-Server-Patches/0093-Add-ability-to-configure-frosted_ice-properties.patch @@ -23,11 +23,11 @@ index 1942f5224aaebb18adb591d6f70a419cfc1a7bdd..5baccb8d50c135ab20c38ffd0690f585 + log("Frosted Ice: " + (this.frostedIceEnabled ? "enabled" : "disabled") + " / delay: min=" + this.frostedIceDelayMin + ", max=" + this.frostedIceDelayMax); + } } -diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 00e19300f7f0c9873ca7abb0560f3a9308d2a73d..061b157f66999a733c3c4e990371b6f8d7860de2 100644 ---- a/src/main/java/net/minecraft/server/BlockIceFrost.java -+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -18,6 +18,7 @@ public class BlockIceFrost extends BlockIce { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java +index 7239a30bd4a5dc4ed09802eea8f7126485ebb635..e32e94868386ff06ff29254e6cc3bee9b446a293 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java +@@ -30,6 +30,7 @@ public class BlockIceFrost extends BlockIce { @Override public void tickAlways(IBlockData iblockdata, WorldServer worldserver, BlockPosition blockposition, Random random) { @@ -35,7 +35,7 @@ index 00e19300f7f0c9873ca7abb0560f3a9308d2a73d..061b157f66999a733c3c4e990371b6f8 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.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); EnumDirection[] aenumdirection = EnumDirection.values(); -@@ -30,12 +31,12 @@ public class BlockIceFrost extends BlockIce { +@@ -42,12 +43,12 @@ public class BlockIceFrost extends BlockIce { IBlockData iblockdata1 = worldserver.getType(blockposition_mutableblockposition); if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) { diff --git a/Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch b/Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch index 7961c2a971..1ec962b183 100644 --- a/Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch +++ b/Spigot-Server-Patches/0094-remove-null-possibility-for-getServer-singleton.patch @@ -6,10 +6,10 @@ 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 5fd43537ced63947cab0e179f88109d63d1c87e7..5c84033df42b2cba1719010e75aeeb00c817eb61 100644 +index bea6cd6cf4dceece74de9cbb12a094334d129c4a..3b2fcb4338d56a8e1dd2de799571db4e2a79ec9f 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -72,6 +72,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot +@@ -179,6 +179,7 @@ import org.spigotmc.SlackActivityAccountant; // Spigot public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { @@ -17,7 +17,7 @@ index 5fd43537ced63947cab0e179f88109d63d1c87e7..5c84033df42b2cba1719010e75aeeb00 public static final Logger LOGGER = LogManager.getLogger(); public static final File b = new File("usercache.json"); public static final WorldSettings c = new WorldSettings("Demo World", EnumGamemode.SURVIVAL, false, EnumDifficulty.NORMAL, false, new GameRules(), DataPackConfiguration.a); -@@ -178,6 +179,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant m = Maps.newHashMap(); public final Map decorations = Maps.newLinkedHashMap(); private final Map n = Maps.newHashMap(); @@ -41,7 +53,7 @@ index d11725d61b888ceb08c4ea30f23d563170ce944d..7251793423e5413dacc1e031ed75d41f // CraftBukkit start public final CraftMapView mapView; -@@ -49,6 +50,7 @@ public class WorldMap extends PersistentBase { +@@ -69,6 +70,7 @@ public class WorldMap extends PersistentBase { // CraftBukkit start mapView = new CraftMapView(this); server = (CraftServer) org.bukkit.Bukkit.getServer(); @@ -49,7 +61,7 @@ index d11725d61b888ceb08c4ea30f23d563170ce944d..7251793423e5413dacc1e031ed75d41f // CraftBukkit end } -@@ -116,6 +118,7 @@ public class WorldMap extends PersistentBase { +@@ -136,6 +138,7 @@ public class WorldMap extends PersistentBase { 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()); } @@ -57,7 +69,7 @@ index d11725d61b888ceb08c4ea30f23d563170ce944d..7251793423e5413dacc1e031ed75d41f NBTTagList nbttaglist1 = nbttagcompound.getList("frames", 10); -@@ -196,6 +199,7 @@ public class WorldMap extends PersistentBase { +@@ -216,6 +219,7 @@ public class WorldMap extends PersistentBase { this.b(); } @@ -65,7 +77,7 @@ index d11725d61b888ceb08c4ea30f23d563170ce944d..7251793423e5413dacc1e031ed75d41f public void a(EntityHuman entityhuman, ItemStack itemstack) { if (!this.humans.containsKey(entityhuman)) { WorldMap.WorldMapHumanTracker worldmap_worldmaphumantracker = new WorldMap.WorldMapHumanTracker(entityhuman); -@@ -431,6 +435,21 @@ public class WorldMap extends PersistentBase { +@@ -451,6 +455,21 @@ public class WorldMap extends PersistentBase { public class WorldMapHumanTracker { @@ -87,7 +99,7 @@ index d11725d61b888ceb08c4ea30f23d563170ce944d..7251793423e5413dacc1e031ed75d41f public final EntityHuman trackee; private boolean d = true; private int e; -@@ -447,9 +466,12 @@ public class WorldMap extends PersistentBase { +@@ -467,9 +486,12 @@ public class WorldMap extends PersistentBase { @Nullable public Packet a(ItemStack itemstack) { // CraftBukkit start @@ -101,18 +113,6 @@ index d11725d61b888ceb08c4ea30f23d563170ce944d..7251793423e5413dacc1e031ed75d41f 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 486ba1efc934c6851d2b570493af6e1079a7abd5..03b81f40e1ad394d7d287825dabe2ad4b905ac60 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1059,6 +1059,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - { - if ( iter.next().trackee == entity ) - { -+ map.decorations.remove(entity.getDisplayName().getString()); // Paper - iter.remove(); - } - } diff --git a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java b/src/main/java/org/bukkit/craftbukkit/map/RenderData.java index 256a131781721c86dd6cdbc329335964570cbe8c..5768cd512ec166f1e8d1f4a28792015347297c3f 100644 --- a/src/main/java/org/bukkit/craftbukkit/map/RenderData.java diff --git a/Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch b/Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch index 736b2c1b14..7d27f20665 100644 --- a/Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch +++ b/Spigot-Server-Patches/0096-LootTable-API-Replenishable-Lootables-Feature.patch @@ -43,15 +43,15 @@ index 5baccb8d50c135ab20c38ffd0690f585514ce5af..eb04fdb172a50ec1f5b7fe78fa0e7655 } diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..d6fce3112ebd8ef208c6fe45e0d887ec778fc092 +index 0000000000000000000000000000000000000000..5dfc3c8008d64ad4ed71b4904c897f5005491349 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableBlockInventory.java @@ -0,0 +1,33 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.TileEntityLootable; -+import net.minecraft.server.World; ++import net.minecraft.core.BlockPosition; ++import net.minecraft.world.level.World; ++import net.minecraft.world.level.block.entity.TileEntityLootable; +import org.bukkit.Chunk; +import org.bukkit.block.Block; + @@ -82,18 +82,18 @@ index 0000000000000000000000000000000000000000..d6fce3112ebd8ef208c6fe45e0d887ec +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..5e637782d555cd68952e8bdbd47a63a636348ec6 +index 0000000000000000000000000000000000000000..019a06fa2b43cacd3bbd4d58aba71b3728f37581 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableEntityInventory.java @@ -0,0 +1,28 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.World; ++import net.minecraft.world.level.World; +import org.bukkit.entity.Entity; + +public interface PaperLootableEntityInventory extends LootableEntityInventory, PaperLootableInventory { + -+ net.minecraft.server.Entity getHandle(); ++ net.minecraft.world.entity.Entity getHandle(); + + @Override + default LootableInventory getAPILootableInventory() { @@ -116,13 +116,13 @@ index 0000000000000000000000000000000000000000..5e637782d555cd68952e8bdbd47a63a6 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..856843fc917ff6a7252b7900f7772cc9debe3649 +index 0000000000000000000000000000000000000000..59e8aea749bbba079e3304d9a5854280db2692e9 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventory.java @@ -0,0 +1,71 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.World; ++import net.minecraft.world.level.World; +import org.bukkit.loot.Lootable; + +import java.util.UUID; @@ -193,14 +193,16 @@ index 0000000000000000000000000000000000000000..856843fc917ff6a7252b7900f7772cc9 +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java new file mode 100644 -index 0000000000000000000000000000000000000000..b5401eaf974857455c17c3f9cfdedf2eb4bde321 +index 0000000000000000000000000000000000000000..904332454ede006f4ee33337d46b11674d78bef7 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperLootableInventoryData.java -@@ -0,0 +1,179 @@ +@@ -0,0 +1,181 @@ +package com.destroystokyo.paper.loottable; + +import com.destroystokyo.paper.PaperWorldConfig; -+import net.minecraft.server.*; ++import net.minecraft.nbt.NBTTagCompound; ++import net.minecraft.nbt.NBTTagList; ++import net.minecraft.world.entity.player.EntityHuman; +import org.bukkit.entity.Player; +import org.bukkit.loot.LootTable; + @@ -378,16 +380,15 @@ index 0000000000000000000000000000000000000000..b5401eaf974857455c17c3f9cfdedf2e +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..8c1fa60a55570be91ab5ea63cb2005caa09e3600 +index 0000000000000000000000000000000000000000..c682bd7700d8103533026d46cfc63a7abde5a5f4 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperMinecartLootableInventory.java -@@ -0,0 +1,63 @@ +@@ -0,0 +1,62 @@ +package com.destroystokyo.paper.loottable; + -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityMinecartContainer; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.World; ++import net.minecraft.world.entity.Entity; ++import net.minecraft.world.entity.vehicle.EntityMinecartContainer; ++import net.minecraft.world.level.World; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; + @@ -447,16 +448,15 @@ index 0000000000000000000000000000000000000000..8c1fa60a55570be91ab5ea63cb2005ca +} diff --git a/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java new file mode 100644 -index 0000000000000000000000000000000000000000..a1923aff2b5e2e867670a5a064a767915fc1cc2a +index 0000000000000000000000000000000000000000..9dae34370d014a291f025f83b55e18bff4619a23 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/loottable/PaperTileEntityLootableInventory.java -@@ -0,0 +1,66 @@ +@@ -0,0 +1,65 @@ +package com.destroystokyo.paper.loottable; + +import net.minecraft.server.MCUtil; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.TileEntityLootable; -+import net.minecraft.server.World; ++import net.minecraft.world.level.World; ++import net.minecraft.world.level.block.entity.TileEntityLootable; +import org.bukkit.Bukkit; +import org.bukkit.craftbukkit.util.CraftNamespacedKey; + @@ -517,11 +517,11 @@ index 0000000000000000000000000000000000000000..a1923aff2b5e2e867670a5a064a76791 + return tileEntityLootable.getWorld(); + } +} -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 487d041999fd1edc4b48790dbc975cf8cea8ba54..0dd63d2e0ed16eb08cf97dbf8c293e24a5a1bda9 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 +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 6cbb797cb0de4b26d8ddd7f0bf567f49bd36f9c0..2b1b46bda48c0b137fe914c47a387e6e72a1be40 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -158,6 +158,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne }; // Paper end @@ -529,11 +529,11 @@ index 487d041999fd1edc4b48790dbc975cf8cea8ba54..0dd63d2e0ed16eb08cf97dbf8c293e24 private CraftEntity bukkitEntity; public CraftEntity getBukkitEntity() { -diff --git a/src/main/java/net/minecraft/server/EntityMinecartContainer.java b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -index 3258bf53761dbed2bfe9fd92e011161b914796d0..8e13aebb7043ddfb4b1c02bac46081eb15e906bf 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartContainer.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartContainer.java -@@ -20,6 +20,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java +index c4b970c37b1792ac0022936f2df4740183621a0d..0166d11cb540a536390f486e1069d6119d8d23d6 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartContainer.java +@@ -46,6 +46,7 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp public long lootTableSeed; // CraftBukkit start @@ -541,7 +541,7 @@ index 3258bf53761dbed2bfe9fd92e011161b914796d0..8e13aebb7043ddfb4b1c02bac46081eb public List transaction = new java.util.ArrayList(); private int maxStack = MAX_STACK; -@@ -177,12 +178,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp +@@ -203,12 +204,13 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @Override protected void saveData(NBTTagCompound nbttagcompound) { super.saveData(nbttagcompound); @@ -556,7 +556,7 @@ index 3258bf53761dbed2bfe9fd92e011161b914796d0..8e13aebb7043ddfb4b1c02bac46081eb ContainerUtil.a(nbttagcompound, this.items); } -@@ -191,11 +193,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp +@@ -217,11 +219,12 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp @Override protected void loadData(NBTTagCompound nbttagcompound) { super.loadData(nbttagcompound); @@ -570,7 +570,7 @@ index 3258bf53761dbed2bfe9fd92e011161b914796d0..8e13aebb7043ddfb4b1c02bac46081eb ContainerUtil.b(nbttagcompound, this.items); } -@@ -226,14 +229,15 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp +@@ -252,14 +255,15 @@ public abstract class EntityMinecartContainer extends EntityMinecartAbstract imp } public void d(@Nullable EntityHuman entityhuman) { @@ -588,11 +588,11 @@ index 3258bf53761dbed2bfe9fd92e011161b914796d0..8e13aebb7043ddfb4b1c02bac46081eb LootTableInfo.Builder loottableinfo_builder = (new LootTableInfo.Builder((WorldServer) this.world)).set(LootContextParameters.ORIGIN, this.getPositionVector()).a(this.lootTableSeed); if (entityhuman != null) { -diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index 9265bc7331f5d3cb43394a7457ab89140b731c8b..d9be182a574daaedcc7a106c759c2bde2e4eb19a 100644 ---- a/src/main/java/net/minecraft/server/TileEntityLootable.java -+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java -@@ -8,6 +8,7 @@ public abstract class TileEntityLootable extends TileEntityContainer { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java +index 62e6833a90d7adae3c7df33e3bc73b4288e0370b..1508e267a38555820e2d31f3075adca185fbd4b6 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java +@@ -27,6 +27,7 @@ public abstract class TileEntityLootable extends TileEntityContainer { @Nullable public MinecraftKey lootTable; public long lootTableSeed; @@ -600,7 +600,7 @@ index 9265bc7331f5d3cb43394a7457ab89140b731c8b..d9be182a574daaedcc7a106c759c2bde protected TileEntityLootable(TileEntityTypes tileentitytypes) { super(tileentitytypes); -@@ -23,16 +24,19 @@ public abstract class TileEntityLootable extends TileEntityContainer { +@@ -42,16 +43,19 @@ public abstract class TileEntityLootable extends TileEntityContainer { } protected boolean b(NBTTagCompound nbttagcompound) { @@ -621,7 +621,7 @@ index 9265bc7331f5d3cb43394a7457ab89140b731c8b..d9be182a574daaedcc7a106c759c2bde if (this.lootTable == null) { return false; } else { -@@ -41,19 +45,20 @@ public abstract class TileEntityLootable extends TileEntityContainer { +@@ -60,19 +64,20 @@ public abstract class TileEntityLootable extends TileEntityContainer { nbttagcompound.setLong("LootTableSeed", this.lootTableSeed); } @@ -646,7 +646,7 @@ index 9265bc7331f5d3cb43394a7457ab89140b731c8b..d9be182a574daaedcc7a106c759c2bde 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 df71eb9672ecc69ac92c773925d9b692ad343fee..8a7e9302b4b6be086144add8df610b76b58e00d6 100644 +index 524f27830752f424493c3ae8d793b871f6495594..dcf3f9265b0b00a7bbb9ff428e10da3c198ba08a 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 @@ -659,7 +659,7 @@ index df71eb9672ecc69ac92c773925d9b692ad343fee..8a7e9302b4b6be086144add8df610b76 } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java -index 89df1d7f8b1221014affec459244223491fafaa2..c0fed05d3b68258a61980bdb84fe16dd6adba4c5 100644 +index 486fa8937d644f59a770db163482259525a7e465..54eb170fd533b0e91572601268fcbc167ed9bb5c 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftChest.java @@ -12,8 +12,9 @@ import org.bukkit.craftbukkit.CraftWorld; @@ -674,26 +674,19 @@ index 89df1d7f8b1221014affec459244223491fafaa2..c0fed05d3b68258a61980bdb84fe16dd public CraftChest(final Block block) { super(block, TileEntityChest.class); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -index e1ad26a242b9bff8f5a567c24cf58b2150c24144..678aa09d477f653461276e5eab277e1abc253dd8 100644 +index f0a7e61a26c4668a9aa823d641f29bdecd42dd1f..3512054ede5fd1dd7605444e827e30a0be47f935 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftLootable.java -@@ -1,5 +1,6 @@ - package org.bukkit.craftbukkit.block; - -+import com.destroystokyo.paper.loottable.PaperLootableBlockInventory; - import net.minecraft.server.MinecraftKey; - import net.minecraft.server.TileEntityLootable; - import org.bukkit.Bukkit; -@@ -10,7 +11,7 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; +@@ -10,7 +10,7 @@ import org.bukkit.craftbukkit.util.CraftNamespacedKey; import org.bukkit.loot.LootTable; import org.bukkit.loot.Lootable; -public abstract class CraftLootable extends CraftContainer implements Nameable, Lootable { -+public abstract class CraftLootable extends CraftContainer implements Nameable, Lootable, PaperLootableBlockInventory { // Paper ++public abstract class CraftLootable extends CraftContainer implements Nameable, Lootable, com.destroystokyo.paper.loottable.PaperLootableBlockInventory { // Paper public CraftLootable(Block block, Class tileEntityClass) { super(block, tileEntityClass); -@@ -54,7 +55,7 @@ public abstract class CraftLootable extends CraftC +@@ -54,7 +54,7 @@ public abstract class CraftLootable extends CraftC setLootTable(getLootTable(), seed); } @@ -703,27 +696,20 @@ index e1ad26a242b9bff8f5a567c24cf58b2150c24144..678aa09d477f653461276e5eab277e1a getSnapshot().setLootTable(key, seed); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java -index e05624e6432f55c3efff3f9d765975557d1be16f..ab4807b2cd3cdcd61d8ac4ae2825df69dd2b7c64 100644 +index cbd121c21adfaf098dadca33de16a2e68d83c19a..d9a2552782c9242fb84cc0c8309a614a44777509 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartChest.java -@@ -1,5 +1,6 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper - import net.minecraft.server.EntityMinecartChest; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftInventory; -@@ -8,7 +9,7 @@ import org.bukkit.entity.minecart.StorageMinecart; +@@ -8,7 +8,7 @@ import org.bukkit.entity.minecart.StorageMinecart; import org.bukkit.inventory.Inventory; @SuppressWarnings("deprecation") -public class CraftMinecartChest extends CraftMinecartContainer implements StorageMinecart { -+public class CraftMinecartChest extends CraftMinecartContainer implements StorageMinecart, PaperLootableEntityInventory { // Paper ++public class CraftMinecartChest extends CraftMinecartContainer implements StorageMinecart, com.destroystokyo.paper.loottable.PaperLootableEntityInventory { // Paper private final CraftInventory inventory; public CraftMinecartChest(CraftServer server, EntityMinecartChest entity) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java -index 2d776b520bd9b0b8f7475f10e59b02b2ad7b9d8b..fcc9787848c0a0a4025bdf698debf9592c818bff 100644 +index 5ffb8108f456c2f7f3ed1a25249baccb4cbf4add..bf8b5b25d1af0c5129261e10abf2866521b2c375 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartContainer.java @@ -47,7 +47,7 @@ public abstract class CraftMinecartContainer extends CraftMinecart implements Lo @@ -736,22 +722,15 @@ index 2d776b520bd9b0b8f7475f10e59b02b2ad7b9d8b..fcc9787848c0a0a4025bdf698debf959 getHandle().setLootTable(newKey, seed); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -index 334bd5bb3ffc8b2bcdfca3995cdbe543cee8f311..f5b31237fc6e62345edcc3d6b02ff9e94237ae31 100644 +index 17a42aec76f32a28b0c9885c60d1ed50c6727161..bfdcf01d2c6570493e86330d56500427dbb23146 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecartHopper.java -@@ -1,5 +1,6 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.loottable.PaperLootableEntityInventory; // Paper - import net.minecraft.server.EntityMinecartHopper; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftInventory; -@@ -7,7 +8,7 @@ import org.bukkit.entity.EntityType; +@@ -7,7 +7,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.minecart.HopperMinecart; import org.bukkit.inventory.Inventory; -public final class CraftMinecartHopper extends CraftMinecartContainer implements HopperMinecart { -+public final class CraftMinecartHopper extends CraftMinecartContainer implements HopperMinecart, PaperLootableEntityInventory { // Paper ++public final class CraftMinecartHopper extends CraftMinecartContainer implements HopperMinecart, com.destroystokyo.paper.loottable.PaperLootableEntityInventory { // Paper private final CraftInventory inventory; public CraftMinecartHopper(CraftServer server, EntityMinecartHopper entity) { diff --git a/Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch b/Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch index 8ed06443d7..a61442ff71 100644 --- a/Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch +++ b/Spigot-Server-Patches/0097-Don-t-save-empty-scoreboard-teams-to-scoreboard.dat.patch @@ -18,11 +18,11 @@ index 504efea7b6f50a0d17f4f353781953dfb18bdeca..1b8e5671c9dc8c15ce33d351c1bb20f2 + saveEmptyScoreboardTeams = getBoolean("settings.save-empty-scoreboard-teams", false); + } } -diff --git a/src/main/java/net/minecraft/server/PersistentScoreboard.java b/src/main/java/net/minecraft/server/PersistentScoreboard.java -index 17bb9512e65f1a158efdc39813b04159000d9b33..a08c54da92d87fcd24ef8e2556901d3b1977c5ea 100644 ---- a/src/main/java/net/minecraft/server/PersistentScoreboard.java -+++ b/src/main/java/net/minecraft/server/PersistentScoreboard.java -@@ -174,6 +174,7 @@ public class PersistentScoreboard extends PersistentBase { +diff --git a/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java b/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java +index 3998565ccd87c966c0fb9e6757cd1861faa5bc15..52f27bdbd0df8bbbf2ad5144bc262b5093d83413 100644 +--- a/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java ++++ b/src/main/java/net/minecraft/world/scores/PersistentScoreboard.java +@@ -182,6 +182,7 @@ public class PersistentScoreboard extends PersistentBase { while (iterator.hasNext()) { ScoreboardTeam scoreboardteam = (ScoreboardTeam) iterator.next(); diff --git a/Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch b/Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch index 2e01e01977..652f8fbb89 100644 --- a/Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch +++ b/Spigot-Server-Patches/0099-Optimize-UserCache-Thread-Safe.patch @@ -9,24 +9,11 @@ easier to do this than replace the entire thing. Additionally, move Saving of the User cache to be done async, incase the user never changed the default setting for Spigot's save on stop only. -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 7b52bf335e60a700b4c4e25cab1b0261f32775bc..dc0cb79525adf0d5afee1f677e1fde546529cf97 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -212,7 +212,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - - if (this.convertNames()) { -- this.getUserCache().b(); -+ this.getUserCache().b(false); // Paper - } - - if (!NameReferencingFileConverter.e(this)) { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5c84033df42b2cba1719010e75aeeb00c817eb61..110184bd18f689cff1f37ceefe97416b5dcfd405 100644 +index 3b2fcb4338d56a8e1dd2de799571db4e2a79ec9f..c6ab645397911d984a28e40583bdb8f782a4f934 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -789,7 +789,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant listeningChannels = Collections.synchronizedList(Lists.newArrayList()); private final List connectedChannels = Collections.synchronizedList(Lists.newArrayList()); @@ -25,7 +25,7 @@ index 399420916da4c924cd28c0c4a45b4eca3972acb6..8fcd8f4056620713d0c02fdd9b829053 public ServerConnection(MinecraftServer minecraftserver) { this.e = minecraftserver; -@@ -74,7 +83,8 @@ public class ServerConnection { +@@ -87,7 +96,8 @@ public class ServerConnection { int j = ServerConnection.this.e.k(); Object object = j > 0 ? new NetworkManagerServer(j) : new NetworkManager(EnumProtocolDirection.SERVERBOUND); @@ -35,7 +35,7 @@ index 399420916da4c924cd28c0c4a45b4eca3972acb6..8fcd8f4056620713d0c02fdd9b829053 channel.pipeline().addLast("packet_handler", (ChannelHandler) object); ((NetworkManager) object).setPacketListener(new HandshakeListener(ServerConnection.this.e, (NetworkManager) object)); } -@@ -113,6 +123,7 @@ public class ServerConnection { +@@ -126,6 +136,7 @@ public class ServerConnection { synchronized (this.connectedChannels) { // Spigot Start diff --git a/Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch b/Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch index 7478923e65..56f0c27595 100644 --- a/Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch +++ b/Spigot-Server-Patches/0101-Optional-TNT-doesn-t-move-in-water.patch @@ -31,11 +31,24 @@ index eb04fdb172a50ec1f5b7fe78fa0e7655246abd60..6eca3f300020006f02dd36253b522db4 + log("Prevent TNT from moving in water: " + preventTntFromMovingInWater); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 0dd63d2e0ed16eb08cf97dbf8c293e24a5a1bda9..6aa29495802b7d52c4c0f283495c7d1762f657fa 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2681,6 +2681,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index f5227aa761d326376d057eaadcdbef024ed30241..44b79c97d5cc7570683e1b7f025b4f3ad65beb81 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -67,7 +67,7 @@ public class EntityTrackerEntry { + private boolean q; + private boolean r; + // CraftBukkit start +- private final Set trackedPlayers; ++ final Set trackedPlayers; // Paper - private -> package + // Paper start + private java.util.Map trackedPlayerMap = null; + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 2b1b46bda48c0b137fe914c47a387e6e72a1be40..ee160558d84b24e1309262874a9d433bbe6593f3 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2766,6 +2766,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean bV() { @@ -47,11 +60,11 @@ index 0dd63d2e0ed16eb08cf97dbf8c293e24a5a1bda9..6aa29495802b7d52c4c0f283495c7d17 return true; } -diff --git a/src/main/java/net/minecraft/server/EntityTNTPrimed.java b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -index f71e82c365947de822be7b87083b46bd7ce4b902..6e77dc89f5441f0f483571fee9aa9f34b6d1dd1c 100644 ---- a/src/main/java/net/minecraft/server/EntityTNTPrimed.java -+++ b/src/main/java/net/minecraft/server/EntityTNTPrimed.java -@@ -81,7 +81,27 @@ public class EntityTNTPrimed extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java +index 535e7d7297d81026b8586d5049b72fa65519b464..ca954912c798a7f4f7c9903a53156075ab688e46 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityTNTPrimed.java +@@ -96,7 +96,27 @@ public class EntityTNTPrimed extends Entity { this.world.addParticle(Particles.SMOKE, this.locX(), this.locY() + 0.5D, this.locZ(), 0.0D, 0.0D, 0.0D); } } @@ -80,7 +93,7 @@ index f71e82c365947de822be7b87083b46bd7ce4b902..6e77dc89f5441f0f483571fee9aa9f34 } private void explode() { -@@ -150,4 +170,11 @@ public class EntityTNTPrimed extends Entity { +@@ -165,4 +185,11 @@ public class EntityTNTPrimed extends Entity { public Packet P() { return new PacketPlayOutSpawnEntity(this); } @@ -92,16 +105,3 @@ index f71e82c365947de822be7b87083b46bd7ce4b902..6e77dc89f5441f0f483571fee9aa9f34 + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index dec48226d713ef0198ef3c679daf553a9d05a099..c346ca8ba30da401ea1a421e8ce6ed1d5b6e4c13 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -38,7 +38,7 @@ public class EntityTrackerEntry { - private boolean q; - private boolean r; - // CraftBukkit start -- private final Set trackedPlayers; -+ final Set trackedPlayers; // Paper - private -> package - // Paper start - private java.util.Map trackedPlayerMap = null; - diff --git a/Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch b/Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch index 5f47af71fd..5a8eae2799 100644 --- a/Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch +++ b/Spigot-Server-Patches/0102-Faster-redstone-torch-rapid-clock-removal.patch @@ -5,11 +5,23 @@ 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 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 +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 2bb85896df999675d33f70a90f1c68865099ee83..b954b2f3c6e2d6725f9a134699f0d218f8ce1d05 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -142,6 +142,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 ++ public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here + + public CraftWorld getWorld() { + return this.world; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java b/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java +index 8142c0be2978d8975612488b17da9c2e25f3b5dd..6771c16b4228c1495950484422b73928f6184929 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockRedstoneTorch.java +@@ -22,7 +22,7 @@ import org.bukkit.event.block.BlockRedstoneEvent; // CraftBukkit public class BlockRedstoneTorch extends BlockTorch { public static final BlockStateBoolean LIT = BlockProperties.r; @@ -18,7 +30,7 @@ index d88d435b7777f731bc0bb728ebe4d4cb31c6376e..a63a60348fe45f63deec6fcb27b6be09 protected BlockRedstoneTorch(BlockBase.Info blockbase_info) { super(blockbase_info, ParticleParamRedstone.a); -@@ -58,11 +58,15 @@ public class BlockRedstoneTorch extends BlockTorch { +@@ -69,11 +69,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); @@ -38,7 +50,7 @@ index d88d435b7777f731bc0bb728ebe4d4cb31c6376e..a63a60348fe45f63deec6fcb27b6be09 // CraftBukkit start org.bukkit.plugin.PluginManager manager = worldserver.getServer().getPluginManager(); -@@ -127,9 +131,12 @@ public class BlockRedstoneTorch extends BlockTorch { +@@ -138,9 +142,12 @@ public class BlockRedstoneTorch extends BlockTorch { } private static boolean a(World world, BlockPosition blockposition, boolean flag) { @@ -54,7 +66,7 @@ index d88d435b7777f731bc0bb728ebe4d4cb31c6376e..a63a60348fe45f63deec6fcb27b6be09 if (flag) { list.add(new BlockRedstoneTorch.RedstoneUpdateInfo(blockposition.immutableCopy(), world.getTime())); -@@ -137,9 +144,9 @@ public class BlockRedstoneTorch extends BlockTorch { +@@ -148,9 +155,9 @@ public class BlockRedstoneTorch extends BlockTorch { int i = 0; @@ -67,7 +79,7 @@ index d88d435b7777f731bc0bb728ebe4d4cb31c6376e..a63a60348fe45f63deec6fcb27b6be09 if (blockredstonetorch_redstoneupdateinfo.a.equals(blockposition)) { ++i; if (i >= 8) { -@@ -154,7 +161,7 @@ public class BlockRedstoneTorch extends BlockTorch { +@@ -165,7 +172,7 @@ public class BlockRedstoneTorch extends BlockTorch { public static class RedstoneUpdateInfo { private final BlockPosition a; @@ -76,15 +88,3 @@ index d88d435b7777f731bc0bb728ebe4d4cb31c6376e..a63a60348fe45f63deec6fcb27b6be09 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 05bd9dd542ddb2508cb0c7138833371b52f1164e..dbc7cbba7134ff0281c6e77cd246073bba8b9ce2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -90,6 +90,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - private org.spigotmc.TickLimiter tileLimiter; - private int tileTickPosition; - public final Map explosionDensityCache = new HashMap<>(); // Paper - Optimize explosions -+ public java.util.ArrayDeque redstoneUpdateInfos; // Paper - Move from Map in BlockRedstoneTorch to here - - public CraftWorld getWorld() { - return this.world; diff --git a/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch b/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch index dae394549d..0b6b3e6fdb 100644 --- a/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch +++ b/Spigot-Server-Patches/0104-Only-send-Dragon-Wither-Death-sounds-to-same-world.patch @@ -5,27 +5,27 @@ 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 48f3695861ad7f9c480d3bdf68c6820c2ca0a00a..81c926e506c1b6e5c0d909b71f1db81beb645699 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -570,8 +570,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +index 6c58cf9d39cc0f0eb0dc7ddb126b8a3cf6a08fe7..74802de01dba30e38e09f6fc1f61e7bb64cf5f09 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -619,8 +619,9 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (this.deathAnimationTicks == 1 && !this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1028, this.getChunkCoordinates(), 0); - int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; -- for (EntityPlayer player : (List) MinecraftServer.getServer().getPlayerList().players) { +- for (net.minecraft.server.level.EntityPlayer player : this.world.getMinecraftServer().getPlayerList().players) { + //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API -+ for (EntityPlayer player : (List) ((WorldServer)world).getPlayers()) { ++ for (net.minecraft.server.level.EntityPlayer player : (List) ((WorldServer)world).getPlayers()) { + final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index b9501a2f5f60b70eb7f0b4ac8ef6c883585adaa5..ad5a7cbe83fb61b79203369895e82edca2ffcb72 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -208,8 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +index f74949c855aea32ceb16d8cb07f266d50045b57e..145767e8b0fc4105a0afa47af17dcdbb75e952bc 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +@@ -258,8 +258,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); diff --git a/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch b/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch index 15d32648e9..0f4e3cf1fd 100644 --- a/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch +++ b/Spigot-Server-Patches/0105-Fix-Double-World-Add-issues.patch @@ -7,11 +7,11 @@ 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 a4d666480f0211d39e62b82e43100e3d436f4d90..b27ebc0726ecd13062f5cbf49edca2e5cfa4a4c3 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -927,6 +927,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 62430c61047f288ce6df6f77302c3bfb2817b299..fd7767d420fe58b1bbd4d8f20d7a7bd8048afe31 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1036,6 +1036,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/0106-Fix-Old-Sign-Conversion.patch b/Spigot-Server-Patches/0106-Fix-Old-Sign-Conversion.patch index b5da7e9dca..9a59345028 100644 --- a/Spigot-Server-Patches/0106-Fix-Old-Sign-Conversion.patch +++ b/Spigot-Server-Patches/0106-Fix-Old-Sign-Conversion.patch @@ -8,27 +8,11 @@ Subject: [PATCH] Fix Old Sign Conversion 2) New Mojang Schematic system has Tile Entities in the new converted format, but missing the Bukkit.isConverted flag 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 58e9c99b44fd8e77e62c4098d9872d5378d4f5e5..8974d7944f159b9346680c639daf0f8c06767cfe 100644 ---- a/src/main/java/net/minecraft/server/DefinedStructure.java -+++ b/src/main/java/net/minecraft/server/DefinedStructure.java -@@ -242,9 +242,11 @@ public class DefinedStructure { - definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong()); - } - -+ tileentity.isLoadingStructure = true; // Paper - tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c); - tileentity.a(definedstructureinfo.c()); - tileentity.a(definedstructureinfo.d()); -+ tileentity.isLoadingStructure = false; // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 5414858ba241c13d4e568191d11111d3d3ec3fc4..524f84ad2c50f8b837eefd0465901b1e22359410 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -23,6 +23,7 @@ public abstract class TileEntity implements KeyedObject { // Paper +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index b1c220df7e00af79b548895cc9333ba85d5a447f..2e1ce36fedac351f4320c6379ce73f8ffb0f5918 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -33,6 +33,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public CraftPersistentDataContainer persistentDataContainer; // CraftBukkit end private static final Logger LOGGER = LogManager.getLogger(); @@ -36,11 +20,11 @@ index 5414858ba241c13d4e568191d11111d3d3ec3fc4..524f84ad2c50f8b837eefd0465901b1e private final TileEntityTypes tileType; public TileEntityTypes getTileEntityType() { return tileType; } // Paper - OBFHELPER @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 810603bc03950580aa4d81233a9dd1c2f51d8a0b..5d0c5d856a66ce6c0594b618e8f6e892585ce665 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -58,13 +58,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java +index 29db550d91cf9e5a23052772df6e482a5e2b0b90..ec550aaa4e7943af4ecdd2275f1f32c21edf770a 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java +@@ -78,13 +78,14 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } try { @@ -57,3 +41,19 @@ index 810603bc03950580aa4d81233a9dd1c2f51d8a0b..5d0c5d856a66ce6c0594b618e8f6e892 if (this.world instanceof WorldServer) { try { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java +index a2bc771df054923a9a96c0024a426ef707624359..9b82ff37faaafc3a799413f6949fb88a993aa9a0 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/structure/templatesystem/DefinedStructure.java +@@ -278,9 +278,11 @@ public class DefinedStructure { + definedstructure_blockinfo.c.setLong("LootTableSeed", random.nextLong()); + } + ++ tileentity.isLoadingStructure = true; // Paper + tileentity.load(definedstructure_blockinfo.b, definedstructure_blockinfo.c); + tileentity.a(definedstructureinfo.c()); + tileentity.a(definedstructureinfo.d()); ++ tileentity.isLoadingStructure = false; // Paper + } + } + diff --git a/Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch b/Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch index 5fd7562a00..60a844c334 100644 --- a/Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch +++ b/Spigot-Server-Patches/0107-Don-t-lookup-game-profiles-that-have-no-UUID-and-no-.patch @@ -4,11 +4,11 @@ Date: Sat, 16 Jul 2016 19:11:17 -0500 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 f61cf940f21288fc6e8faf9519d2366436146d1f..e89c92aded564fe689cc1aa8d0c83abb72f7b10c 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -89,7 +89,7 @@ public class UserCache { +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java +index 9bb949ff4cbfc87ce179653939454a1e44dcdd77..85ca2a3b19d27a0dbe1c8dee6bd5b31ae11bbce2 100644 +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java +@@ -90,7 +90,7 @@ public class UserCache { gameprofilerepository.findProfilesByNames(new String[]{s}, Agent.MINECRAFT, profilelookupcallback); GameProfile gameprofile = (GameProfile) atomicreference.get(); diff --git a/Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch b/Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch index 4049dde553..98ac7a6958 100644 --- a/Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch +++ b/Spigot-Server-Patches/0108-Add-setting-for-proxy-online-mode-status.patch @@ -30,11 +30,11 @@ index 1b8e5671c9dc8c15ce33d351c1bb20f28919b9a2..c52dc0346f93527965ef29a0ccdc4bf3 + return Bukkit.getOnlineMode() || (SpigotConfig.bungee && bungeeOnlineMode); + } } -diff --git a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -index 060887d765604e4be82913607bb6266a278f5db6..c5957c2d6c54b076ebe7f9a432e30551d2b6febc 100644 ---- a/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -+++ b/src/main/java/net/minecraft/server/NameReferencingFileConverter.java -@@ -56,7 +56,8 @@ public class NameReferencingFileConverter { +diff --git a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java +index 8a343a857dc4661ba256e39cf391dd2c7a1cc970..8c1f328ca1ba12ed63ec7bd7efad54ff633ba802 100644 +--- a/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java ++++ b/src/main/java/net/minecraft/server/players/NameReferencingFileConverter.java +@@ -66,7 +66,8 @@ public class NameReferencingFileConverter { return new String[i]; }); @@ -45,7 +45,7 @@ index 060887d765604e4be82913607bb6266a278f5db6..c5957c2d6c54b076ebe7f9a432e30551 } 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 8e25929a7d1294a7cd764cd29e43977c9b2ca826..719e8117f06a14147587626eb03e1778408f2ce3 100644 +index 96abe76ab9d71561740499b4dfcfa94ded1c1b53..f1572f708911d61ae6dc0077475fee8d815e28db 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1507,7 +1507,8 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch b/Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch index 85e7758797..909f6b5273 100644 --- a/Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch +++ b/Spigot-Server-Patches/0109-Optimise-BlockState-s-hashCode-equals.patch @@ -8,10 +8,10 @@ object identity checks safely. Use a simpler optimized hashcode -diff --git a/src/main/java/net/minecraft/server/BlockStateBoolean.java b/src/main/java/net/minecraft/server/BlockStateBoolean.java -index 8df150f4cabb3dd98cb66c9d1af7fae035a6a6fe..4ca8db630434915de4eaeac6c4ecd60714d7f5d9 100644 ---- a/src/main/java/net/minecraft/server/BlockStateBoolean.java -+++ b/src/main/java/net/minecraft/server/BlockStateBoolean.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java +index 0701c1a178852345b6bf01bce8b1d0559c535d45..f2f94950681b198ae7a4c31a044fd62e98e448ab 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateBoolean.java @@ -30,8 +30,7 @@ public class BlockStateBoolean extends IBlockState { return obool.toString(); } @@ -22,11 +22,11 @@ index 8df150f4cabb3dd98cb66c9d1af7fae035a6a6fe..4ca8db630434915de4eaeac6c4ecd607 if (this == object) { return true; } else if (object instanceof BlockStateBoolean && super.equals(object)) { -diff --git a/src/main/java/net/minecraft/server/BlockStateEnum.java b/src/main/java/net/minecraft/server/BlockStateEnum.java -index 8162c11d14b8e88c2b572f9ddf6b7a15977047f8..8dc620b22bb904aa6a82e2127aa9da861986525c 100644 ---- a/src/main/java/net/minecraft/server/BlockStateEnum.java -+++ b/src/main/java/net/minecraft/server/BlockStateEnum.java -@@ -49,8 +49,7 @@ public class BlockStateEnum & INamable> extends IBlockState +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java +index de85894beae7ee7d276cf2af3daa77377ce131c3..3079cd13ea1465f4221fde4fec7df639f7c1eb49 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateEnum.java +@@ -50,8 +50,7 @@ public class BlockStateEnum & INamable> extends IBlockState return ((INamable) t0).getName(); } @@ -36,10 +36,10 @@ index 8162c11d14b8e88c2b572f9ddf6b7a15977047f8..8dc620b22bb904aa6a82e2127aa9da86 if (this == object) { return true; } else if (object instanceof BlockStateEnum && super.equals(object)) { -diff --git a/src/main/java/net/minecraft/server/BlockStateInteger.java b/src/main/java/net/minecraft/server/BlockStateInteger.java -index 5bd7a236b948666ca31e53cb3a8aa0dc147e274b..36b84446e96faefad3b783f73df74e0f3bce8255 100644 ---- a/src/main/java/net/minecraft/server/BlockStateInteger.java -+++ b/src/main/java/net/minecraft/server/BlockStateInteger.java +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java +index 518c2ebe4cdfe4704bbec2abe81522cbca38da55..190978c889222185b47065e9e5f96a82e59c7b4e 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/BlockStateInteger.java @@ -38,8 +38,7 @@ public class BlockStateInteger extends IBlockState { return this.a; } @@ -50,11 +50,11 @@ index 5bd7a236b948666ca31e53cb3a8aa0dc147e274b..36b84446e96faefad3b783f73df74e0f if (this == object) { return true; } else if (object instanceof BlockStateInteger && super.equals(object)) { -diff --git a/src/main/java/net/minecraft/server/IBlockState.java b/src/main/java/net/minecraft/server/IBlockState.java -index d63a4e4916ed5f5d901be0f4dd2c13cf66239055..6550b55067db31dbbc903fe17a13849383651c5a 100644 ---- a/src/main/java/net/minecraft/server/IBlockState.java -+++ b/src/main/java/net/minecraft/server/IBlockState.java -@@ -59,23 +59,17 @@ public abstract class IBlockState> { +diff --git a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java +index e3969bad5be64bb41e2973751605d6820c16f021..759d6a4adaa511488ace5e2650eb685cbb6c4c16 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java ++++ b/src/main/java/net/minecraft/world/level/block/state/properties/IBlockState.java +@@ -60,23 +60,17 @@ public abstract class IBlockState> { } public boolean equals(Object object) { diff --git a/Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch b/Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch index 7b1910a4c2..d7cd980ce7 100644 --- a/Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch +++ b/Spigot-Server-Patches/0110-Configurable-packet-in-spam-threshold.patch @@ -22,11 +22,11 @@ index c52dc0346f93527965ef29a0ccdc4bf3debe302e..64d7c9058ee757a6d3cf3b648596092a + packetInSpamThreshold = getInt("settings.incoming-packet-spam-threshold", 300); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 283ff4a255f310ab0a8900531c397a1ad4b99018..9af1176497735f465fb06ff326d1c32125f7407f 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1317,13 +1317,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 7aec9a349ea941153863d95eb8df4f8c884b5617..d809984d4a0032a2e27d01524c662a09da9d5eab 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1462,13 +1462,14 @@ public class PlayerConnection implements PacketListenerPlayIn { // Spigot start - limit place/interactions private int limitedPackets; private long lastLimitedPacket = -1; diff --git a/Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch b/Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch index 94cc8bb81e..90b523420c 100644 --- a/Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch +++ b/Spigot-Server-Patches/0111-Configurable-flying-kick-messages.patch @@ -20,11 +20,11 @@ index 64d7c9058ee757a6d3cf3b648596092a810e105c..4e2f243faa209925dcb7c3ef89df3ed8 + flyingKickVehicleMessage = getString("messages.kick.flying-vehicle", flyingKickVehicleMessage); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 9af1176497735f465fb06ff326d1c32125f7407f..697edff8d2a1435c8831dadfd5c2fa60753d6d18 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -160,7 +160,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index d809984d4a0032a2e27d01524c662a09da9d5eab..010d4d33a2044bd54bf0bab055708711865b8d12 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -305,7 +305,7 @@ public class PlayerConnection implements PacketListenerPlayIn { if (this.B && !this.player.isSleeping()) { if (++this.C > 80) { PlayerConnection.LOGGER.warn("{} was kicked for floating too long!", this.player.getDisplayName().getString()); @@ -33,7 +33,7 @@ index 9af1176497735f465fb06ff326d1c32125f7407f..697edff8d2a1435c8831dadfd5c2fa60 return; } } else { -@@ -179,7 +179,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -324,7 +324,7 @@ public class PlayerConnection implements PacketListenerPlayIn { if (this.D && this.player.getRootVehicle().getRidingPassenger() == this.player) { if (++this.E > 80) { PlayerConnection.LOGGER.warn("{} was kicked for floating a vehicle too long!", this.player.getDisplayName().getString()); diff --git a/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch b/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch index e37bab7be0..b154250016 100644 --- a/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch +++ b/Spigot-Server-Patches/0112-Chunk-registration-fixes.patch @@ -7,11 +7,11 @@ World checks and the Chunk Add logic are inconsistent on how Y > 256, < 0, is tr Keep them consistent -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index b27ebc0726ecd13062f5cbf49edca2e5cfa4a4c3..e23a5f446a1e357493f5232c39baa45f7386a637 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -736,7 +736,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index fd7767d420fe58b1bbd4d8f20d7a7bd8048afe31..1e9884e819ac2afe58b5f50b89355c2d58ed73d5 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -845,7 +845,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity.cl()) { this.getMethodProfiler().enter("chunkCheck"); int i = MathHelper.floor(entity.locX() / 16.0D); diff --git a/Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch b/Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch index 7de83e2dd8..0b98451186 100644 --- a/Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch +++ b/Spigot-Server-Patches/0114-Auto-fix-bad-Y-levels-on-player-login.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Auto fix bad Y levels on player login Bring down to a saner Y level if super high, as this can cause the server to crash -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 89b1561bfce8b0a0b34e3f2ce706e3149fb5949d..a0bc829ed49661bc381f535d1e462bf8e0dc6ae1 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -212,6 +212,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 3d5d1b83094b5ca45fae47055db397630fdd4f04..82085f30e4eefa1867536a8c591210380ebad725 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -339,6 +339,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public void loadData(NBTTagCompound nbttagcompound) { super.loadData(nbttagcompound); diff --git a/Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch b/Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch index ecea71ce5e..b11c89044d 100644 --- a/Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch +++ b/Spigot-Server-Patches/0115-Option-to-remove-corrupt-tile-entities.patch @@ -18,11 +18,11 @@ index 6eca3f300020006f02dd36253b522db442e3cc33..622affa0dc3cc1eadaed400511f2ca2c + removeCorruptTEs = getBoolean("remove-corrupt-tile-entities", false); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 83858165764a7459843433de1a077037692a2a97..380690cdb1052b12d0574c111c2162bd7ed8ecca 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -643,6 +643,12 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index c24315a329b3076a022fdf2aa7459e7117323e20..86872f4e65d7e0ca68237a42fe87f33ba7a92802 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -677,6 +677,12 @@ public class Chunk implements IChunkAccess { "Chunk coordinates: " + (this.loc.x * 16) + "," + (this.loc.z * 16)); e.printStackTrace(); ServerInternalException.reportInternalException(e); diff --git a/Spigot-Server-Patches/0116-Add-EntityZapEvent.patch b/Spigot-Server-Patches/0116-Add-EntityZapEvent.patch index 4385d89002..d1caa67051 100644 --- a/Spigot-Server-Patches/0116-Add-EntityZapEvent.patch +++ b/Spigot-Server-Patches/0116-Add-EntityZapEvent.patch @@ -4,11 +4,11 @@ Date: Sun, 16 Oct 2016 23:19:30 -0700 Subject: [PATCH] Add EntityZapEvent -diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java -index 5bdde99d7143ee1bac5830b042bba5485a95f120..ee94c2827cfc53f7a37e61d8c1c0c30a52374cf8 100644 ---- a/src/main/java/net/minecraft/server/EntityPig.java -+++ b/src/main/java/net/minecraft/server/EntityPig.java -@@ -208,6 +208,11 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java +index cc31c8f31a385f3a8bfe334e75c3553689397750..d6e1697f64e60f2a567288c604a1690159955f37 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java +@@ -255,6 +255,11 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { } entitypigzombie.setPersistent(); @@ -20,11 +20,11 @@ index 5bdde99d7143ee1bac5830b042bba5485a95f120..ee94c2827cfc53f7a37e61d8c1c0c30a // CraftBukkit start if (CraftEventFactory.callPigZapEvent(this, entitylightning, entitypigzombie).isCancelled()) { return; -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index d9f9694cb2677102269294043822fb3773de9b35..8b5901396a7f1dc554a5e237200a8193e9096a18 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -717,6 +717,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 39071f82ae539c98499e9db37483ccecafc5f186..3604fffb9ba13a019e98e0a1a0ef7ba81c8dc329 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -787,6 +787,12 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation EntityVillager.LOGGER.info("Villager {} was struck by lightning {}.", this, entitylightning); EntityWitch entitywitch = (EntityWitch) EntityTypes.WITCH.a((World) worldserver); @@ -38,7 +38,7 @@ index d9f9694cb2677102269294043822fb3773de9b35..8b5901396a7f1dc554a5e237200a8193 entitywitch.prepare(worldserver, worldserver.getDamageScaler(entitywitch.getChunkCoordinates()), EnumMobSpawn.CONVERSION, (GroupDataEntity) null, (NBTTagCompound) null); entitywitch.setNoAI(this.isNoAI()); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index b4302fe96d4b2ad6db47fc9d350495cc20a26478..37d9087f90a203753fcd256f70d0768c1249b9e6 100644 +index 788617eaeab9985c426f80e9f4cdbb912383c049..ef161ccf0f1c51ce9f477869e6dc2d027d47874e 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1077,6 +1077,14 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch b/Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch index db20fa03f2..4ed73d0d74 100644 --- a/Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch +++ b/Spigot-Server-Patches/0117-Filter-bad-data-from-ArmorStand-and-SpawnEgg-items.patch @@ -29,11 +29,11 @@ index 622affa0dc3cc1eadaed400511f2ca2cde3fca2a..e83216be5a00d5b927d8c2fc364551bd + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index bdeabfaeb17778a12ab4ad72689a72b043efcff4..0fbcf454c2db2427055123424c6d10cfbb939c17 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -233,6 +233,13 @@ public class EntityFallingBlock extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +index 3f10e41b18e09186635fd6f7c653b04db7b39d8e..411e3915c0aa00249aacb6658ed04309665d2fb4 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +@@ -272,6 +272,13 @@ public class EntityFallingBlock extends Entity { @Override protected void loadData(NBTTagCompound nbttagcompound) { this.block = GameProfileSerializer.c(nbttagcompound.getCompound("BlockState")); diff --git a/Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch b/Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch index c81a748290..ea31e6730d 100644 --- a/Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch +++ b/Spigot-Server-Patches/0118-Cache-user-authenticator-threads.patch @@ -4,10 +4,10 @@ Date: Wed, 23 Nov 2016 08:31:45 -0500 Subject: [PATCH] Cache user authenticator threads -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index a0bc829ed49661bc381f535d1e462bf8e0dc6ae1..f8c9515f3ee922b6b96d97676ca740bba617721a 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 82085f30e4eefa1867536a8c591210380ebad725..fa315f10219dc340da4f51a8d4a78e1f33023bb3 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -4,7 +4,9 @@ import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; @@ -18,7 +18,7 @@ index a0bc829ed49661bc381f535d1e462bf8e0dc6ae1..f8c9515f3ee922b6b96d97676ca740bb import java.util.Iterator; import java.util.List; import java.util.Optional; -@@ -44,7 +46,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -171,7 +173,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public PlayerConnection playerConnection; public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; @@ -27,7 +27,7 @@ index a0bc829ed49661bc381f535d1e462bf8e0dc6ae1..f8c9515f3ee922b6b96d97676ca740bb private final AdvancementDataPlayer advancementDataPlayer; private final ServerStatisticManager serverStatisticManager; private float lastHealthScored = Float.MIN_VALUE; -@@ -422,13 +424,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -549,13 +551,20 @@ public class EntityPlayer extends EntityHuman implements ICrafting { while (!this.removeQueue.isEmpty()) { int i = Math.min(this.removeQueue.size(), Integer.MAX_VALUE); int[] aint = new int[i]; @@ -50,7 +50,7 @@ index a0bc829ed49661bc381f535d1e462bf8e0dc6ae1..f8c9515f3ee922b6b96d97676ca740bb this.playerConnection.sendPacket(new PacketPlayOutEntityDestroy(aint)); } -@@ -1425,7 +1434,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1552,7 +1561,14 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.lastHealthSent = -1.0F; this.lastFoodSent = -1; // this.recipeBook.a((RecipeBook) entityplayer.recipeBook); // CraftBukkit diff --git a/Spigot-Server-Patches/0119-Optimise-removeQueue.patch b/Spigot-Server-Patches/0119-Optimise-removeQueue.patch index bc4c358c1e..06625681a7 100644 --- a/Spigot-Server-Patches/0119-Optimise-removeQueue.patch +++ b/Spigot-Server-Patches/0119-Optimise-removeQueue.patch @@ -4,11 +4,11 @@ Date: Fri, 25 Nov 2016 13:22:40 +0000 Subject: [PATCH] Optimise removeQueue -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index b6544feaffacd511191054386614d3e921b26d6c..643c66a8a81ce7131cfd6d9f956d1a9cc85fc56b 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -98,6 +98,12 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index c4e3dd34c20c97ae1397cf51125f51a5b77d9437..9f87503c58f64bbfa829faa58600d7d9e64aecf1 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -116,6 +116,12 @@ public class LoginListener implements PacketLoginInListener { } @@ -21,7 +21,7 @@ index b6544feaffacd511191054386614d3e921b26d6c..643c66a8a81ce7131cfd6d9f956d1a9c // Spigot start public void initUUID() { -@@ -176,8 +182,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -194,8 +200,8 @@ public class LoginListener implements PacketLoginInListener { this.networkManager.sendPacket(new PacketLoginOutEncryptionBegin("", this.server.getKeyPair().getPublic().getEncoded(), this.e)); } else { // Spigot start @@ -32,7 +32,7 @@ index b6544feaffacd511191054386614d3e921b26d6c..643c66a8a81ce7131cfd6d9f956d1a9c @Override public void run() { try { -@@ -188,7 +194,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -206,7 +212,8 @@ public class LoginListener implements PacketLoginInListener { server.server.getLogger().log(java.util.logging.Level.WARNING, "Exception verifying " + i.getName(), ex); } } @@ -42,7 +42,7 @@ index b6544feaffacd511191054386614d3e921b26d6c..643c66a8a81ce7131cfd6d9f956d1a9c // Spigot end } -@@ -217,7 +224,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -235,7 +242,8 @@ public class LoginListener implements PacketLoginInListener { throw new IllegalStateException("Protocol error", cryptographyexception); } @@ -52,7 +52,7 @@ index b6544feaffacd511191054386614d3e921b26d6c..643c66a8a81ce7131cfd6d9f956d1a9c public void run() { GameProfile gameprofile = LoginListener.this.i; -@@ -262,10 +270,8 @@ public class LoginListener implements PacketLoginInListener { +@@ -280,10 +288,8 @@ public class LoginListener implements PacketLoginInListener { return LoginListener.this.server.W() && socketaddress instanceof InetSocketAddress ? ((InetSocketAddress) socketaddress).getAddress() : null; } diff --git a/Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch b/Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch index 6f9f691cfe..f9914b08c1 100644 --- a/Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch +++ b/Spigot-Server-Patches/0121-Add-source-to-PlayerExpChangeEvent.patch @@ -4,11 +4,11 @@ Date: Thu, 8 Sep 2016 08:48:33 -0700 Subject: [PATCH] Add source to PlayerExpChangeEvent -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 41f54158fe3312188d2a938ca882ece68cf3c08e..cc65c57637e07b82f5efcfa9f73f0e7abe9be6f5 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -189,7 +189,7 @@ public class EntityExperienceOrb extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +index a52cd6d0318e0fee28fc5d252a4b596b92860320..a17812943b5402684c68ddeac5408dc939e42cf6 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +@@ -203,7 +203,7 @@ public class EntityExperienceOrb extends Entity { } if (this.value > 0) { @@ -18,7 +18,7 @@ index 41f54158fe3312188d2a938ca882ece68cf3c08e..cc65c57637e07b82f5efcfa9f73f0e7a this.die(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 37d9087f90a203753fcd256f70d0768c1249b9e6..a3b46a3bfe1169c23a9192763da43c4001804782 100644 +index ef161ccf0f1c51ce9f477869e6dc2d027d47874e..52028387ae90b9e125b4522e5a3963a1119499e4 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -117,6 +117,7 @@ import org.bukkit.entity.ThrownPotion; diff --git a/Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch b/Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch index 31b3e44011..304934ac47 100644 --- a/Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch +++ b/Spigot-Server-Patches/0122-Don-t-let-fishinghooks-use-portals.patch @@ -4,11 +4,11 @@ Date: Fri, 16 Dec 2016 16:03:19 -0600 Subject: [PATCH] Don't let fishinghooks use portals -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index b9243b0a2d429828f2a2b68c221129e23c6212ca..65b9eebcd59d1d95a77780f41862d8c984dee03c 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -202,6 +202,11 @@ public class EntityFishingHook extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +index bcc411107d531529dbce9d1d43896a3c70e63012..57e7b9c7f7f43666d442648120cda3b4b3e5bfb2 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +@@ -240,6 +240,11 @@ public class EntityFishingHook extends IProjectile { this.setMot(this.getMot().a(0.92D)); this.af(); diff --git a/Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch b/Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch index 7e91b5c831..0febf2e4f0 100644 --- a/Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch +++ b/Spigot-Server-Patches/0123-Add-ProjectileCollideEvent.patch @@ -4,11 +4,11 @@ Date: Fri, 16 Dec 2016 21:25:39 -0600 Subject: [PATCH] Add ProjectileCollideEvent -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 2a86d4b8af5e436e82e003f50c1929702af700c4..93084633d487684fb598038d148670fe6a00b3ed 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -160,6 +160,17 @@ public abstract class EntityArrow extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +index 9bd4a283a99f86c9a26f73e0bad0c3414d66ad55..5ecbe9135a71dd84e0722fa9c039c272a11d206f 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +@@ -198,6 +198,17 @@ public abstract class EntityArrow extends IProjectile { } } @@ -26,11 +26,11 @@ index 2a86d4b8af5e436e82e003f50c1929702af700c4..93084633d487684fb598038d148670fe if (object != null && !flag) { this.a((MovingObjectPosition) object); this.impulse = true; -diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java -index 1ee09cb383d762219bda89463f4b6af807799385..74ca38f8e4e1addc243c3f3b57021d26f0ce3c97 100644 ---- a/src/main/java/net/minecraft/server/EntityFireball.java -+++ b/src/main/java/net/minecraft/server/EntityFireball.java -@@ -57,7 +57,16 @@ public abstract class EntityFireball extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java +index ed76aec99f46a7923d139e347779c24f512ac131..08b3499681eaf23a2f79f6dd9134ccfd86d888a4 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java +@@ -72,7 +72,16 @@ public abstract class EntityFireball extends IProjectile { MovingObjectPosition movingobjectposition = ProjectileHelper.a((Entity) this, this::a); @@ -48,11 +48,11 @@ index 1ee09cb383d762219bda89463f4b6af807799385..74ca38f8e4e1addc243c3f3b57021d26 this.a(movingobjectposition); // CraftBukkit start - Fire ProjectileHitEvent -diff --git a/src/main/java/net/minecraft/server/EntityProjectile.java b/src/main/java/net/minecraft/server/EntityProjectile.java -index 7391fd31148dbde60e34955841a296f454ac768e..53a8ea7d1eff84abe6c49464d556aa2788a6abcb 100644 ---- a/src/main/java/net/minecraft/server/EntityProjectile.java -+++ b/src/main/java/net/minecraft/server/EntityProjectile.java -@@ -41,7 +41,17 @@ public abstract class EntityProjectile extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java +index 829b4f28896bcb0eb6e48242bd00585eeaae62c2..7bf41d2c924531f7a28e906c64b8a4ccd3dffedb 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityProjectile.java +@@ -57,7 +57,17 @@ public abstract class EntityProjectile extends IProjectile { } if (movingobjectposition.getType() != MovingObjectPosition.EnumMovingObjectType.MISS && !flag) { @@ -71,7 +71,7 @@ index 7391fd31148dbde60e34955841a296f454ac768e..53a8ea7d1eff84abe6c49464d556aa27 this.checkBlockCollisions(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a3b46a3bfe1169c23a9192763da43c4001804782..c246407f2912f6d5b5947814471155469688baad 100644 +index 52028387ae90b9e125b4522e5a3963a1119499e4..2dcdc428028a40c06b0ec1e50af76c16f051f084 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1181,6 +1181,16 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch b/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch index c423dc71f1..ed8efad698 100644 --- a/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch +++ b/Spigot-Server-Patches/0124-Prevent-Pathfinding-out-of-World-Border.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent Pathfinding out of World Border This prevents Entities from trying to run outside of the World Border -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 5a8fbad220ed535a79539a4e25830c370ca1c89c..ee7b1f25ba8b6b4318e332b739359db6ddd58b62 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -127,7 +127,7 @@ public abstract class NavigationAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +index c50d792c3ef3277ecab229e866f052854edac19d..1664d47a61f1c502ece7f32aecdce759172c9f85 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +@@ -147,7 +147,7 @@ public abstract class NavigationAbstract { // Paper start - Pathfind event boolean copiedSet = false; for (BlockPosition possibleTarget : set) { diff --git a/Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch b/Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch index 0b8a494c67..66b1b18d72 100644 --- a/Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch +++ b/Spigot-Server-Patches/0125-Optimize-World.isLoaded-BlockPosition-Z.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize World.isLoaded(BlockPosition)Z Reduce method invocations for World.isLoaded(BlockPosition)Z -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index dbc7cbba7134ff0281c6e77cd246073bba8b9ce2..f773c19d69ebcb75cf97b07fd015baf3d6e6cae8 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -252,6 +252,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index b954b2f3c6e2d6725f9a134699f0d218f8ce1d05..edc760be0a3e58d2a917b70337b24b67ec5c5c1e 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -304,6 +304,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return chunk == null ? null : chunk.getFluid(blockposition); } diff --git a/Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch b/Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch index 73568db208..212f2d89eb 100644 --- a/Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch +++ b/Spigot-Server-Patches/0126-Bound-Treasure-Maps-to-World-Border.patch @@ -10,23 +10,11 @@ This also would help the case where a players close to the border, and one that is outside happens to be closer, but unreachable, yet another reachable one is in border that would of been missed. -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index a8e3bbd18e08678e55aa88b09a9f7feb37ab4761..c3bd58069d8dbdf36f70f1dafd7c24000f31708b 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -142,6 +142,7 @@ public abstract class StructureGenerator - int i2 = l + k * k1; - int j2 = i1 + k * l1; - ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); -+ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper - IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); - StructureStart structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); - -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index 717f495abd63218bb7ce9241e7cfeac809ef02de..adab2bd76e7e99140218ddbdb00aa9c27c0d0183 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -26,6 +26,18 @@ public class WorldBorder { +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +index f16c76df5d7b184d57f4cc397f069eac9cc430cb..50e2085766caabec1125ca24a2117549efd1a354 100644 +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -36,6 +36,18 @@ public class WorldBorder { return (double) (blockposition.getX() + 1) > this.e() && (double) blockposition.getX() < this.g() && (double) (blockposition.getZ() + 1) > this.f() && (double) blockposition.getZ() < this.h(); } @@ -45,3 +33,15 @@ index 717f495abd63218bb7ce9241e7cfeac809ef02de..adab2bd76e7e99140218ddbdb00aa9c2 public boolean isInBounds(ChunkCoordIntPair chunkcoordintpair) { return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +index 6724927be178cb9a358a9276d01894a63154b7b3..ea7e3e15fa778c573d24f956f72f60579ea0b1a1 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +@@ -175,6 +175,7 @@ public abstract class StructureGenerator + int i2 = l + k * k1; + int j2 = i1 + k * l1; + ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); ++ if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper + IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); + StructureStart structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); + diff --git a/Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch b/Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch index 4e4e6ffc65..82ccdd75a9 100644 --- a/Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch +++ b/Spigot-Server-Patches/0127-Configurable-Cartographer-Treasure-Maps.patch @@ -27,11 +27,25 @@ index e83216be5a00d5b927d8c2fc364551bd3077c974..2dc58b9f769ea43b737804456aafab47 + } + } } -diff --git a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -index 37ebc9f511479778c131e02b6852b27f63e75bdd..d071d66fd1215e158130d592ce62165a1f3738f9 100644 ---- a/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -+++ b/src/main/java/net/minecraft/server/LootItemFunctionExplorationMap.java -@@ -48,7 +48,16 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional +diff --git a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +index 764ff5d9ffb541a356a6bc8b321e619849dde747..0a34e319998a95a9654822e55a22eb964b2d626b 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java ++++ b/src/main/java/net/minecraft/world/entity/npc/VillagerTrades.java +@@ -124,7 +124,8 @@ public class VillagerTrades { + return null; + } else { + WorldServer worldserver = (WorldServer) entity.world; +- BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true); ++ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper ++ BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper + + if (blockposition != null) { + ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true); +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +index 38125a60bad4830db9de3580ab6d85fd122a0689..7bf16c5a3f2bb5525ce1ca0c0190c7671fc94797 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/functions/LootItemFunctionExplorationMap.java +@@ -64,7 +64,16 @@ public class LootItemFunctionExplorationMap extends LootItemFunctionConditional if (vec3d != null) { WorldServer worldserver = loottableinfo.getWorld(); @@ -49,17 +63,3 @@ index 37ebc9f511479778c131e02b6852b27f63e75bdd..d071d66fd1215e158130d592ce62165a if (blockposition != null) { ItemStack itemstack1 = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), this.g, true, true); -diff --git a/src/main/java/net/minecraft/server/VillagerTrades.java b/src/main/java/net/minecraft/server/VillagerTrades.java -index 4f7944d7fdaf02bae40ee71a18bd1c9bb4eb891b..49f9ae86512ad679aaa71992de2284e024591101 100644 ---- a/src/main/java/net/minecraft/server/VillagerTrades.java -+++ b/src/main/java/net/minecraft/server/VillagerTrades.java -@@ -91,7 +91,8 @@ public class VillagerTrades { - return null; - } else { - WorldServer worldserver = (WorldServer) entity.world; -- BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, true); -+ if (!worldserver.paperConfig.enableTreasureMaps) return null; // Paper -+ BlockPosition blockposition = worldserver.a(this.b, entity.getChunkCoordinates(), 100, !worldserver.paperConfig.treasureMapsAlreadyDiscovered); // Paper - - if (blockposition != null) { - ItemStack itemstack = ItemWorldMap.createFilledMapView(worldserver, blockposition.getX(), blockposition.getZ(), (byte) 2, true, true); diff --git a/Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch b/Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch index 47de1a8811..61881f07d2 100644 --- a/Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch +++ b/Spigot-Server-Patches/0128-Optimize-ItemStack.isEmpty.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize ItemStack.isEmpty() Remove hashMap lookup every check, simplify code to remove ternary -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index eee69f9ac8936cf7ad84629aba91bf09371762f3..2b2f5a8ac100c93b4c17d808b19a8252ed175760 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -154,7 +154,7 @@ public final class ItemStack { +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index d7c5065457d910f3e5481fda046d368d5f66f67b..58045d500a6fbb7eb568f48c7d8ce7730d357577 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -208,7 +208,7 @@ public final class ItemStack { } public boolean isEmpty() { diff --git a/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch b/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch index 34bd6aff00..fc24d9fc35 100644 --- a/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch +++ b/Spigot-Server-Patches/0129-Add-API-methods-to-control-if-armour-stands-can-move.patch @@ -4,11 +4,11 @@ Date: Wed, 21 Dec 2016 11:47:25 -0600 Subject: [PATCH] Add API methods to control if armour stands can move -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index ad3c2f4b448fe8a49c1c43374cd5cf14114c9b16..4870a6f9f894b2c9d0fea83dad0808ac6448f808 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -45,6 +45,7 @@ public class EntityArmorStand extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 72e53968c5fb03301ddec7a0cf937ac2f8cf0901..f0f93b3ff0b98f916b5f63b37b0f9b5c7fa03c2e 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -79,6 +79,7 @@ public class EntityArmorStand extends EntityLiving { public Vector3f rightArmPose; public Vector3f leftLegPose; public Vector3f rightLegPose; @@ -16,7 +16,7 @@ index ad3c2f4b448fe8a49c1c43374cd5cf14114c9b16..4870a6f9f894b2c9d0fea83dad0808ac public EntityArmorStand(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -828,4 +829,13 @@ public class EntityArmorStand extends EntityLiving { +@@ -862,4 +863,13 @@ public class EntityArmorStand extends EntityLiving { private EntitySize s(boolean flag) { return flag ? EntityArmorStand.bp : (this.isBaby() ? EntityArmorStand.bq : this.getEntityType().l()); } @@ -31,7 +31,7 @@ index ad3c2f4b448fe8a49c1c43374cd5cf14114c9b16..4870a6f9f894b2c9d0fea83dad0808ac + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 8f38500965a70fb713050321f71c97510703402a..6ff7a59cc7052e900516a89db8daf0720c64a1ac 100644 +index 86c8662b3864b264e26f8c63474fdd39bd6c873c..6f922e4cbb095439fcd76ee0d0c08bc4160b8107 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -229,4 +229,15 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { diff --git a/Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch b/Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch index 17e867dc4e..9d844fea6c 100644 --- a/Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch +++ b/Spigot-Server-Patches/0130-Properly-fix-item-duplication-bug.patch @@ -5,24 +5,26 @@ Subject: [PATCH] Properly fix item duplication bug Credit to prplz for figuring out the real issue -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index a812bb96596ddebe6118b2fd79a75e5e87d622f2..7a9e237d23051b43fe0ac3720cd6a36faabc9dd2 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1933,7 +1933,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index fa315f10219dc340da4f51a8d4a78e1f33023bb3..afa87cf70ad978161853771c59f5a4906733cab3 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -2059,8 +2059,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } @Override - protected boolean isFrozen() { +- public boolean isFrozen() { - return super.isFrozen() || !getBukkitEntity().isOnline(); ++ protected boolean isFrozen() { + return super.isFrozen() || (this.playerConnection != null && this.playerConnection.isDisconnected()); // Paper } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 5b51b2b0b47a39ed1fcbb89cb240032de0b32aa8..9d4f0a309a2328aff7b036dafa0a21921e36bacd 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2661,7 +2661,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 010d4d33a2044bd54bf0bab055708711865b8d12..bc0b1d0cc9c54d53c68ee59b0a707e0335297441 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2806,7 +2806,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } public final boolean isDisconnected() { diff --git a/Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch b/Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch index 7083fcd641..20f702475a 100644 --- a/Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch +++ b/Spigot-Server-Patches/0131-String-based-Action-Bar-API.patch @@ -4,11 +4,11 @@ Date: Tue, 27 Dec 2016 15:02:42 -0500 Subject: [PATCH] String based Action Bar API -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index bdfd17362518ff2398cf9e1743a7a4f0c7a0e966..cc14e4b4609fa7013df666181c0e02a53970c123 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -52,7 +52,7 @@ public class SystemUtils { +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java +index c8bb06a31242089ad950713bd5f94abbfe12adc8..68ce7605bd63ea280b96db8230463d2afb0a6cb1 100644 +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -58,7 +58,7 @@ public class SystemUtils { private static final ExecutorService e = a("Main"); private static final ExecutorService f = n(); public static LongSupplier a = System::nanoTime; @@ -18,7 +18,7 @@ index bdfd17362518ff2398cf9e1743a7a4f0c7a0e966..cc14e4b4609fa7013df666181c0e02a5 public static Collector, ?, Map> a() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 268bbcb706501e0d321e58b7edda99ef3bc3a370..ee2334e5cd2bb141131b5fe7e585da7c1107324e 100644 +index 6d7f1dee9ae2fb0b9620d85969de86eee09020cc..c3058d6fca2fd58aea5001e4310592aa8bd20640 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -244,6 +244,24 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0132-Firework-API-s.patch b/Spigot-Server-Patches/0132-Firework-API-s.patch index bf68910e16..30ce8c3445 100644 --- a/Spigot-Server-Patches/0132-Firework-API-s.patch +++ b/Spigot-Server-Patches/0132-Firework-API-s.patch @@ -4,11 +4,23 @@ Date: Wed, 28 Dec 2016 07:18:33 +0100 Subject: [PATCH] Firework API's -diff --git a/src/main/java/net/minecraft/server/EntityFireworks.java b/src/main/java/net/minecraft/server/EntityFireworks.java -index 5306f1d4bdf18a5dbf92b222b892b4accf21f92c..9bc4d3dbd4c64a6fbf33dcf28afde59ace9171ba 100644 ---- a/src/main/java/net/minecraft/server/EntityFireworks.java -+++ b/src/main/java/net/minecraft/server/EntityFireworks.java -@@ -14,7 +14,8 @@ public class EntityFireworks extends IProjectile { +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +index 44fefe1cdc23667219ce825ba283f84cd3020e14..2e862122fd4596c26318aac3b12165970a1660f8 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -151,6 +151,7 @@ public class NBTTagCompound implements NBTBase { + return GameProfileSerializer.a(this.get(s)); + } + ++ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER + public boolean b(String s) { + NBTBase nbtbase = this.get(s); + +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java +index 2df84b56ef35a18648e74a134ac7ab97c518e481..9cc59439ae2c4e758c44b2a92b78bc328efdfa1b 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireworks.java +@@ -38,7 +38,8 @@ public class EntityFireworks extends IProjectile { public static final DataWatcherObject SHOT_AT_ANGLE = DataWatcher.a(EntityFireworks.class, DataWatcherRegistry.i); private int ticksFlown; public int expectedLifespan; @@ -18,7 +30,7 @@ index 5306f1d4bdf18a5dbf92b222b892b4accf21f92c..9bc4d3dbd4c64a6fbf33dcf28afde59a public EntityFireworks(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -261,6 +262,11 @@ public class EntityFireworks extends IProjectile { +@@ -285,6 +286,11 @@ public class EntityFireworks extends IProjectile { } nbttagcompound.setBoolean("ShotAtAngle", (Boolean) this.datawatcher.get(EntityFireworks.SHOT_AT_ANGLE)); @@ -30,7 +42,7 @@ index 5306f1d4bdf18a5dbf92b222b892b4accf21f92c..9bc4d3dbd4c64a6fbf33dcf28afde59a } @Override -@@ -277,7 +283,11 @@ public class EntityFireworks extends IProjectile { +@@ -301,7 +307,11 @@ public class EntityFireworks extends IProjectile { if (nbttagcompound.hasKey("ShotAtAngle")) { this.datawatcher.set(EntityFireworks.SHOT_AT_ANGLE, nbttagcompound.getBoolean("ShotAtAngle")); } @@ -43,11 +55,11 @@ index 5306f1d4bdf18a5dbf92b222b892b4accf21f92c..9bc4d3dbd4c64a6fbf33dcf28afde59a } @Override -diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java -index 5e1af55c429117111aa40a9408cecafc82a94512..658b5ca36d951f2f58d91613b89a328109606fd6 100644 ---- a/src/main/java/net/minecraft/server/ItemCrossbow.java -+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java -@@ -182,6 +182,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable +diff --git a/src/main/java/net/minecraft/world/item/ItemCrossbow.java b/src/main/java/net/minecraft/world/item/ItemCrossbow.java +index d52f3cb5d76bde1cf29c654dade6d8379b44c2e5..ec6c0836f02e7ac5b72fd224a3022a844dce55cb 100644 +--- a/src/main/java/net/minecraft/world/item/ItemCrossbow.java ++++ b/src/main/java/net/minecraft/world/item/ItemCrossbow.java +@@ -205,6 +205,7 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable if (flag1) { object = new EntityFireworks(world, itemstack1, entityliving, entityliving.locX(), entityliving.getHeadY() - 0.15000000596046448D, entityliving.locZ(), true); @@ -55,11 +67,11 @@ index 5e1af55c429117111aa40a9408cecafc82a94512..658b5ca36d951f2f58d91613b89a3281 } else { object = a(world, entityliving, itemstack, itemstack1); if (flag || f3 != 0.0F) { -diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index 12ae2d9b747b69533fab2487ad55626c50c1d620..6cc243025f5bdac9be39f8a88a018893a9941dba 100644 ---- a/src/main/java/net/minecraft/server/ItemFireworks.java -+++ b/src/main/java/net/minecraft/server/ItemFireworks.java -@@ -18,6 +18,7 @@ public class ItemFireworks extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java +index 9153945c2e245b9a2a098bdf58b0dcab052084ff..a2950faa48021782f10db0673d12d178443f7ccc 100644 +--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java ++++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java +@@ -27,6 +27,7 @@ public class ItemFireworks extends Item { Vec3D vec3d = itemactioncontext.getPos(); EnumDirection enumdirection = itemactioncontext.getClickedFace(); EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack); @@ -67,7 +79,7 @@ index 12ae2d9b747b69533fab2487ad55626c50c1d620..6cc243025f5bdac9be39f8a88a018893 world.addEntity(entityfireworks); itemstack.subtract(1); -@@ -32,7 +33,11 @@ public class ItemFireworks extends Item { +@@ -41,7 +42,11 @@ public class ItemFireworks extends Item { ItemStack itemstack = entityhuman.b(enumhand); if (!world.isClientSide) { @@ -80,20 +92,8 @@ index 12ae2d9b747b69533fab2487ad55626c50c1d620..6cc243025f5bdac9be39f8a88a018893 if (!entityhuman.abilities.canInstantlyBuild) { itemstack.subtract(1); } -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index c16ff6723d3fd191b990002d40dc021d7870555d..9c445902e6adc05773497bc4444203ca364e4f5c 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -145,6 +145,7 @@ public class NBTTagCompound implements NBTBase { - return GameProfileSerializer.a(this.get(s)); - } - -+ public final boolean hasUUID(String s) { return this.b(s); } // Paper - OBFHELPER - public boolean b(String s) { - NBTBase nbtbase = this.get(s); - diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java -index d984a7a78e9f8536abf7c30df9aa59dbfc7984ce..f3066e6c781bcee72c235abcef5060fb080892d5 100644 +index 33162fd419ab9a7b650ca9d4270a0c03f06f19f6..ec8c32c7be51219d95a38ffb9291509f7d09bd7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftFirework.java @@ -78,4 +78,17 @@ public class CraftFirework extends CraftProjectile implements Firework { diff --git a/Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch index 354bbdc547..ffcd613f07 100644 --- a/Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/0133-PlayerTeleportEndGatewayEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] PlayerTeleportEndGatewayEvent Allows you to access the Gateway being used in a teleport event -diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index b168fdd4df63c90eea1be4f06fb3aa36ff62deb6..91dacc5de8d695b2ea9b2f8b4547f6dbba0451ad 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java -+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -@@ -156,7 +156,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java +index 0c5d9600eadc0a550cc2d5e7b4ee665c030faa89..8f2db48201925f4a5dac5dfc19bb2b96438959e1 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java +@@ -180,7 +180,7 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick location.setPitch(player.getLocation().getPitch()); location.setYaw(player.getLocation().getYaw()); diff --git a/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch b/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch index 681e2ab095..965b04f212 100644 --- a/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch +++ b/Spigot-Server-Patches/0135-Enforce-Sync-Player-Saves.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Enforce Sync Player Saves Saving players async is extremely dangerous. This will force it to main the same way we handle async chunk loads. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 5652462008dd857f2dc36b80e3fe5d3d83867ce5..1d137602b40e467020b89aa73dd67b661d3dedb7 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -971,11 +971,13 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index aeda31ccd2829bc7ad60c6941174addc8b02c4eb..f044f735a51dcec91f6166179fb1b21eb8229cd0 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1046,11 +1046,13 @@ public abstract class PlayerList { } public void savePlayers() { diff --git a/Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch b/Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch index c4e5508f79..51aa6dfbfc 100644 --- a/Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch +++ b/Spigot-Server-Patches/0136-Don-t-allow-entities-to-ride-themselves-572.patch @@ -4,11 +4,11 @@ Date: Sun, 8 Jan 2017 04:31:36 +0000 Subject: [PATCH] Don't allow entities to ride themselves - #572 -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7abe7bcddd3c60bfb0f290e2475d28396d5319cf..bd7d9949eb9a290833958d170d1ad69990406b16 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1956,6 +1956,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index ee160558d84b24e1309262874a9d433bbe6593f3..49da1525cfc46743013bbac0528ec58501cab6eb 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2041,6 +2041,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } protected boolean addPassenger(Entity entity) { // CraftBukkit diff --git a/Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch b/Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch index 49e7058df2..ca8916963f 100644 --- a/Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch +++ b/Spigot-Server-Patches/0137-ExperienceOrbs-API-for-Reason-Source-Triggering-play.patch @@ -7,70 +7,24 @@ Adds lots of information about why this orb exists. Replaces isFromBottle() with logic that persists entity reloads too. -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 428a10fb100d1b4775dab6cfe69f28c29a45cd70..cee4e952c96b9f55c57186ac96aa730e656e1f16 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -228,13 +228,13 @@ public class Block extends BlockBase implements IMaterial { - } - } +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index e9730597f2bd55a021f212d5eb5a76a26f320fb0..51157a9223f3da22d1110cfa211a502de59fb8a1 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -408,7 +408,7 @@ public class PlayerInteractManager { -- protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) { -+ protected void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, EntityPlayer player) { // Paper - if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { - while (i > 0) { - int j = EntityExperienceOrb.getOrbValue(i); - - i -= j; -- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j)); -+ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java -index 9e02e60060adbe4679a4ad2e848bf34b58a523aa..b69adda272f6bfb7f1570c282a16b343c9a552e2 100644 ---- a/src/main/java/net/minecraft/server/ContainerGrindstone.java -+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java -@@ -82,7 +82,7 @@ public class ContainerGrindstone extends Container { - int k = EntityExperienceOrb.getOrbValue(j); - - j -= k; -- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k)); -+ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper - } - - world.triggerEffect(1042, blockposition, 0); -diff --git a/src/main/java/net/minecraft/server/EntityAnimal.java b/src/main/java/net/minecraft/server/EntityAnimal.java -index 1f79975f47be069cddc15bf3b902ed8105bde8ac..b290218e506d5e4ddd1af17f91de19a588bbcfbd 100644 ---- a/src/main/java/net/minecraft/server/EntityAnimal.java -+++ b/src/main/java/net/minecraft/server/EntityAnimal.java -@@ -238,7 +238,7 @@ public abstract class EntityAnimal extends EntityAgeable { - if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { - // CraftBukkit start - use event experience - if (experience > 0) { -- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience)); -+ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper + // Drop event experience + if (flag && event != null) { +- iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop()); ++ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop(), this.player); // Paper } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 676b23616a0ef09cea62d3a8d2e3a5fe69f209f1..348d3575115ed6c95b4aee56f0fd930103651489 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -612,7 +612,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - int j = EntityExperienceOrb.getOrbValue(i); - i -= j; -- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); -+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.killer, this)); // Paper - } - - } -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index cc65c57637e07b82f5efcfa9f73f0e7abe9be6f5..701d015baf03eba07b319baf447b5ae06ab8accd 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -17,9 +17,59 @@ public class EntityExperienceOrb extends Entity { + return true; +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +index a17812943b5402684c68ddeac5408dc939e42cf6..f4da22b33c704e675510b4b1a3aa7c180088be29 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +@@ -31,9 +31,59 @@ public class EntityExperienceOrb extends Entity { public int value; private EntityHuman targetPlayer; private int targetTime; @@ -130,7 +84,7 @@ index cc65c57637e07b82f5efcfa9f73f0e7abe9be6f5..701d015baf03eba07b319baf447b5ae0 this.setPosition(d0, d1, d2); this.yaw = (float) (this.random.nextDouble() * 360.0D); this.setMot((this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D, this.random.nextDouble() * 0.2D * 2.0D, (this.random.nextDouble() * 0.20000000298023224D - 0.10000000149011612D) * 2.0D); -@@ -154,6 +204,7 @@ public class EntityExperienceOrb extends Entity { +@@ -168,6 +218,7 @@ public class EntityExperienceOrb extends Entity { nbttagcompound.setShort("Health", (short) this.e); nbttagcompound.setShort("Age", (short) this.c); nbttagcompound.setShort("Value", (short) this.value); @@ -138,7 +92,7 @@ index cc65c57637e07b82f5efcfa9f73f0e7abe9be6f5..701d015baf03eba07b319baf447b5ae0 } @Override -@@ -161,6 +212,7 @@ public class EntityExperienceOrb extends Entity { +@@ -175,6 +226,7 @@ public class EntityExperienceOrb extends Entity { this.e = nbttagcompound.getShort("Health"); this.c = nbttagcompound.getShort("Age"); this.value = nbttagcompound.getShort("Value"); @@ -146,37 +100,11 @@ index cc65c57637e07b82f5efcfa9f73f0e7abe9be6f5..701d015baf03eba07b319baf447b5ae0 } @Override -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index 65b9eebcd59d1d95a77780f41862d8c984dee03c..fac695125da50bb33b68f317339832a26f7625a6 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -465,7 +465,7 @@ public class EntityFishingHook extends IProjectile { - this.world.addEntity(entityitem); - // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() - if (playerFishEvent.getExpToDrop() > 0) { -- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop())); -+ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper - } - // CraftBukkit end - if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) { -diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index fef00b46e7cf3690044059f9ee527f799d535b81..a7bbf21e9736a0da38f95d93b013097b1e745306 100644 ---- a/src/main/java/net/minecraft/server/EntityFox.java -+++ b/src/main/java/net/minecraft/server/EntityFox.java -@@ -1236,7 +1236,7 @@ public class EntityFox extends EntityAnimal { - if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { - // CraftBukkit start - use event experience - if (experience > 0) { -- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); -+ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper - } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index f54d05f59342231434a70c3b12b7cf9b73f98508..6c2370978443e02f2f39d4ef2ceffe559837bc69 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1501,7 +1501,8 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index ecb07130be80b484e0f2241a368db967775148e8..6fa269cec002fcffd6d02125c20efa9314148243 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -1594,7 +1594,8 @@ public abstract class EntityLiving extends Entity { int j = EntityExperienceOrb.getOrbValue(i); i -= j; @@ -186,24 +114,37 @@ index f54d05f59342231434a70c3b12b7cf9b73f98508..6c2370978443e02f2f39d4ef2ceffe55 } this.expToDrop = 0; } -diff --git a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -index 7a80b341ee7734cc289abdff8755834447cbef75..2d3ca8c424f2088027d51066d634c48723e96214 100644 ---- a/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -+++ b/src/main/java/net/minecraft/server/EntityThrownExpBottle.java -@@ -44,7 +44,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable { - int j = EntityExperienceOrb.getOrbValue(i); - - i -= j; -- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); -+ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, getShooter(), this)); // Paper +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java b/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java +index 8d0c7469999bb6d75debf427ff4d7fa5d2d5c505..28dd42921961c6a47f2d85a5f93b8298f2c228d3 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityAnimal.java +@@ -262,7 +262,7 @@ public abstract class EntityAnimal extends EntityAgeable { + if (worldserver.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + // CraftBukkit start - use event experience + if (experience > 0) { +- worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience)); ++ worldserver.addEntity(new EntityExperienceOrb(worldserver, this.locX(), this.locY(), this.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityageable)); // Paper + } + // CraftBukkit end } - - this.die(); -diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index 61e24c2897a2cb93881caaa6fff86f44461765ac..19c92bea21ddcc3917eb011dcfe41006299356ef 100644 ---- a/src/main/java/net/minecraft/server/EntityTurtle.java -+++ b/src/main/java/net/minecraft/server/EntityTurtle.java -@@ -499,7 +499,7 @@ public class EntityTurtle extends EntityAnimal { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java +index 7941a083353bb1d9ba81c41d7a566b72bdc955d9..459b7727e946679989477f4a7e99c5ca47ac0b30 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java +@@ -1306,7 +1306,7 @@ public class EntityFox extends EntityAnimal { + if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { + // CraftBukkit start - use event experience + if (experience > 0) { +- this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience)); ++ this.b.addEntity(new EntityExperienceOrb(this.b, this.animal.locX(), this.animal.locY(), this.animal.locZ(), experience, org.bukkit.entity.ExperienceOrb.SpawnReason.BREED, entityplayer, entityfox)); // Paper + } + // CraftBukkit end + } +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +index 5d08b83e2832cad2c8726ae817e003d970bc52a0..bf224c97854daa379c61affff6a0ac9524c2c35d 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +@@ -561,7 +561,7 @@ public class EntityTurtle extends EntityAnimal { Random random = this.animal.getRandom(); if (this.b.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) { @@ -212,11 +153,24 @@ index 61e24c2897a2cb93881caaa6fff86f44461765ac..19c92bea21ddcc3917eb011dcfe41006 } } -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 8b5901396a7f1dc554a5e237200a8193e9096a18..768dfbc58510e8599f05a5bba25558141124e531 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -530,7 +530,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +index 74802de01dba30e38e09f6fc1f61e7bb64cf5f09..97ef4c65c8cc569a99d9697f56bd44d32b151328 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -661,7 +661,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; +- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); ++ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.ENTITY_DEATH, this.killer, this)); // Paper + } + + } +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 3604fffb9ba13a019e98e0a1a0ef7ba81c8dc329..adce6f17a5dd33004f8a67cd55d195de029e0263 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -600,7 +600,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } if (merchantrecipe.isRewardExp()) { @@ -225,11 +179,11 @@ index 8b5901396a7f1dc554a5e237200a8193e9096a18..768dfbc58510e8599f05a5bba2555814 } } -diff --git a/src/main/java/net/minecraft/server/EntityVillagerTrader.java b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -index cce5663d2d6f9658f92c5819b323fee5349ed6bb..250a4e5ddd626794482678a64023f0f5459520e1 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerTrader.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerTrader.java -@@ -146,7 +146,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java +index 8fd2cfe264bbf49a489eb34e7b6505b3f2080f8c..e03796372ee0795e29918a7abd8e0a8756e0be96 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerTrader.java +@@ -189,7 +189,7 @@ public class EntityVillagerTrader extends EntityVillagerAbstract { if (merchantrecipe.isRewardExp()) { int i = 3 + this.random.nextInt(4); @@ -238,24 +192,50 @@ index cce5663d2d6f9658f92c5819b323fee5349ed6bb..250a4e5ddd626794482678a64023f0f5 } } -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index b5c464f34789889e71a9fed3cc600f7f9cb8828a..aae5feb77402d721c23f7e781b53864f6778c1dd 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -378,7 +378,7 @@ public class PlayerInteractManager { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +index 57e7b9c7f7f43666d442648120cda3b4b3e5bfb2..d40b056b2ff14033113bd7108a3295f8783b8bdf 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +@@ -503,7 +503,7 @@ public class EntityFishingHook extends IProjectile { + this.world.addEntity(entityitem); + // CraftBukkit start - this.random.nextInt(6) + 1 -> playerFishEvent.getExpToDrop() + if (playerFishEvent.getExpToDrop() > 0) { +- entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop())); ++ entityhuman.world.addEntity(new EntityExperienceOrb(entityhuman.world, entityhuman.locX(), entityhuman.locY() + 0.5D, entityhuman.locZ() + 0.5D, playerFishEvent.getExpToDrop(), org.bukkit.entity.ExperienceOrb.SpawnReason.FISHING, this.getOwner(), this)); // Paper + } + // CraftBukkit end + if (itemstack1.getItem().a((Tag) TagsItem.FISHES)) { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java b/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java +index 87fe16c81b57ba07399f5566ab8bd77d71db36a1..e07353a6b34196e3d275ba482fbef7e4d209c31d 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityThrownExpBottle.java +@@ -54,7 +54,7 @@ public class EntityThrownExpBottle extends EntityProjectileThrowable { + int j = EntityExperienceOrb.getOrbValue(i); - // Drop event experience - if (flag && event != null) { -- iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop()); -+ iblockdata.getBlock().dropExperience(this.world, blockposition, event.getExpToDrop(), this.player); // Paper - } + i -= j; +- this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j)); ++ this.world.addEntity(new EntityExperienceOrb(this.world, this.locX(), this.locY(), this.locZ(), j, org.bukkit.entity.ExperienceOrb.SpawnReason.EXP_BOTTLE, getShooter(), this)); // Paper + } - return true; -diff --git a/src/main/java/net/minecraft/server/SlotFurnaceResult.java b/src/main/java/net/minecraft/server/SlotFurnaceResult.java -index d2698e847cfcbc4d2f91b4f5d66b38b47f86c10e..edc4a5c34e8064d900668d132b3496e354408eaf 100644 ---- a/src/main/java/net/minecraft/server/SlotFurnaceResult.java -+++ b/src/main/java/net/minecraft/server/SlotFurnaceResult.java -@@ -2,7 +2,7 @@ package net.minecraft.server; + this.die(); +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +index cba1de50f3035ae1b9366f474745d50a1f8fc014..fad7355a549aef811bca43be198af3d1c0a53980 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +@@ -94,7 +94,7 @@ public class ContainerGrindstone extends Container { + int k = EntityExperienceOrb.getOrbValue(j); + + j -= k; +- world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k)); ++ world.addEntity(new EntityExperienceOrb(world, (double) blockposition.getX(), (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, k, org.bukkit.entity.ExperienceOrb.SpawnReason.GRINDSTONE, entityhuman)); // Paper + } + + world.triggerEffect(1042, blockposition, 0); +diff --git a/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java b/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java +index 48324295913dd9a9bd31332b5b811a729b621dfb..a114e576e5d80c25cc7f2b17f0dc3ad706a1b877 100644 +--- a/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java ++++ b/src/main/java/net/minecraft/world/inventory/SlotFurnaceResult.java +@@ -7,7 +7,7 @@ import net.minecraft.world.level.block.entity.TileEntityFurnace; public class SlotFurnaceResult extends Slot { @@ -264,11 +244,31 @@ index d2698e847cfcbc4d2f91b4f5d66b38b47f86c10e..edc4a5c34e8064d900668d132b3496e3 private int b; public SlotFurnaceResult(EntityHuman entityhuman, IInventory iinventory, int i, int j, int k) { -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index 45bc958667776a4f62c8e625eb8fccdc3dfb0f21..af4db22cf87433fcd4f59be207257a8d7c255883 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -574,7 +574,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index d285c4e3d9f938973bf7fb904680044b414e6236..615a4418fd276cd3e0b3686d962ebaf13ef5d4be 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -267,13 +267,13 @@ public class Block extends BlockBase implements IMaterial { + } + } + +- public void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i) { ++ public void dropExperience(WorldServer worldserver, BlockPosition blockposition, int i, net.minecraft.server.level.EntityPlayer player) { // Paper + if (worldserver.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { + while (i > 0) { + int j = EntityExperienceOrb.getOrbValue(i); + + i -= j; +- worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j)); ++ worldserver.addEntity(new EntityExperienceOrb(worldserver, (double) blockposition.getX() + 0.5D, (double) blockposition.getY() + 0.5D, (double) blockposition.getZ() + 0.5D, j, org.bukkit.entity.ExperienceOrb.SpawnReason.BLOCK_BREAK, player)); // Paper + } + } + +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +index 9744d51a52c5eb99c4cf9e36d9380c49674dd136..deaa4c136c23dc6c258cc1ce68523b3c007c80f9 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +@@ -603,7 +603,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I int k = EntityExperienceOrb.getOrbValue(j); j -= k; @@ -278,7 +278,7 @@ index 45bc958667776a4f62c8e625eb8fccdc3dfb0f21..af4db22cf87433fcd4f59be207257a8d } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index af8593d117359c75ff8c635a93499d84e25eb854..4058484c256343a71d1392ae0aa54bf07fd0d26e 100644 +index 6d78b243d712b2f152ada8b5e7375545b96a76c7..4e255f2ca75ac0c1e1572f312a669cb6d3b60121 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1841,7 +1841,7 @@ public class CraftWorld implements World { @@ -291,7 +291,7 @@ index af8593d117359c75ff8c635a93499d84e25eb854..4058484c256343a71d1392ae0aa54bf0 entity = EntityTypes.LIGHTNING_BOLT.a(world); } else if (AreaEffectCloud.class.isAssignableFrom(clazz)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java -index 1b512cc45c7a185b8a7950ff9882e1f2af171cc8..fbad0456757cadea4d7f50c63dbb07bad7e8baa9 100644 +index da14f59aec2b6854c3a47fb531aadc9ddb74954c..c6880830720baa2723ab003e51be1b48574d7319 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftExperienceOrb.java @@ -20,6 +20,18 @@ public class CraftExperienceOrb extends CraftEntity implements ExperienceOrb { diff --git a/Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch b/Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch index 2f0a315ce3..5f443dacfc 100644 --- a/Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch +++ b/Spigot-Server-Patches/0138-Cap-Entity-Collisions.patch @@ -26,11 +26,11 @@ index 2dc58b9f769ea43b737804456aafab47ecc143b8..c611b5a63498f5ad1f50a75ccd5d7299 + log( "Max Entity Collisions: " + maxCollisionsPerEntity ); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index bd7d9949eb9a290833958d170d1ad69990406b16..bb049690ce61310a90852637397abd449c1dc43a 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -183,6 +183,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 49da1525cfc46743013bbac0528ec58501cab6eb..b798190628c1d83b5bf9e5497b515ef1e9f26707 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -268,6 +268,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -38,11 +38,11 @@ index bd7d9949eb9a290833958d170d1ad69990406b16..bb049690ce61310a90852637397abd44 public void inactiveTick() { } // Spigot end -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index abc300a54100b42e30705185ec60da6624db4c91..c2c5dbba5cc048e8fa2a4a383737330adf7b7663 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2810,8 +2810,11 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 6fa269cec002fcffd6d02125c20efa9314148243..2eee92f74a7c82ec7df05db6df79743b4345cc86 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -2903,8 +2903,11 @@ public abstract class EntityLiving extends Entity { } } diff --git a/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch b/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch index 87aa04b9b1..94fc8c9154 100644 --- a/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch +++ b/Spigot-Server-Patches/0140-Make-targetSize-more-aggressive-in-the-chunk-unload-.patch @@ -4,11 +4,11 @@ Date: Tue, 7 Feb 2017 16:55:35 -0600 Subject: [PATCH] Make targetSize more aggressive in the chunk unload queue -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 612eb16bce1bce1cad40ea0f279d2b8397263dea..02a516ddabda08db33c94cce2d19d9e77666e074 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -76,7 +76,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 7702b0b86a5ccfe6eab81025cfc8c4a83ba52b7c..146227ecfe654c36da958ddc2cfb9b67738de4a0 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -120,7 +120,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final PlayerMap playerMap; public final Int2ObjectMap trackedEntities; private final Long2ByteMap z; @@ -17,7 +17,7 @@ index 612eb16bce1bce1cad40ea0f279d2b8397263dea..02a516ddabda08db33c94cce2d19d9e7 private int viewDistance; // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() -@@ -134,7 +134,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -178,7 +178,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerMap = new PlayerMap(); this.trackedEntities = new Int2ObjectOpenHashMap(); this.z = new Long2ByteOpenHashMap(); @@ -26,7 +26,7 @@ index 612eb16bce1bce1cad40ea0f279d2b8397263dea..02a516ddabda08db33c94cce2d19d9e7 this.definedStructureManager = definedstructuremanager; this.w = convertable_conversionsession.a(worldserver.getDimensionKey()); this.world = worldserver; -@@ -392,7 +392,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -436,7 +436,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Spigot start org.spigotmc.SlackActivityAccountant activityAccountant = this.world.getMinecraftServer().slackActivityAccountant; activityAccountant.startActivity(0.5); @@ -35,7 +35,7 @@ index 612eb16bce1bce1cad40ea0f279d2b8397263dea..02a516ddabda08db33c94cce2d19d9e7 // Spigot end while (longiterator.hasNext()) { // Spigot long j = longiterator.nextLong(); -@@ -414,7 +414,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -458,7 +458,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { Runnable runnable; diff --git a/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch b/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch index d24dab5b79..3f2446b762 100644 --- a/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch +++ b/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch @@ -4,11 +4,32 @@ Date: Sat, 18 Feb 2017 19:29:58 -0600 Subject: [PATCH] Do not let armorstands drown -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 4870a6f9f894b2c9d0fea83dad0808ac6448f808..e17637cfee773b1b79c05d7a8e6558963c7a9c14 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -837,5 +837,10 @@ public class EntityArmorStand extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 2eee92f74a7c82ec7df05db6df79743b4345cc86..3d6b8fd09c07e78c0d786dff9658eb0089f853cf 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -338,6 +338,7 @@ public abstract class EntityLiving extends Entity { + super.a(d0, flag, iblockdata, blockposition); + } + ++ public boolean canBreatheUnderwater() { return this.cM(); } // Paper - OBFHELPER + public boolean cM() { + return this.getMonsterType() == EnumMonsterType.UNDEAD; + } +@@ -381,7 +382,7 @@ public abstract class EntityLiving extends Entity { + + if (this.isAlive()) { + if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) { +- if (!this.cM() && !MobEffectUtil.c(this) && !flag1) { ++ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden + this.setAirTicks(this.l(this.getAirTicks())); + if (this.getAirTicks() == -20) { + this.setAirTicks(0); +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index f0f93b3ff0b98f916b5f63b37b0f9b5c7fa03c2e..e9ea670248eb0680cdff9a72412e9331fc57ff8a 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -871,5 +871,10 @@ public class EntityArmorStand extends EntityLiving { super.move(moveType, vec3d); } } @@ -19,24 +40,3 @@ index 4870a6f9f894b2c9d0fea83dad0808ac6448f808..e17637cfee773b1b79c05d7a8e655896 + } // Paper end } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index c2c5dbba5cc048e8fa2a4a383737330adf7b7663..2dfa2abf37994a72dfdfcc38e032626247b43fd7 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -245,6 +245,7 @@ public abstract class EntityLiving extends Entity { - super.a(d0, flag, iblockdata, blockposition); - } - -+ public boolean canBreatheUnderwater() { return this.cM(); } // Paper - OBFHELPER - public boolean cM() { - return this.getMonsterType() == EnumMonsterType.UNDEAD; - } -@@ -288,7 +289,7 @@ public abstract class EntityLiving extends Entity { - - if (this.isAlive()) { - if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) { -- if (!this.cM() && !MobEffectUtil.c(this) && !flag1) { -+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden - this.setAirTicks(this.l(this.getAirTicks())); - if (this.getAirTicks() == -20) { - this.setAirTicks(0); diff --git a/Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch b/Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch index 2cb45ac474..1cc210a185 100644 --- a/Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch +++ b/Spigot-Server-Patches/0142-Properly-handle-async-calls-to-restart-the-server.patch @@ -30,10 +30,10 @@ will have plugins and worlds saving to the disk has a high potential to result in corruption/dataloss. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 110184bd18f689cff1f37ceefe97416b5dcfd405..3baf1be1b58ea53ab1ee8d388b5f9a4595ca478a 100644 +index c6ab645397911d984a28e40583bdb8f782a4f934..42ff9c57a6107c0cf22a204cf7cabf374bbdc868 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -93,6 +93,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant, WorldServer> worldServer; private PlayerList playerList; private volatile boolean isRunning; @@ -41,7 +41,7 @@ index 110184bd18f689cff1f37ceefe97416b5dcfd405..3baf1be1b58ea53ab1ee8d388b5f9a45 private boolean isStopped; private int ticks; protected final Proxy proxy; -@@ -742,7 +743,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) { -- this.releaseShoulderEntities(); -+ if (!this.world.paperConfig.parrotsHangOnBetter) this.releaseShoulderEntities(); // Paper - Hang on! - } - - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 9c25c0e60d9ebeac7ff93f41d0624961811de164..b6f68a8d1eb523fa0e33fae717249bbba2c0715b 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1905,6 +1905,13 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index bc0b1d0cc9c54d53c68ee59b0a707e0335297441..62fb502adf8cd7095e4826eb72ab39cf0bcc6d55 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2050,6 +2050,13 @@ public class PlayerConnection implements PacketListenerPlayIn { switch (packetplayinentityaction.c()) { case PRESS_SHIFT_KEY: this.player.setSneaking(true); @@ -56,3 +43,16 @@ index 9c25c0e60d9ebeac7ff93f41d0624961811de164..b6f68a8d1eb523fa0e33fae717249bbb break; case RELEASE_SHIFT_KEY: this.player.setSneaking(false); +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 291bd9b70a8404a09511fd902b6f376c3d5ca0d4..1a62ea103bb827ffcf0b3fd18a26ac72c0a5ba5c 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -530,7 +530,7 @@ public abstract class EntityHuman extends EntityLiving { + this.j(this.getShoulderEntityLeft()); + this.j(this.getShoulderEntityRight()); + if (!this.world.isClientSide && (this.fallDistance > 0.5F || this.isInWater()) || this.abilities.isFlying || this.isSleeping()) { +- this.releaseShoulderEntities(); ++ if (!this.world.paperConfig.parrotsHangOnBetter) this.releaseShoulderEntities(); // Paper - Hang on! + } + + } diff --git a/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch index 6fd17a5942..215efbf60e 100644 --- a/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch +++ b/Spigot-Server-Patches/0146-Use-TerminalConsoleAppender-for-console-improvements.patch @@ -19,7 +19,7 @@ Other changes: configuration diff --git a/pom.xml b/pom.xml -index b89112912a5b70fb0d77645e4b140f3ee6e6c55a..9888ac56e4fd14f17c032b44d1de5809e598a1a5 100644 +index 2559c83c1b811177ade56537aeab1982ac53ee67..26e59ca76d856cc37222963fd14cb6eaa410c749 100644 --- a/pom.xml +++ b/pom.xml @@ -45,10 +45,27 @@ @@ -54,7 +54,7 @@ index b89112912a5b70fb0d77645e4b140f3ee6e6c55a..9888ac56e4fd14f17c032b44d1de5809 org.apache.logging.log4j -@@ -259,10 +276,18 @@ +@@ -265,10 +282,18 @@ META-INF/services/java.sql.Driver @@ -143,62 +143,20 @@ index 0000000000000000000000000000000000000000..685deaa0e5d1ddc13e3a7c0471b1cfcf + } + +} -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index dc0cb79525adf0d5afee1f677e1fde546529cf97..750b1dc10ffb7adb9194e6cc8ace8fa92a5f0dec 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -63,6 +63,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - if (!org.bukkit.craftbukkit.Main.useConsole) { - return; - } -+ // Paper start - Use TerminalConsoleAppender -+ new com.destroystokyo.paper.console.PaperConsole(DedicatedServer.this).start(); -+ /* - jline.console.ConsoleReader bufferedreader = reader; - - // MC-33041, SPIGOT-5538: if System.in is not valid due to javaw, then return -@@ -102,6 +105,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - DedicatedServer.LOGGER.error("Exception handling console input", ioexception); - } - -+ */ -+ // Paper end - } - }; - -@@ -113,6 +118,9 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - global.addHandler(new org.bukkit.craftbukkit.util.ForwardLogHandler()); - -+ // Paper start - Not needed with TerminalConsoleAppender -+ final org.apache.logging.log4j.Logger logger = LogManager.getRootLogger(); -+ /* - final org.apache.logging.log4j.core.Logger logger = ((org.apache.logging.log4j.core.Logger) LogManager.getRootLogger()); - for (org.apache.logging.log4j.core.Appender appender : logger.getAppenders().values()) { - if (appender instanceof org.apache.logging.log4j.core.appender.ConsoleAppender) { -@@ -121,6 +129,8 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - } - - new org.bukkit.craftbukkit.util.TerminalConsoleWriterThread(System.out, this.reader).start(); -+ */ -+ // Paper end - - System.setOut(IoBuilder.forLogger(logger).setLevel(Level.INFO).buildPrintStream()); - System.setErr(IoBuilder.forLogger(logger).setLevel(Level.WARN).buildPrintStream()); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3baf1be1b58ea53ab1ee8d388b5f9a4595ca478a..5e64853fca8e1baa103dd69c050a4900ef7f7f37 100644 +index 42ff9c57a6107c0cf22a204cf7cabf374bbdc868..5b796a6e5f34c38e15d9ce288dfd9bf498cc328e 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -59,7 +59,7 @@ import org.apache.logging.log4j.Logger; +@@ -159,7 +159,7 @@ import org.apache.logging.log4j.Logger; import com.mojang.serialization.DynamicOps; import com.mojang.serialization.Lifecycle; import com.google.common.collect.ImmutableSet; -import jline.console.ConsoleReader; +// import jline.console.ConsoleReader; // Paper import joptsimple.OptionSet; - import org.bukkit.Bukkit; - import org.bukkit.craftbukkit.CraftServer; -@@ -147,7 +147,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; -@@ -216,7 +216,9 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant collection = this.getEffects(); diff --git a/Spigot-Server-Patches/0148-Item-canEntityPickup.patch b/Spigot-Server-Patches/0148-Item-canEntityPickup.patch index 8f09d5bddc..13ad0fa1fe 100644 --- a/Spigot-Server-Patches/0148-Item-canEntityPickup.patch +++ b/Spigot-Server-Patches/0148-Item-canEntityPickup.patch @@ -4,11 +4,11 @@ Date: Fri, 5 May 2017 03:57:17 -0500 Subject: [PATCH] Item#canEntityPickup -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index a819fc46bebc4b1aaae63f822087574e976e2ab8..6274cf1975270fdac8ae4986e1c170bd075d640e 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -539,6 +539,11 @@ public abstract class EntityInsentient extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 0631cd531647239858b2a7298f58cc770720f69a..0387052b45cdc849d9e67113532a7591f05e5531 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -604,6 +604,11 @@ public abstract class EntityInsentient extends EntityLiving { EntityItem entityitem = (EntityItem) iterator.next(); if (!entityitem.dead && !entityitem.getItemStack().isEmpty() && !entityitem.p() && this.i(entityitem.getItemStack())) { @@ -20,11 +20,11 @@ index a819fc46bebc4b1aaae63f822087574e976e2ab8..6274cf1975270fdac8ae4986e1c170bd this.b(entityitem); } } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index bbaba67d297c3d6a488bdbf6c500658e872772b0..9b400c1f4ea807149862d30154df9b30895176da 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -21,6 +21,7 @@ public class EntityItem extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 38b91b450c6bdc25efaed495ce26d909a52531bf..c486c07a358c0b444e1a1372b6d0fa2901840eac 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -47,6 +47,7 @@ public class EntityItem extends Entity { private UUID owner; public final float b; private int lastTick = MinecraftServer.currentTick - 1; // CraftBukkit @@ -33,7 +33,7 @@ index bbaba67d297c3d6a488bdbf6c500658e872772b0..9b400c1f4ea807149862d30154df9b30 public EntityItem(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java -index d7da0cf2e7b9e669635b469f87e8da4d7fdecb35..d6a64e4ecf9225f9a93523c50b2f1375296b406e 100644 +index f333dd2726f554a3137a3a78d162905f4ed1435e..5988cdd18b7e4bfca0075fd2356cfe9c4e673954 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItem.java @@ -49,6 +49,16 @@ public class CraftItem extends CraftEntity implements Item { diff --git a/Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch b/Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch index 93a14f94bb..2bbbc7656e 100644 --- a/Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch +++ b/Spigot-Server-Patches/0149-PlayerPickupItemEvent-setFlyAtPlayer.patch @@ -4,11 +4,11 @@ Date: Sun, 7 May 2017 06:26:09 -0500 Subject: [PATCH] PlayerPickupItemEvent#setFlyAtPlayer -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 9b400c1f4ea807149862d30154df9b30895176da..051c97374fdbd6ff6d4eb58a3b6630ece8469967 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -337,6 +337,7 @@ public class EntityItem extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index c486c07a358c0b444e1a1372b6d0fa2901840eac..3b72032f6f4f4bd64d1202658cc0c6ee4fb76ea9 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -363,6 +363,7 @@ public class EntityItem extends Entity { // CraftBukkit start - fire PlayerPickupItemEvent int canHold = entityhuman.inventory.canHold(itemstack); int remaining = i - canHold; @@ -16,7 +16,7 @@ index 9b400c1f4ea807149862d30154df9b30895176da..051c97374fdbd6ff6d4eb58a3b6630ec if (this.pickupDelay <= 0 && canHold > 0) { itemstack.setCount(canHold); -@@ -344,8 +345,14 @@ public class EntityItem extends Entity { +@@ -370,8 +371,14 @@ public class EntityItem extends Entity { PlayerPickupItemEvent playerEvent = new PlayerPickupItemEvent((org.bukkit.entity.Player) entityhuman.getBukkitEntity(), (org.bukkit.entity.Item) this.getBukkitEntity(), remaining); playerEvent.setCancelled(!entityhuman.canPickUpLoot); this.world.getServer().getPluginManager().callEvent(playerEvent); @@ -31,7 +31,7 @@ index 9b400c1f4ea807149862d30154df9b30895176da..051c97374fdbd6ff6d4eb58a3b6630ec return; } -@@ -375,7 +382,11 @@ public class EntityItem extends Entity { +@@ -401,7 +408,11 @@ public class EntityItem extends Entity { // CraftBukkit end if (this.pickupDelay == 0 && (this.owner == null || this.owner.equals(entityhuman.getUniqueID())) && entityhuman.inventory.pickup(itemstack)) { diff --git a/Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch b/Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch index 7a856ae3ef..13d2f54354 100644 --- a/Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch +++ b/Spigot-Server-Patches/0150-PlayerAttemptPickupItemEvent.patch @@ -4,11 +4,11 @@ Date: Sun, 11 Jun 2017 16:30:30 -0500 Subject: [PATCH] PlayerAttemptPickupItemEvent -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 051c97374fdbd6ff6d4eb58a3b6630ece8469967..fac335b3f80e6af3b08544cfd4abe3c77b66b023 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -10,6 +10,7 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 3b72032f6f4f4bd64d1202658cc0c6ee4fb76ea9..de11fd9772f30ac72c3ca52ec4efc3fef4091425 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -36,6 +36,7 @@ import net.minecraft.server.MinecraftServer; import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end @@ -16,7 +16,7 @@ index 051c97374fdbd6ff6d4eb58a3b6630ece8469967..fac335b3f80e6af3b08544cfd4abe3c7 public class EntityItem extends Entity { -@@ -339,6 +340,22 @@ public class EntityItem extends Entity { +@@ -365,6 +366,22 @@ public class EntityItem extends Entity { int remaining = i - canHold; boolean flyAtPlayer = false; // Paper diff --git a/Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch b/Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch index 5c26e6471f..9c039a3e69 100644 --- a/Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch +++ b/Spigot-Server-Patches/0151-Add-UnknownCommandEvent.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Add UnknownCommandEvent diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 38486fb74a29fd8ace2bfa6e74c1b5230ab99a7f..3ddd97c732fe5ae24075e70f8b8a2b0c3e52a32c 100644 +index 5d357b0f84b5242066dcce203752a0f46e9a249c..4f9c42a4b0256f181263bf5e0492714a01fbec38 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -@@ -104,6 +104,7 @@ import net.minecraft.server.WorldNBTStorage; - import net.minecraft.server.WorldServer; - import net.minecraft.server.WorldSettings; +@@ -104,6 +104,7 @@ import net.minecraft.world.level.storage.WorldNBTStorage; + import net.minecraft.world.level.storage.loot.LootTableRegistry; + import net.minecraft.world.phys.Vec3D; import org.apache.commons.lang.Validate; +import org.apache.commons.lang3.StringUtils; import org.bukkit.BanList; diff --git a/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch b/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch index f508caac8b..6805f107d2 100644 --- a/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch +++ b/Spigot-Server-Patches/0152-Basic-PlayerProfile-API.patch @@ -428,10 +428,10 @@ index 0000000000000000000000000000000000000000..3cdd06d3af7ff94f1fe1a11b9a9275e1 + } +} diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 17d73ebbe51a83f79f338bdb1b366cecd99f880d..39174bca00b4535e92f6b325b3fd058ceae41f8b 100644 +index 18b56b59fd6efd618e6ff6f9cf3a02f57588d244..cd7dc7d90efddb8a1bb50cd964b43d18cf9c83d1 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -1,9 +1,12 @@ +@@ -1,6 +1,8 @@ package net.minecraft.server; import com.destroystokyo.paper.block.TargetBlockInfo; @@ -439,12 +439,16 @@ index 17d73ebbe51a83f79f338bdb1b366cecd99f880d..39174bca00b4535e92f6b325b3fd058c +import com.destroystokyo.paper.profile.PlayerProfile; import com.google.common.util.concurrent.ThreadFactoryBuilder; import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; + import net.minecraft.core.BlockPosition; +@@ -11,6 +13,7 @@ import net.minecraft.world.level.ChunkCoordIntPair; + import net.minecraft.world.level.RayTrace; + import net.minecraft.world.level.World; import org.apache.commons.lang.exception.ExceptionUtils; +import com.mojang.authlib.GameProfile; import org.bukkit.Location; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftWorld; -@@ -338,6 +341,10 @@ public final class MCUtil { +@@ -345,6 +348,10 @@ public final class MCUtil { return run.get(); } @@ -456,10 +460,10 @@ index 17d73ebbe51a83f79f338bdb1b366cecd99f880d..39174bca00b4535e92f6b325b3fd058c * Calculates distance between 2 entities * @param e1 diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index d8c8bf2466be362b424fde611fe42b73fea42ef9..85f7cfa1fade8d574e7f85d857ab071c66ec4a95 100644 +index 89db31061fcc3420bc8e668533a4051cdbd12253..191a74bd9b894f9d64d0a55747cb17e07ceef597 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -93,7 +93,7 @@ public class Main { +@@ -132,7 +132,7 @@ public class Main { } File file = (File) optionset.valueOf("universe"); // CraftBukkit @@ -468,11 +472,11 @@ index d8c8bf2466be362b424fde611fe42b73fea42ef9..85f7cfa1fade8d574e7f85d857ab071c MinecraftSessionService minecraftsessionservice = yggdrasilauthenticationservice.createMinecraftSessionService(); GameProfileRepository gameprofilerepository = yggdrasilauthenticationservice.createProfileRepository(); UserCache usercache = new UserCache(gameprofilerepository, new File(file, MinecraftServer.b.getName())); -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index e89c92aded564fe689cc1aa8d0c83abb72f7b10c..aa1b18ffa1e2b7f865f63b7df81d8f3b3d5aa966 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -42,7 +42,7 @@ public class UserCache { +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java +index 85ca2a3b19d27a0dbe1c8dee6bd5b31ae11bbce2..bc3deb1d9710c744388ce6e89a6f5f4f3f05238d 100644 +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java +@@ -43,7 +43,7 @@ public class UserCache { private static final Logger LOGGER = LogManager.getLogger(); private static boolean b; @@ -481,7 +485,7 @@ index e89c92aded564fe689cc1aa8d0c83abb72f7b10c..aa1b18ffa1e2b7f865f63b7df81d8f3b private final Map d = Maps.newConcurrentMap(); private final GameProfileRepository e; private final Gson f = (new GsonBuilder()).create(); -@@ -106,6 +106,7 @@ public class UserCache { +@@ -107,6 +107,7 @@ public class UserCache { return UserCache.b; } @@ -489,7 +493,7 @@ index e89c92aded564fe689cc1aa8d0c83abb72f7b10c..aa1b18ffa1e2b7f865f63b7df81d8f3b public synchronized void a(GameProfile gameprofile) { // Paper - synchronize Calendar calendar = Calendar.getInstance(); -@@ -155,6 +156,13 @@ public class UserCache { +@@ -156,6 +157,13 @@ public class UserCache { return gameprofile; } @@ -503,7 +507,7 @@ index e89c92aded564fe689cc1aa8d0c83abb72f7b10c..aa1b18ffa1e2b7f865f63b7df81d8f3b @Nullable public GameProfile getProfile(UUID uuid) { UserCache.UserCacheEntry usercache_usercacheentry = (UserCache.UserCacheEntry) this.d.get(uuid); -@@ -337,7 +345,7 @@ public class UserCache { +@@ -338,7 +346,7 @@ public class UserCache { static class UserCacheEntry { @@ -513,7 +517,7 @@ index e89c92aded564fe689cc1aa8d0c83abb72f7b10c..aa1b18ffa1e2b7f865f63b7df81d8f3b private volatile long c; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 0d52428faa3730cf4f2bf4e16884fdea6ad57c9a..5c9a2efe69bda1453ae9b679a2ee992ae98e965f 100644 +index 4f9c42a4b0256f181263bf5e0492714a01fbec38..7d2fc05ddb18369aed29595e3c0dcbf6db136309 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -227,6 +227,9 @@ import org.yaml.snakeyaml.error.MarkedYAMLException; @@ -552,7 +556,7 @@ index 0d52428faa3730cf4f2bf4e16884fdea6ad57c9a..5c9a2efe69bda1453ae9b679a2ee992a // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 42de897596ada4044df683dc5e8d5d750ee9c207..58aeeff96a92b5ba0c3435c680885ad3bc4f4ce6 100644 +index dff67a48961399f3746f99b4f2363724bfe51c36..8298ae9bf1c5635f08552c15f004b3d0f6e9f19b 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java @@ -80,6 +80,13 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { diff --git a/Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch b/Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch index 75ed55dbfb..a1157123d1 100644 --- a/Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch +++ b/Spigot-Server-Patches/0153-Shoulder-Entities-Release-API.patch @@ -4,11 +4,11 @@ Date: Sat, 17 Jun 2017 15:18:30 -0400 Subject: [PATCH] Shoulder Entities Release API -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 62c914893ffd40c0e88a9d11f04fb5c7dea9063a..14ab88c1a417c9b9a5fee1756006eb6cfcebc996 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1784,20 +1784,44 @@ public abstract class EntityHuman extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 1a62ea103bb827ffcf0b3fd18a26ac72c0a5ba5c..2afd8ccb03ebae94d99995d383f55744bd58df0a 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -1878,20 +1878,44 @@ public abstract class EntityHuman extends EntityLiving { } @@ -58,7 +58,7 @@ index 62c914893ffd40c0e88a9d11f04fb5c7dea9063a..14ab88c1a417c9b9a5fee1756006eb6c @Override public abstract boolean isSpectator(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index 19cdff6eebb7c07d75b515dfa0d47bb762626150..4b0d0b1f8de44088b3433f3474757e6bd6519644 100644 +index 105d0388998d1e35e634d2163fe1a44aa7037ac8..8661f97ac885daca068057c1fcc4eed54c6d7f14 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -493,6 +493,32 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch b/Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch index f7f71fe226..3b4a49574b 100644 --- a/Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch +++ b/Spigot-Server-Patches/0155-Block-player-logins-during-server-shutdown.patch @@ -4,11 +4,11 @@ Date: Sun, 2 Jul 2017 21:35:56 -0500 Subject: [PATCH] Block player logins during server shutdown -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 643c66a8a81ce7131cfd6d9f956d1a9cc85fc56b..a7b57185d337846d8f7b296b31665315d375ecd5 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -50,6 +50,12 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 9f87503c58f64bbfa829faa58600d7d9e64aecf1..651b84b3bba316407a217c941be4c20074c5bb90 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -68,6 +68,12 @@ public class LoginListener implements PacketLoginInListener { } public void tick() { diff --git a/Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch b/Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch index e12de1abdf..3a00081a94 100644 --- a/Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch +++ b/Spigot-Server-Patches/0156-Entity-fromMobSpawner.patch @@ -4,11 +4,11 @@ Date: Sun, 18 Jun 2017 18:17:05 -0500 Subject: [PATCH] Entity#fromMobSpawner() -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index bb049690ce61310a90852637397abd449c1dc43a..3b134ea0a6b30dce70ed9d00414c305354e07476 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -183,6 +183,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index b798190628c1d83b5bf9e5497b515ef1e9f26707..6b6de18e368d48b61482a7210794b756d805a460 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -268,6 +268,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -16,7 +16,7 @@ index bb049690ce61310a90852637397abd449c1dc43a..3b134ea0a6b30dce70ed9d00414c3053 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1580,6 +1581,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1665,6 +1666,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -27,7 +27,7 @@ index bb049690ce61310a90852637397abd449c1dc43a..3b134ea0a6b30dce70ed9d00414c3053 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1708,6 +1713,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1793,6 +1798,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (!originTag.isEmpty()) { origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2)); } @@ -36,11 +36,11 @@ index bb049690ce61310a90852637397abd449c1dc43a..3b134ea0a6b30dce70ed9d00414c3053 // Paper end } catch (Throwable throwable) { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 259713339217660e8b81a9500f57c6995ea59dde..8eb20c6b9a88d5d4056f91df1f496d3d35b473da 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -143,6 +143,7 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index 76c98d576d3e567ec4482b30219f5a9107cb9703..43fcc001bb9815b352cb74af10290b2a4ccaa540 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -160,6 +160,7 @@ public abstract class MobSpawnerAbstract { } // Spigot End } @@ -49,10 +49,10 @@ index 259713339217660e8b81a9500f57c6995ea59dde..8eb20c6b9a88d5d4056f91df1f496d3d if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { Entity vehicle = entity.getVehicle(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 14c06298157c4a6c6061df01b213e69b6c3481d5..976dbe680ef56095071b0416d5e1f0d68cf546e6 100644 +index a58626b1a0160983a738a45c8a1d411eb347e6a2..4c2a35fb33da19a15a220dc5e0c9fa3233d657fb 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1101,5 +1101,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1100,5 +1100,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { Location origin = getHandle().origin; return origin == null ? null : origin.clone(); } diff --git a/Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch b/Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch index ce97598407..d2e2d839c7 100644 --- a/Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch +++ b/Spigot-Server-Patches/0157-Improve-the-Saddle-API-for-Horses.patch @@ -7,10 +7,10 @@ Not all horses with Saddles have armor. This lets us break up the horses with sa and access their saddle state separately from an interface shared with Armor. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -index 339656c623a5af7fbf1a7e81952dec1dd3c18205..8c59b9ce12d4148b209c3824d44f6e9c736de16c 100644 +index 00b97d9ee7a3dd622c87e8efa288795d34db8fc7..62ccef35e4b4238c50faf778fbf3ea9a494ca387 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractHorse.java -@@ -6,6 +6,7 @@ import net.minecraft.server.GenericAttributes; +@@ -6,6 +6,7 @@ import net.minecraft.world.entity.animal.horse.EntityHorseAbstract; import org.apache.commons.lang.Validate; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.inventory.CraftInventoryAbstractHorse; @@ -27,10 +27,10 @@ index 339656c623a5af7fbf1a7e81952dec1dd3c18205..8c59b9ce12d4148b209c3824d44f6e9c } } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java -index 63991bf4be23cddd3f3e1082aa5e5513ff0e4e44..9a47a1adc1dd21f4409609c8c73e8b0e2434c176 100644 +index c3599b29c0b32d6fcf18a4a0adfbe8454c37834d..0389d15f8e0b6bb68316eaed0cf91acab8951cc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventoryHorse.java -@@ -4,7 +4,7 @@ import net.minecraft.server.IInventory; +@@ -4,7 +4,7 @@ import net.minecraft.world.IInventory; import org.bukkit.inventory.HorseInventory; import org.bukkit.inventory.ItemStack; diff --git a/Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch b/Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch index dcd7d904c6..c77231c475 100644 --- a/Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch +++ b/Spigot-Server-Patches/0158-Implement-ensureServerConversions-API.patch @@ -7,11 +7,11 @@ This will take a Bukkit ItemStack and run it through any conversions a server pr to ensure it meets latest minecraft expectations. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index a50eb746b8774a089c39652d534920acf708b137..83fb73ccde7809c6f712af35400d607fcd791882 100644 +index 6d320bbe0c75cc0df504faacf0f7d24804b90d5f..6e748e57c4818e11ac6d4c693bc4f6e1e889f4f8 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -341,5 +341,11 @@ public final class CraftItemFactory implements ItemFactory { - final net.minecraft.server.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); + final net.minecraft.nbt.NBTTagCompound tag = CraftItemStack.asNMSCopy(item).getTag(); return net.kyori.adventure.text.event.HoverEvent.showItem(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowItem.of(item.getType().getKey(), item.getAmount(), io.papermc.paper.adventure.PaperAdventure.asBinaryTagHolder(tag)))); } + diff --git a/Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch b/Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch index 3e92b7e3a0..6dd63ca6ca 100644 --- a/Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch +++ b/Spigot-Server-Patches/0159-Implement-getI18NDisplayName.patch @@ -7,11 +7,11 @@ Gets the Display name as seen in the Client. Currently the server only supports the English language. To override this, You must replace the language file embedded in the server jar. -diff --git a/src/main/java/net/minecraft/server/LocaleLanguage.java b/src/main/java/net/minecraft/server/LocaleLanguage.java -index cc5b6512fa115f73800b6894a2d58107b6495e07..29d55483510d3644a1edd3a01d7314232c358ac6 100644 ---- a/src/main/java/net/minecraft/server/LocaleLanguage.java -+++ b/src/main/java/net/minecraft/server/LocaleLanguage.java -@@ -29,7 +29,7 @@ public abstract class LocaleLanguage { +diff --git a/src/main/java/net/minecraft/locale/LocaleLanguage.java b/src/main/java/net/minecraft/locale/LocaleLanguage.java +index 9b8d5e7e4c86a699e26b1b4d0b82e88887a44054..5218214225b50ac4059ab704086a457318e93e00 100644 +--- a/src/main/java/net/minecraft/locale/LocaleLanguage.java ++++ b/src/main/java/net/minecraft/locale/LocaleLanguage.java +@@ -30,7 +30,7 @@ public abstract class LocaleLanguage { private static LocaleLanguage c() { Builder builder = ImmutableMap.builder(); @@ -20,7 +20,7 @@ index cc5b6512fa115f73800b6894a2d58107b6495e07..29d55483510d3644a1edd3a01d731423 try { InputStream inputstream = LocaleLanguage.class.getResourceAsStream("/assets/minecraft/lang/en_us.json"); -@@ -86,10 +86,12 @@ public abstract class LocaleLanguage { +@@ -87,10 +87,12 @@ public abstract class LocaleLanguage { } @@ -34,7 +34,7 @@ index cc5b6512fa115f73800b6894a2d58107b6495e07..29d55483510d3644a1edd3a01d731423 public abstract boolean b(String s); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index 83fb73ccde7809c6f712af35400d607fcd791882..bf8a8cad248583c900eacfaf54e30f0a60e1dc54 100644 +index 6e748e57c4818e11ac6d4c693bc4f6e1e889f4f8..e6c818d32713d9fb0f02a46696bd8a5dabe2a3ae 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -347,5 +347,18 @@ public final class CraftItemFactory implements ItemFactory { @@ -44,7 +44,7 @@ index 83fb73ccde7809c6f712af35400d607fcd791882..bf8a8cad248583c900eacfaf54e30f0a + + @Override + public String getI18NDisplayName(ItemStack item) { -+ net.minecraft.server.ItemStack nms = null; ++ net.minecraft.world.item.ItemStack nms = null; + if (item instanceof CraftItemStack) { + nms = ((CraftItemStack) item).handle; + } @@ -52,7 +52,7 @@ index 83fb73ccde7809c6f712af35400d607fcd791882..bf8a8cad248583c900eacfaf54e30f0a + nms = CraftItemStack.asNMSCopy(item); + } + -+ return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; ++ return nms != null ? net.minecraft.locale.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; + } // Paper end } diff --git a/Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch b/Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch index bbc1f0ccae..6a85a2bdda 100644 --- a/Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch +++ b/Spigot-Server-Patches/0160-ProfileWhitelistVerifyEvent.patch @@ -4,11 +4,11 @@ Date: Mon, 3 Jul 2017 18:11:10 -0500 Subject: [PATCH] ProfileWhitelistVerifyEvent -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index a56f9a07472e9a56da12a096400e69bd0d0cd17f..2411832c96794f3c39a5e9083b20217880f773ff 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -539,9 +539,9 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 398fd08341eae503d53dcca42bbbd1c27c60cc17..41b63da42067397122897d23fd7fb0e517d7c552 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -614,9 +614,9 @@ public abstract class PlayerList { // return chatmessage; if (!gameprofilebanentry.hasExpired()) event.disallow(PlayerLoginEvent.Result.KICK_BANNED, PaperAdventure.asAdventure(chatmessage)); // Spigot // Paper - Adventure @@ -21,7 +21,7 @@ index a56f9a07472e9a56da12a096400e69bd0d0cd17f..2411832c96794f3c39a5e9083b202178 } else if (getIPBans().isBanned(socketaddress) && !getIPBans().get(socketaddress).hasExpired()) { IpBanEntry ipbanentry = this.l.get(socketaddress); -@@ -933,9 +933,25 @@ public abstract class PlayerList { +@@ -1008,9 +1008,25 @@ public abstract class PlayerList { this.server.getCommandDispatcher().a(entityplayer); } diff --git a/Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch b/Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch index c877511c62..e460482610 100644 --- a/Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch +++ b/Spigot-Server-Patches/0162-Ocelot-despawns-should-honor-nametags-and-leash.patch @@ -4,11 +4,11 @@ Date: Mon, 31 Jul 2017 01:54:40 -0500 Subject: [PATCH] Ocelot despawns should honor nametags and leash -diff --git a/src/main/java/net/minecraft/server/EntityOcelot.java b/src/main/java/net/minecraft/server/EntityOcelot.java -index c56369817a28ec2c1a82f869c40fc7cb8eeb49dd..7bd3fea6e0e478337c7f6400a941675eebba517b 100644 ---- a/src/main/java/net/minecraft/server/EntityOcelot.java -+++ b/src/main/java/net/minecraft/server/EntityOcelot.java -@@ -81,7 +81,7 @@ public class EntityOcelot extends EntityAnimal { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java b/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java +index b0296cef410aa5af42dcf89217dd8853f3800663..f3e9c73f28584bcccd6f82d8974eabe4b4a892fa 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityOcelot.java +@@ -128,7 +128,7 @@ public class EntityOcelot extends EntityAnimal { @Override public boolean isTypeNotPersistent(double d0) { diff --git a/Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch b/Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch index 91c5250462..442ca85737 100644 --- a/Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch +++ b/Spigot-Server-Patches/0163-Reset-spawner-timer-when-spawner-event-is-cancelled.patch @@ -4,11 +4,11 @@ Date: Mon, 31 Jul 2017 01:45:19 -0500 Subject: [PATCH] Reset spawner timer when spawner event is cancelled -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 8eb20c6b9a88d5d4056f91df1f496d3d35b473da..34ab03fce7ab5c7702234590ffc9ca7fec72a86a 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -144,6 +144,7 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index 43fcc001bb9815b352cb74af10290b2a4ccaa540..883c724fbb86a84ee903b5e7127f14726fe4cf24 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -161,6 +161,7 @@ public abstract class MobSpawnerAbstract { // Spigot End } entity.spawnedViaMobSpawner = true; // Paper @@ -16,7 +16,7 @@ index 8eb20c6b9a88d5d4056f91df1f496d3d35b473da..34ab03fce7ab5c7702234590ffc9ca7f // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { Entity vehicle = entity.getVehicle(); -@@ -167,7 +168,7 @@ public abstract class MobSpawnerAbstract { +@@ -184,7 +185,7 @@ public abstract class MobSpawnerAbstract { ((EntityInsentient) entity).doSpawnEffect(); } diff --git a/Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch b/Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch index afd09e16ae..69b6157444 100644 --- a/Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch +++ b/Spigot-Server-Patches/0164-Fix-MC-117075-TE-Unload-Lag-Spike.patch @@ -4,11 +4,11 @@ Date: Wed, 9 Aug 2017 17:51:22 -0500 Subject: [PATCH] Fix MC-117075: TE Unload Lag Spike -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f773c19d69ebcb75cf97b07fd015baf3d6e6cae8..f3ac45a5936c2fbf3b013bfbb904effed5241e15 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -673,7 +673,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index edc760be0a3e58d2a917b70337b24b67ec5c5c1e..651547aa823c6c922c1741dde99c0ccf153edf45 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -725,7 +725,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { gameprofilerfiller.enter("blockEntities"); timings.tileEntityTick.startTiming(); // Spigot if (!this.tileEntityListUnload.isEmpty()) { diff --git a/Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch b/Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch index d2ea26a429..98260be689 100644 --- a/Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch +++ b/Spigot-Server-Patches/0165-Allow-specifying-a-custom-authentication-servers-dow.patch @@ -26,11 +26,11 @@ index 48319aaf1c525c6fb7bdee5c2f570a0d056d4eae..52954fc3bf932cfc9d5ce63e3d3cace3 + authenticationServersDownKickMessage = Strings.emptyToNull(getString("messages.kick.authentication-servers-down", authenticationServersDownKickMessage)); + } } -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index a7b57185d337846d8f7b296b31665315d375ecd5..a8f155b7149d5702896375c7cae1c8c573543060 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -258,6 +258,10 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 651b84b3bba316407a217c941be4c20074c5bb90..5b96c69014dbfb8eb3e2ecf370ad69f2ffc31453 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -276,6 +276,10 @@ public class LoginListener implements PacketLoginInListener { LoginListener.this.i = LoginListener.this.a(gameprofile); LoginListener.this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; } else { diff --git a/Spigot-Server-Patches/0166-LivingEntity-setKiller.patch b/Spigot-Server-Patches/0166-LivingEntity-setKiller.patch index de8ce91db3..c55292a45e 100644 --- a/Spigot-Server-Patches/0166-LivingEntity-setKiller.patch +++ b/Spigot-Server-Patches/0166-LivingEntity-setKiller.patch @@ -4,11 +4,11 @@ Date: Mon, 31 Jul 2017 01:49:48 -0500 Subject: [PATCH] LivingEntity#setKiller -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2dfa2abf37994a72dfdfcc38e032626247b43fd7..67b5b28c6c082a616ae2114874cdb0969f95ab98 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -87,7 +87,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 3d6b8fd09c07e78c0d786dff9658eb0089f853cf..851aed157a233ab690a57e5736fa01beaff45b5c 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -180,7 +180,7 @@ public abstract class EntityLiving extends Entity { public float aE; @Nullable public EntityHuman killer; @@ -18,7 +18,7 @@ index 2dfa2abf37994a72dfdfcc38e032626247b43fd7..67b5b28c6c082a616ae2114874cdb096 protected int ticksFarFromPlayer; protected float aJ; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a81afaf47214dcb4452642a7e8f295eb94ca6501..e99e8e6f889edfa889619a12f9bfa4bfbde9a5a1 100644 +index c654026587bc9bf77b39f59a0c89991ac581da1e..49247437c91f1d8f24c2bf506d2de200758bad88 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -344,6 +344,16 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0170-Add-PlayerJumpEvent.patch b/Spigot-Server-Patches/0170-Add-PlayerJumpEvent.patch index aa775740fa..fd8b8658a3 100644 --- a/Spigot-Server-Patches/0170-Add-PlayerJumpEvent.patch +++ b/Spigot-Server-Patches/0170-Add-PlayerJumpEvent.patch @@ -4,11 +4,11 @@ Date: Thu, 28 Sep 2017 17:21:44 -0400 Subject: [PATCH] Add PlayerJumpEvent -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index b6f68a8d1eb523fa0e33fae717249bbba2c0715b..14f6df878beecdccd3036f60535fc36c0a3e5776 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1021,7 +1021,34 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 62fb502adf8cd7095e4826eb72ab39cf0bcc6d55..c096c461a2ffe8efdb02242f319a1612f7c2901d 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1166,7 +1166,34 @@ public class PlayerConnection implements PacketListenerPlayIn { boolean flag = d8 > 0.0D; if (this.player.isOnGround() && !packetplayinflying.b() && flag) { diff --git a/Spigot-Server-Patches/0171-handle-PacketPlayInKeepAlive-async.patch b/Spigot-Server-Patches/0171-handle-PacketPlayInKeepAlive-async.patch index 8dc9c40a29..a6326f5450 100644 --- a/Spigot-Server-Patches/0171-handle-PacketPlayInKeepAlive-async.patch +++ b/Spigot-Server-Patches/0171-handle-PacketPlayInKeepAlive-async.patch @@ -14,11 +14,11 @@ off the main thread. also adding some additional logging in order to help work out what is causing random disconnections for clients. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 3ee747ab2c43e6af78366f5cd8e35c0e09424d55..acbb1e013341fcf94109766bbbea542f072b4d9f 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2620,14 +2620,18 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index c096c461a2ffe8efdb02242f319a1612f7c2901d..9b0d00220406cf20421607ae234f4c0d674681bb 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2765,14 +2765,18 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInKeepAlive packetplayinkeepalive) { diff --git a/Spigot-Server-Patches/0172-Expose-client-protocol-version-and-virtual-host.patch b/Spigot-Server-Patches/0172-Expose-client-protocol-version-and-virtual-host.patch index f86bacdad2..00d813302a 100644 --- a/Spigot-Server-Patches/0172-Expose-client-protocol-version-and-virtual-host.patch +++ b/Spigot-Server-Patches/0172-Expose-client-protocol-version-and-virtual-host.patch @@ -60,26 +60,11 @@ index 0000000000000000000000000000000000000000..5caca6439d2135e34880d501397fe2ea + } + +} -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index bad5d4f165d1e469ed583b036f78e467b94691fd..89a83253c99c387e1c91c434952c549d598b11aa 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -134,6 +134,10 @@ public class HandshakeListener implements PacketHandshakingInListener { - throw new UnsupportedOperationException("Invalid intention " + packethandshakinginsetprotocol.b()); - } - -+ // Paper start - NetworkClient implementation -+ this.getNetworkManager().protocolVersion = packethandshakinginsetprotocol.getProtocolVersion(); -+ this.getNetworkManager().virtualHost = com.destroystokyo.paper.network.PaperNetworkClient.prepareVirtualHost(packethandshakinginsetprotocol.hostname, packethandshakinginsetprotocol.port); -+ // Paper end - } - - @Override -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 6034f0cf5a22adb8441226cd54c519e41c198f6f..1b11b4a8d26bd174b0c6f97225555eb585f67836 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -60,6 +60,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index f093b465b868e6003bb2b5ee634a624b5b054493..60e4a4aa3854aaeb250d1318f2f25cf3591ea1d3 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -70,6 +70,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { private float s; private int t; private boolean u; @@ -90,11 +75,11 @@ index 6034f0cf5a22adb8441226cd54c519e41c198f6f..1b11b4a8d26bd174b0c6f97225555eb5 public NetworkManager(EnumProtocolDirection enumprotocoldirection) { this.h = enumprotocoldirection; -diff --git a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -index 4f008e4723d2cb0bcabb2d5621203d63c40c4923..8545146fb1f093f821e3b966d9337049575c6773 100644 ---- a/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -+++ b/src/main/java/net/minecraft/server/PacketHandshakingInSetProtocol.java -@@ -35,6 +35,7 @@ public class PacketHandshakingInSetProtocol implements Packet= 30 ? 112 + (this.expLevel - 30) * 9 : (this.expLevel >= 15 ? 37 + (this.expLevel - 15) * 5 : 7 + this.expLevel * 2); } diff --git a/Spigot-Server-Patches/0176-Add-PlayerArmorChangeEvent.patch b/Spigot-Server-Patches/0176-Add-PlayerArmorChangeEvent.patch index 3f4d7637fb..4fceab56e8 100644 --- a/Spigot-Server-Patches/0176-Add-PlayerArmorChangeEvent.patch +++ b/Spigot-Server-Patches/0176-Add-PlayerArmorChangeEvent.patch @@ -4,18 +4,18 @@ Date: Fri, 10 Nov 2017 23:46:34 -0500 Subject: [PATCH] Add PlayerArmorChangeEvent -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 67b5b28c6c082a616ae2114874cdb0969f95ab98..087d961cb51dc3c9b24cf6e1785252c2c0afb296 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 851aed157a233ab690a57e5736fa01beaff45b5c..1dcdf9e328670b42d656e8ab65cb3da8a2312fe6 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.world.entity; +import com.destroystokyo.paper.event.player.PlayerArmorChangeEvent; // Paper import com.google.common.base.Objects; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; -@@ -2553,6 +2554,13 @@ public abstract class EntityLiving extends Entity { +@@ -2646,6 +2647,13 @@ public abstract class EntityLiving extends Entity { ItemStack itemstack1 = this.getEquipment(enumitemslot); if (!ItemStack.matches(itemstack1, itemstack)) { @@ -29,10 +29,10 @@ index 67b5b28c6c082a616ae2114874cdb0969f95ab98..087d961cb51dc3c9b24cf6e1785252c2 if (map == null) { map = Maps.newEnumMap(EnumItemSlot.class); } -diff --git a/src/main/java/net/minecraft/server/EnumItemSlot.java b/src/main/java/net/minecraft/server/EnumItemSlot.java -index 8862603d40ae6048345ef4cf34016c96fa12f76e..3ad9b3e69ef0ed8ad8eebcb323024670ce7599d1 100644 ---- a/src/main/java/net/minecraft/server/EnumItemSlot.java -+++ b/src/main/java/net/minecraft/server/EnumItemSlot.java +diff --git a/src/main/java/net/minecraft/world/entity/EnumItemSlot.java b/src/main/java/net/minecraft/world/entity/EnumItemSlot.java +index 8e7673c6072c3f8ddcebd7a719304ea41d809a36..59ad7d8dc1c8ee00d142dc6063c3416ccdce4ff8 100644 +--- a/src/main/java/net/minecraft/world/entity/EnumItemSlot.java ++++ b/src/main/java/net/minecraft/world/entity/EnumItemSlot.java @@ -16,6 +16,7 @@ public enum EnumItemSlot { this.j = s; } diff --git a/Spigot-Server-Patches/0177-Prevent-logins-from-being-processed-when-the-player-.patch b/Spigot-Server-Patches/0177-Prevent-logins-from-being-processed-when-the-player-.patch index 65dd6ff822..e619c605b1 100644 --- a/Spigot-Server-Patches/0177-Prevent-logins-from-being-processed-when-the-player-.patch +++ b/Spigot-Server-Patches/0177-Prevent-logins-from-being-processed-when-the-player-.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent logins from being processed when the player has disconnected -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index a8f155b7149d5702896375c7cae1c8c573543060..144df45865105a65ed87053935878b3f12146f4a 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -57,7 +57,11 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 5b96c69014dbfb8eb3e2ecf370ad69f2ffc31453..714f44a668eb35b3c61bb9ab140f884917efd6f5 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -75,7 +75,11 @@ public class LoginListener implements PacketLoginInListener { } // Paper end if (this.g == LoginListener.EnumProtocolState.READY_TO_ACCEPT) { diff --git a/Spigot-Server-Patches/0178-use-CB-BlockState-implementations-for-captured-block.patch b/Spigot-Server-Patches/0178-use-CB-BlockState-implementations-for-captured-block.patch index 64b878b6dc..e09185cdf5 100644 --- a/Spigot-Server-Patches/0178-use-CB-BlockState-implementations-for-captured-block.patch +++ b/Spigot-Server-Patches/0178-use-CB-BlockState-implementations-for-captured-block.patch @@ -17,11 +17,11 @@ By using CBs CraftBlock#getState(), we will maintain a proper copy of the blockstate that will be valid for restoration, as opposed to dropping information on restoration when the event is cancelled. -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f3ac45a5936c2fbf3b013bfbb904effed5241e15..33444cd8aec8ce39fb4fef232909cd42ef036d54 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -71,7 +71,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 651547aa823c6c922c1741dde99c0ccf153edf45..f7df55cf3da909c253bab106cdb7149ee9c297d9 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -123,7 +123,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; @@ -30,7 +30,7 @@ index f3ac45a5936c2fbf3b013bfbb904effed5241e15..33444cd8aec8ce39fb4fef232909cd42 public Map capturedTileEntities = new HashMap<>(); public List captureDrops; public long ticksPerAnimalSpawns; -@@ -293,7 +293,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -345,7 +345,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { // CraftBukkit start - tree generation if (this.captureTreeGeneration) { @@ -39,7 +39,7 @@ index f3ac45a5936c2fbf3b013bfbb904effed5241e15..33444cd8aec8ce39fb4fef232909cd42 if (blockstate == null) { blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); -@@ -313,7 +313,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -365,7 +365,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // CraftBukkit start - capture blockstates boolean captured = false; if (this.captureBlockStates && !this.capturedBlockStates.containsKey(blockposition)) { @@ -49,7 +49,7 @@ index f3ac45a5936c2fbf3b013bfbb904effed5241e15..33444cd8aec8ce39fb4fef232909cd42 this.capturedBlockStates.put(blockposition.immutableCopy(), blockstate); captured = true; } -@@ -571,7 +572,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -623,7 +624,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public IBlockData getType(BlockPosition blockposition) { // CraftBukkit start - tree generation if (captureTreeGeneration) { diff --git a/Spigot-Server-Patches/0179-API-to-get-a-BlockState-without-a-snapshot.patch b/Spigot-Server-Patches/0179-API-to-get-a-BlockState-without-a-snapshot.patch index 36e9ac0f45..d3a67e52c0 100644 --- a/Spigot-Server-Patches/0179-API-to-get-a-BlockState-without-a-snapshot.patch +++ b/Spigot-Server-Patches/0179-API-to-get-a-BlockState-without-a-snapshot.patch @@ -12,11 +12,11 @@ also Avoid NPE during CraftBlockEntityState load if could not get TE If Tile Entity was null, correct Sign to return empty lines instead of null -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index 524f84ad2c50f8b837eefd0465901b1e22359410..c6ae3d3f9d7957d4bbe0b4e2613558e5cd9dd9ec 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -36,6 +36,7 @@ public abstract class TileEntity implements KeyedObject { // Paper +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 2e1ce36fedac351f4320c6379ce73f8ffb0f5918..642ed6e5788a79f7bc7d6185564bdf0df07e492c 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -46,6 +46,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public TileEntity(TileEntityTypes tileentitytypes) { this.position = BlockPosition.ZERO; this.tileType = tileentitytypes; @@ -24,16 +24,16 @@ index 524f84ad2c50f8b837eefd0465901b1e22359410..c6ae3d3f9d7957d4bbe0b4e2613558e5 } // Paper start -@@ -84,7 +85,7 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -94,7 +95,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { this.position = new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")); // CraftBukkit start - read container - this.persistentDataContainer = new CraftPersistentDataContainer(DATA_TYPE_REGISTRY); + this.persistentDataContainer.clear(); // Paper - clear instead of reinit - NBTBase persistentDataTag = nbttagcompound.get("PublicBukkitValues"); + net.minecraft.nbt.NBTBase persistentDataTag = nbttagcompound.get("PublicBukkitValues"); if (persistentDataTag instanceof NBTTagCompound) { -@@ -234,7 +235,12 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -244,7 +245,12 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / } // CraftBukkit start - add method @@ -46,7 +46,7 @@ index 524f84ad2c50f8b837eefd0465901b1e22359410..c6ae3d3f9d7957d4bbe0b4e2613558e5 if (world == null) return null; // Spigot start org.bukkit.block.Block block = world.getWorld().getBlockAt(position.getX(), position.getY(), position.getZ()); -@@ -243,7 +249,7 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -253,7 +259,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / return null; } // Spigot end @@ -56,7 +56,7 @@ index 524f84ad2c50f8b837eefd0465901b1e22359410..c6ae3d3f9d7957d4bbe0b4e2613558e5 return null; } diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 5de8463c94612edd11e02ac5d9757382c9598e7d..661bb54c27966c8050644b293d99dfe86e3c04ce 100644 +index 7654c0f8b57785225ecaa0c22e34c92f1d058d21..e4fe55bb830cd43680de9d61652448b1ea879063 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -316,6 +316,20 @@ public class CraftBlock implements Block { @@ -81,7 +81,7 @@ index 5de8463c94612edd11e02ac5d9757382c9598e7d..661bb54c27966c8050644b293d99dfe8 switch (material) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java -index 8a7e9302b4b6be086144add8df610b76b58e00d6..cca1c2ca5c1fe91fda30ace6f06a343b7850842e 100644 +index dcf3f9265b0b00a7bbb9ff428e10da3c198ba08a..2f0b48869077c27d0cacea81a99c9e34ff59c684 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockEntityState.java @@ -26,20 +26,40 @@ public class CraftBlockEntityState extends CraftBlockState @@ -131,7 +131,7 @@ index 8a7e9302b4b6be086144add8df610b76b58e00d6..cca1c2ca5c1fe91fda30ace6f06a343b private T createSnapshot(T tileEntity) { diff --git a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java -index 58e2db5da178af6a8c30f563353fefe720ff9781..b704f550de290e0bc1235bf7e68c7eb347162c69 100644 +index f342feee4e2274cdc51fef6caace52cc31eefb18..a4c888236bf09a25f234831a041ca5a4a2c972ef 100644 --- a/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java +++ b/src/main/java/org/bukkit/craftbukkit/persistence/CraftPersistentDataContainer.java @@ -155,4 +155,10 @@ public final class CraftPersistentDataContainer implements PersistentDataContain diff --git a/Spigot-Server-Patches/0180-AsyncTabCompleteEvent.patch b/Spigot-Server-Patches/0180-AsyncTabCompleteEvent.patch index bc5b3b4bfd..4f0e4c6fab 100644 --- a/Spigot-Server-Patches/0180-AsyncTabCompleteEvent.patch +++ b/Spigot-Server-Patches/0180-AsyncTabCompleteEvent.patch @@ -13,11 +13,11 @@ completion, such as offline players. Also adds isCommand and getLocation to the sync TabCompleteEvent -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1b1de63c405a1e9a62787be11ac1ee3029ffc828..297593d412706e3ea583ac9bbd5c9e15b711d312 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -566,10 +566,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 54a5b988e5dc8eec35cf91d45f282926d81a0043..cbffc7e1cf7ca7597517cdae12ec9be5efe97217 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -711,10 +711,10 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInTabComplete packetplayintabcomplete) { @@ -30,7 +30,7 @@ index 1b1de63c405a1e9a62787be11ac1ee3029ffc828..297593d412706e3ea583ac9bbd5c9e15 return; } // CraftBukkit end -@@ -579,12 +579,35 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -724,12 +724,35 @@ public class PlayerConnection implements PacketListenerPlayIn { stringreader.skip(); } @@ -72,7 +72,7 @@ index 1b1de63c405a1e9a62787be11ac1ee3029ffc828..297593d412706e3ea583ac9bbd5c9e15 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 01cd09eae054de89dfa910980974e12d6350eae5..7d470b42e6aca9539b102c189c7a2fd848995d55 100644 +index 7d2fc05ddb18369aed29595e3c0dcbf6db136309..f1d4e2ac2823e2246463350b21f28c6d32f4f2c5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1844,7 +1844,7 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/0181-Avoid-NPE-in-PathfinderGoalTempt.patch b/Spigot-Server-Patches/0181-Avoid-NPE-in-PathfinderGoalTempt.patch index d6a7fa4bbb..22279d4515 100644 --- a/Spigot-Server-Patches/0181-Avoid-NPE-in-PathfinderGoalTempt.patch +++ b/Spigot-Server-Patches/0181-Avoid-NPE-in-PathfinderGoalTempt.patch @@ -4,11 +4,11 @@ Date: Wed, 29 Nov 2017 22:18:54 -0500 Subject: [PATCH] Avoid NPE in PathfinderGoalTempt -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -index 87a20538dd1e056d7412154473863628a7fdefe2..582ea29068de07edce73ab1a55d3ae7373650e16 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalTempt.java -@@ -56,7 +56,7 @@ public class PathfinderGoalTempt extends PathfinderGoal { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java +index 54b345b5d2fc8d3c511533281f6d387f046f8000..9a120ab9c5c6c858bf3d1690196fe657e76cc1b7 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTempt.java +@@ -65,7 +65,7 @@ public class PathfinderGoalTempt extends PathfinderGoal { } this.target = (event.getTarget() == null) ? null : ((CraftLivingEntity) event.getTarget()).getHandle(); } diff --git a/Spigot-Server-Patches/0182-PlayerPickupExperienceEvent.patch b/Spigot-Server-Patches/0182-PlayerPickupExperienceEvent.patch index b145f44e7b..230e7015b9 100644 --- a/Spigot-Server-Patches/0182-PlayerPickupExperienceEvent.patch +++ b/Spigot-Server-Patches/0182-PlayerPickupExperienceEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] PlayerPickupExperienceEvent Allows plugins to cancel a player picking up an experience orb -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 701d015baf03eba07b319baf447b5ae06ab8accd..e7b20e2c07426d156fa819ed2e23e29d6a71d499 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -218,7 +218,7 @@ public class EntityExperienceOrb extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +index f4da22b33c704e675510b4b1a3aa7c180088be29..1fd4bd03463a76e838d1aaa8e6f16f7a42f96fa7 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +@@ -232,7 +232,7 @@ public class EntityExperienceOrb extends Entity { @Override public void pickup(EntityHuman entityhuman) { if (!this.world.isClientSide) { diff --git a/Spigot-Server-Patches/0184-Ability-to-apply-mending-to-XP-API.patch b/Spigot-Server-Patches/0184-Ability-to-apply-mending-to-XP-API.patch index 1075698211..94cff50e24 100644 --- a/Spigot-Server-Patches/0184-Ability-to-apply-mending-to-XP-API.patch +++ b/Spigot-Server-Patches/0184-Ability-to-apply-mending-to-XP-API.patch @@ -9,26 +9,11 @@ of giving the player experience points. Both an API To standalone mend, and apply mending logic to .giveExp has been added. -diff --git a/src/main/java/net/minecraft/server/EnchantmentManager.java b/src/main/java/net/minecraft/server/EnchantmentManager.java -index ff56d7b045d7d93419a5f2f35df70b3644ac55b0..7b263594304a9b745f583fe7178ac16936cbd93b 100644 ---- a/src/main/java/net/minecraft/server/EnchantmentManager.java -+++ b/src/main/java/net/minecraft/server/EnchantmentManager.java -@@ -251,8 +251,8 @@ public class EnchantmentManager { - return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; - } - -- @Nullable -- public static Entry b(Enchantment enchantment, EntityLiving entityliving) { -+ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { Entry entry = b(enchantment, entityliving); return entry != null ? entry.getValue() : ItemStack.NULL_ITEM; } // Paper - OBFHELPER -+ @Nullable public static Entry b(Enchantment enchantment, EntityLiving entityliving) { - return a(enchantment, entityliving, (itemstack) -> { - return true; - }); -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index e7b20e2c07426d156fa819ed2e23e29d6a71d499..837a2c8f6af6e51316511e3948869ac059c8fc0d 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -250,10 +250,12 @@ public class EntityExperienceOrb extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +index 1fd4bd03463a76e838d1aaa8e6f16f7a42f96fa7..dc257a7cafc4b728aa5c99ca332143bb05896d7e 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +@@ -264,10 +264,12 @@ public class EntityExperienceOrb extends Entity { } } @@ -41,8 +26,23 @@ index e7b20e2c07426d156fa819ed2e23e29d6a71d499..837a2c8f6af6e51316511e3948869ac0 private int c(int i) { return i * 2; } +diff --git a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java +index d313b02f41e4f4a90676cbb37afce4e92dd4d664..72afbf8f537770540e90a2880ea81de137ea10f5 100644 +--- a/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java ++++ b/src/main/java/net/minecraft/world/item/enchantment/EnchantmentManager.java +@@ -269,8 +269,8 @@ public class EnchantmentManager { + return getEnchantmentLevel(Enchantments.CHANNELING, itemstack) > 0; + } + +- @Nullable +- public static Entry b(Enchantment enchantment, EntityLiving entityliving) { ++ public static @javax.annotation.Nonnull ItemStack getRandomEquippedItemWithEnchant(Enchantment enchantment, EntityLiving entityliving) { Entry entry = b(enchantment, entityliving); return entry != null ? entry.getValue() : ItemStack.NULL_ITEM; } // Paper - OBFHELPER ++ @Nullable public static Entry b(Enchantment enchantment, EntityLiving entityliving) { + return a(enchantment, entityliving, (itemstack) -> { + return true; + }); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9cd82ca462d4ae88c2cbcd96e6f0660288be5208..1e3794c3e6bf43c3cc2708c4c8c1f816867a3a09 100644 +index cf9ae60db30ef09bb4c89935a42632e562b6d61e..f8780db8f376ee71a35ebe1c2ab84a6117d0d74e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1180,8 +1180,37 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0185-Make-max-squid-spawn-height-configurable.patch b/Spigot-Server-Patches/0185-Make-max-squid-spawn-height-configurable.patch index 8a80a6b0cd..5de8db480c 100644 --- a/Spigot-Server-Patches/0185-Make-max-squid-spawn-height-configurable.patch +++ b/Spigot-Server-Patches/0185-Make-max-squid-spawn-height-configurable.patch @@ -20,11 +20,11 @@ index 6c692e58cde22003ecbf6dc5695799147c39905a..3c39f1bb3d88baaaed4dd43c51faeef8 + squidMaxSpawnHeight = getDouble("squid-spawn-height.maximum", 0.0D); + } } -diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 77b48d03caea9eb8f70792c3e1cae457a2885c81..050c4bdac8519250157b77c3221c99bd49e53a22 100644 ---- a/src/main/java/net/minecraft/server/EntitySquid.java -+++ b/src/main/java/net/minecraft/server/EntitySquid.java -@@ -169,7 +169,8 @@ public class EntitySquid extends EntityWaterAnimal { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java +index f1eb2d7d226048bd02e091a376461fd7099d676e..2d9ac7baa924e6558727d58d43dbf6667f4f84a9 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java +@@ -195,7 +195,8 @@ public class EntitySquid extends EntityWaterAnimal { } public static boolean b(EntityTypes entitytypes, GeneratorAccess generatoraccess, EnumMobSpawn enummobspawn, BlockPosition blockposition, Random random) { diff --git a/Spigot-Server-Patches/0186-PreCreatureSpawnEvent.patch b/Spigot-Server-Patches/0186-PreCreatureSpawnEvent.patch index 2fb57ddbd0..c47e756086 100644 --- a/Spigot-Server-Patches/0186-PreCreatureSpawnEvent.patch +++ b/Spigot-Server-Patches/0186-PreCreatureSpawnEvent.patch @@ -14,11 +14,11 @@ instead and save a lot of server resources. See: https://github.com/PaperMC/Paper/issues/917 -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index b1fe488e41a2c9f77df091e1d14ed5c87a4358c8..14f47d100c3f44a8263c9b907e9ca74944676687 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -187,6 +187,20 @@ public class EntityTypes { +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index a707ba365e25ea15e2e9d22110696b6136aa0c6f..8ba75c847efa0633e7b8cb718e3a9b55e0b8ad77 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -317,6 +317,20 @@ public class EntityTypes { @Nullable public T spawnCreature(WorldServer worldserver, @Nullable NBTTagCompound nbttagcompound, @Nullable IChatBaseComponent ichatbasecomponent, @Nullable EntityHuman entityhuman, BlockPosition blockposition, EnumMobSpawn enummobspawn, boolean flag, boolean flag1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason spawnReason) { @@ -39,11 +39,32 @@ index b1fe488e41a2c9f77df091e1d14ed5c87a4358c8..14f47d100c3f44a8263c9b907e9ca749 T t0 = this.createCreature(worldserver, nbttagcompound, ichatbasecomponent, entityhuman, blockposition, enummobspawn, flag, flag1); if (t0 != null) { -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 768dfbc58510e8599f05a5bba25558141124e531..3a6992a5763238996847a8e59b650606a384e4ff 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -866,6 +866,21 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java +index 41f1aecbf6b506231a1b3b525fe0ce23b35c7840..6c01e460d3a1ff7f865ebc34dfd28d55b16aab98 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorGolemLastSeen.java +@@ -33,7 +33,7 @@ public class SensorGolemLastSeen extends Sensor { + Optional> optional = entityliving.getBehaviorController().getMemory(MemoryModuleType.MOBS); + + if (optional.isPresent()) { +- boolean flag = ((List) optional.get()).stream().anyMatch((entityliving1) -> { ++ boolean flag = optional.get().stream().anyMatch((entityliving1) -> { // Paper - decompile fixes + return entityliving1.getEntityType().equals(EntityTypes.IRON_GOLEM); + }); + +@@ -44,6 +44,7 @@ public class SensorGolemLastSeen extends Sensor { + } + } + ++ public static void setDetectedRecently(EntityLiving entityLiving) { b(entityLiving); } // Paper - OBFHELPER + public static void b(EntityLiving entityliving) { + entityliving.getBehaviorController().a(MemoryModuleType.GOLEM_DETECTED_RECENTLY, true, 600L); + } +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index adce6f17a5dd33004f8a67cd55d195de029e0263..d1afbfc4458c76a35b9be124f1e09c3b82501798 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -936,6 +936,21 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation BlockPosition blockposition1 = this.a(blockposition, d0, d1); if (blockposition1 != null) { @@ -65,11 +86,11 @@ index 768dfbc58510e8599f05a5bba25558141124e531..3a6992a5763238996847a8e59b650606 EntityIronGolem entityirongolem = (EntityIronGolem) EntityTypes.IRON_GOLEM.createCreature(worldserver, (NBTTagCompound) null, (IChatBaseComponent) null, (EntityHuman) null, blockposition1, EnumMobSpawn.MOB_SUMMONED, false, false); if (entityirongolem != null) { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 34ab03fce7ab5c7702234590ffc9ca7fec72a86a..2827026ba4bdd857f231028393726d6c95610072 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -108,6 +108,27 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index 883c724fbb86a84ee903b5e7127f14726fe4cf24..79339bcbe15e5b3a409148245c68bbff3a59f59f 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -125,6 +125,27 @@ public abstract class MobSpawnerAbstract { WorldServer worldserver = (WorldServer) world; if (EntityPositionTypes.a((EntityTypes) optional.get(), worldserver, EnumMobSpawn.SPAWNER, new BlockPosition(d3, d4, d5), world.getRandom())) { @@ -97,32 +118,11 @@ index 34ab03fce7ab5c7702234590ffc9ca7fec72a86a..2827026ba4bdd857f231028393726d6c Entity entity = EntityTypes.a(nbttagcompound, world, (entity1) -> { entity1.setPositionRotation(d3, d4, d5, entity1.yaw, entity1.pitch); return entity1; -diff --git a/src/main/java/net/minecraft/server/SensorGolemLastSeen.java b/src/main/java/net/minecraft/server/SensorGolemLastSeen.java -index 008932fafece5a62541b94444d56ab717c4d103f..f8727f7b3f146ae023c64ace4919d150c31a1ac3 100644 ---- a/src/main/java/net/minecraft/server/SensorGolemLastSeen.java -+++ b/src/main/java/net/minecraft/server/SensorGolemLastSeen.java -@@ -29,7 +29,7 @@ public class SensorGolemLastSeen extends Sensor { - Optional> optional = entityliving.getBehaviorController().getMemory(MemoryModuleType.MOBS); - - if (optional.isPresent()) { -- boolean flag = ((List) optional.get()).stream().anyMatch((entityliving1) -> { -+ boolean flag = optional.get().stream().anyMatch((entityliving1) -> { // Paper - decompile fixes - return entityliving1.getEntityType().equals(EntityTypes.IRON_GOLEM); - }); - -@@ -40,6 +40,7 @@ public class SensorGolemLastSeen extends Sensor { - } - } - -+ public static void setDetectedRecently(EntityLiving entityLiving) { b(entityLiving); } // Paper - OBFHELPER - public static void b(EntityLiving entityliving) { - entityliving.getBehaviorController().a(MemoryModuleType.GOLEM_DETECTED_RECENTLY, true, 600L); - } -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 137ee1b453b80e96c1a8fa3271f6350f9294cafb..0ecdfd45073235b7b01e84f4490f17088c4ee675 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -184,9 +184,16 @@ public final class SpawnerCreature { +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +index fd0595fd584046326eccacdf0a6afe40c5e84eed..9a039ce12879baf8088c2ccaf0af61109efb7d74 100644 +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +@@ -216,9 +216,16 @@ public final class SpawnerCreature { j1 = biomesettingsmobs_c.d + worldserver.random.nextInt(1 + biomesettingsmobs_c.e - biomesettingsmobs_c.d); } @@ -140,7 +140,7 @@ index 137ee1b453b80e96c1a8fa3271f6350f9294cafb..0ecdfd45073235b7b01e84f4490f1708 if (entityinsentient == null) { return; } -@@ -239,8 +246,24 @@ public final class SpawnerCreature { +@@ -271,8 +278,24 @@ public final class SpawnerCreature { } } diff --git a/Spigot-Server-Patches/0187-PlayerNaturallySpawnCreaturesEvent.patch b/Spigot-Server-Patches/0187-PlayerNaturallySpawnCreaturesEvent.patch index 6f9b9052ac..a83c094247 100644 --- a/Spigot-Server-Patches/0187-PlayerNaturallySpawnCreaturesEvent.patch +++ b/Spigot-Server-Patches/0187-PlayerNaturallySpawnCreaturesEvent.patch @@ -8,11 +8,11 @@ from triggering monster spawns on a server. Also a highly more effecient way to blanket block spawns in a world -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index a066026bce318683dcc022920dad39d7ec25e485..8017953af1df6c046a47ebe655e5d1afa68d50f8 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -589,6 +589,15 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 95af66ebb7849cbf2bcad6bc52aeb85ab2601b6c..eb576566708d50c002e73aa746d2bc58b9b04c2b 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -611,6 +611,15 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper //Collections.shuffle(list); // Paper @@ -28,18 +28,18 @@ index a066026bce318683dcc022920dad39d7ec25e485..8017953af1df6c046a47ebe655e5d1af this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 7a9e237d23051b43fe0ac3720cd6a36faabc9dd2..42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index afa87cf70ad978161853771c59f5a4906733cab3..8b79d547a3296f056731cbb66508494d84809e94 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.server.level; +import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent; import com.google.common.collect.Lists; import com.mojang.authlib.GameProfile; import com.mojang.datafixers.util.Either; -@@ -100,6 +101,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -227,6 +228,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean sentListPacket = false; public Integer clientViewDistance; // CraftBukkit end @@ -47,11 +47,11 @@ index 7a9e237d23051b43fe0ac3720cd6a36faabc9dd2..42bf31bd9569a8f1c2b36f1c3a2c5c0d public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 02a516ddabda08db33c94cce2d19d9e77666e074..8bfa412b0d3f881f694abec89101e15aa2d00bb7 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -913,12 +913,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 146227ecfe654c36da958ddc2cfb9b67738de4a0..88e7fe1d50e644a107aa76c84b7fd1b9b43cd94b 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -957,12 +957,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { chunkRange = (chunkRange > world.spigotConfig.viewDistance) ? (byte) world.spigotConfig.viewDistance : chunkRange; chunkRange = (chunkRange > 8) ? 8 : chunkRange; diff --git a/Spigot-Server-Patches/0188-Add-setPlayerProfile-API-for-Skulls.patch b/Spigot-Server-Patches/0188-Add-setPlayerProfile-API-for-Skulls.patch index 5de7f8f924..da897bd972 100644 --- a/Spigot-Server-Patches/0188-Add-setPlayerProfile-API-for-Skulls.patch +++ b/Spigot-Server-Patches/0188-Add-setPlayerProfile-API-for-Skulls.patch @@ -7,7 +7,7 @@ This allows you to create already filled textures on Skulls to avoid texture loo which commonly cause rate limit issues with Mojang API diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java -index 20588598386a4f479e6a58b294149bed789c63ce..ecc32c2fb1e8e1ac03074102b982adb4cda169db 100644 +index 80ee7ab69ff70431d51321d403e5e3400a24bd67..00fb749f4d181d8d830496cf741d589e10af5098 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftSkull.java @@ -1,5 +1,7 @@ @@ -48,18 +48,18 @@ index 20588598386a4f479e6a58b294149bed789c63ce..ecc32c2fb1e8e1ac03074102b982adb4 public BlockFace getRotation() { BlockData blockData = getBlockData(); diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -index 58aeeff96a92b5ba0c3435c680885ad3bc4f4ce6..fba6c1f454fdee3541393e6803d7249cf1fbe6d2 100644 +index 8298ae9bf1c5635f08552c15f004b3d0f6e9f19b..6db0d35eba647a0e81ca464fa52dc4a404ddd2ab 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSkull.java -@@ -4,6 +4,8 @@ import com.google.common.collect.ImmutableMap.Builder; - import com.mojang.authlib.GameProfile; - import java.util.Map; - import java.util.UUID; +@@ -8,6 +8,8 @@ import net.minecraft.nbt.GameProfileSerializer; + import net.minecraft.nbt.NBTBase; + import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.world.level.block.entity.TileEntitySkull; +import com.destroystokyo.paper.profile.CraftPlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile; - import net.minecraft.server.GameProfileSerializer; - import net.minecraft.server.NBTBase; - import net.minecraft.server.NBTTagCompound; + import org.bukkit.Bukkit; + import org.bukkit.Material; + import org.bukkit.OfflinePlayer; @@ -18,6 +20,7 @@ import org.bukkit.craftbukkit.inventory.CraftMetaItem.SerializableMeta; import org.bukkit.craftbukkit.util.CraftMagicNumbers; import org.bukkit.inventory.meta.SkullMeta; @@ -88,3 +88,12 @@ index 58aeeff96a92b5ba0c3435c680885ad3bc4f4ce6..fba6c1f454fdee3541393e6803d7249c @Override public OfflinePlayer getOwningPlayer() { if (hasOwner()) { +@@ -175,7 +191,7 @@ class CraftMetaSkull extends CraftMetaItem implements SkullMeta { + } else { + // Paper start - Use Online Players Skull + GameProfile newProfile = null; +- net.minecraft.server.EntityPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayer(name); ++ net.minecraft.server.level.EntityPlayer player = net.minecraft.server.MinecraftServer.getServer().getPlayerList().getPlayer(name); + if (player != null) newProfile = player.getProfile(); + if (newProfile == null) newProfile = new GameProfile(null, name); + setProfile(newProfile); diff --git a/Spigot-Server-Patches/0190-PlayerAdvancementCriterionGrantEvent.patch b/Spigot-Server-Patches/0190-PlayerAdvancementCriterionGrantEvent.patch index 28973e775a..e919ba3032 100644 --- a/Spigot-Server-Patches/0190-PlayerAdvancementCriterionGrantEvent.patch +++ b/Spigot-Server-Patches/0190-PlayerAdvancementCriterionGrantEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] PlayerAdvancementCriterionGrantEvent diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index 12fc641299342a317177cf0ab876186fb8a2b760..57b9d13447a4f7804827c1bd41121c3069c696bd 100644 +index d832cc2f3cc1ee73299a7f07eb2ccc3d392d5cf8..7d37626277823d5db05189c20bb1ebf91aa2a286 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -279,6 +279,12 @@ public class AdvancementDataPlayer { +@@ -297,6 +297,12 @@ public class AdvancementDataPlayer { boolean flag1 = advancementprogress.isDone(); if (advancementprogress.a(s)) { diff --git a/Spigot-Server-Patches/0191-Add-ArmorStand-Item-Meta.patch b/Spigot-Server-Patches/0191-Add-ArmorStand-Item-Meta.patch index fdc75039ff..658b0384d9 100644 --- a/Spigot-Server-Patches/0191-Add-ArmorStand-Item-Meta.patch +++ b/Spigot-Server-Patches/0191-Add-ArmorStand-Item-Meta.patch @@ -13,7 +13,7 @@ starting point for future additions in this area. Fixes GH-559 diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java -index 9be4f8d56eaa6dd0d798dc5c1ae7e2bb0ba39d49..2cdabee85fcb377a563951f13386b13431aed1e1 100644 +index c593499aee3a2737cd80739ce61e7fba133d11ec..6b460841a8428727dd55a841fe5af06de9b1bdd1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaArmorStand.java @@ -9,9 +9,22 @@ import org.bukkit.configuration.serialization.DelegateDeserialization; @@ -264,7 +264,7 @@ index 9be4f8d56eaa6dd0d798dc5c1ae7e2bb0ba39d49..2cdabee85fcb377a563951f13386b134 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index da1af372453b0e32177454d87437bda5c5b530d0..6408cfdd52754167deed3a31d0913eb2e7bc4500 100644 +index 57a6e66866ea82caccbbbfd55948a081f50f6bbe..7f790c484fec77e1d1f1dc6abe0daa19d009ae46 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -1442,6 +1442,14 @@ class CraftMetaItem implements ItemMeta, Damageable, Repairable, BlockDataMeta { @@ -283,18 +283,10 @@ index da1af372453b0e32177454d87437bda5c5b530d0..6408cfdd52754167deed3a31d0913eb2 CraftMetaCompass.LODESTONE_POS.NBT, CraftMetaCompass.LODESTONE_TRACKED.NBT diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index a33cb37f934f74865c49dd3fd483cf4ca5de85cf..ddbcbd565d5dcb5b1c8d46558e06887e85d589c5 100644 +index 9a351c137776ac622f4df7353bb353142b3a6ccc..42f577ed3508ba5a380648461e149f16ce97c9bd 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -@@ -6,6 +6,7 @@ import java.util.ArrayList; - import java.util.Arrays; - import java.util.List; - import java.util.UUID; -+import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper - import net.minecraft.server.Block; - import net.minecraft.server.IRegistry; - import net.minecraft.server.ITileEntity; -@@ -313,6 +314,7 @@ public class ItemMetaTest extends AbstractTestingBase { +@@ -313,6 +313,7 @@ public class ItemMetaTest extends AbstractTestingBase { final CraftMetaArmorStand meta = (CraftMetaArmorStand) cleanStack.getItemMeta(); meta.entityTag = new NBTTagCompound(); meta.entityTag.setBoolean("Small", true); diff --git a/Spigot-Server-Patches/0192-Extend-Player-Interact-cancellation.patch b/Spigot-Server-Patches/0192-Extend-Player-Interact-cancellation.patch index 4eadd42897..6133c1f722 100644 --- a/Spigot-Server-Patches/0192-Extend-Player-Interact-cancellation.patch +++ b/Spigot-Server-Patches/0192-Extend-Player-Interact-cancellation.patch @@ -12,11 +12,11 @@ also resolves this. Update adjacent blocks of doors, double plants, pistons and beds when cancelling interaction. -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index aae5feb77402d721c23f7e781b53864f6778c1dd..daeaae8072a12b1d5f0718ba9e5bdd4f9c0e2169 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -149,6 +149,11 @@ public class PlayerInteractManager { +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 51157a9223f3da22d1110cfa211a502de59fb8a1..13e02b8d73164bc36e8d29edf8b0b2cb51fe3080 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -179,6 +179,11 @@ public class PlayerInteractManager { PlayerInteractEvent event = CraftEventFactory.callPlayerInteractEvent(this.player, Action.LEFT_CLICK_BLOCK, blockposition, enumdirection, this.player.inventory.getItemInHand(), EnumHand.MAIN_HAND); if (event.isCancelled()) { // Let the client know the block still exists @@ -28,7 +28,7 @@ index aae5feb77402d721c23f7e781b53864f6778c1dd..daeaae8072a12b1d5f0718ba9e5bdd4f this.player.playerConnection.sendPacket(new PacketPlayOutBlockChange(this.world, blockposition)); // Update any tile entity data for this block TileEntity tileentity = this.world.getTileEntity(blockposition); -@@ -453,13 +458,32 @@ public class PlayerInteractManager { +@@ -483,13 +488,32 @@ public class PlayerInteractManager { interactItemStack = itemstack.cloneItemStack(); if (event.useInteractedBlock() == Event.Result.DENY) { diff --git a/Spigot-Server-Patches/0194-Toggleable-player-crits-helps-mitigate-hacked-client.patch b/Spigot-Server-Patches/0194-Toggleable-player-crits-helps-mitigate-hacked-client.patch index 1865c69422..d1381daa3b 100644 --- a/Spigot-Server-Patches/0194-Toggleable-player-crits-helps-mitigate-hacked-client.patch +++ b/Spigot-Server-Patches/0194-Toggleable-player-crits-helps-mitigate-hacked-client.patch @@ -20,11 +20,11 @@ index 3c39f1bb3d88baaaed4dd43c51faeef89bb5c6c2..48f0385c7203c7955de5a015f3dc42be public boolean allChunksAreSlimeChunks; private void allChunksAreSlimeChunks() { allChunksAreSlimeChunks = getBoolean("all-chunks-are-slime-chunks", false); -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 8b2de281fbab8c2ef36cb7c2e3c9195a6abc0a1b..010bc57772ec24aa3b075b79cab5aa290dfbe22d 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1037,6 +1037,7 @@ public abstract class EntityHuman extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 266c4bb75ceaf57b66bb1e4d4deb3e4bfec3fd4e..5bbb47eea88c068d0e4d22fd87a6dad46255ebe7 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -1131,6 +1131,7 @@ public abstract class EntityHuman extends EntityLiving { boolean flag2 = flag && this.fallDistance > 0.0F && !this.onGround && !this.isClimbing() && !this.isInWater() && !this.hasEffect(MobEffects.BLINDNESS) && !this.isPassenger() && entity instanceof EntityLiving; diff --git a/Spigot-Server-Patches/0195-Prevent-Frosted-Ice-from-loading-holding-chunks.patch b/Spigot-Server-Patches/0195-Prevent-Frosted-Ice-from-loading-holding-chunks.patch index 5dc72b2612..8ea2e3bb74 100644 --- a/Spigot-Server-Patches/0195-Prevent-Frosted-Ice-from-loading-holding-chunks.patch +++ b/Spigot-Server-Patches/0195-Prevent-Frosted-Ice-from-loading-holding-chunks.patch @@ -4,11 +4,11 @@ Date: Sat, 10 Mar 2018 16:33:15 -0500 Subject: [PATCH] Prevent Frosted Ice from loading/holding chunks -diff --git a/src/main/java/net/minecraft/server/BlockIceFrost.java b/src/main/java/net/minecraft/server/BlockIceFrost.java -index 061b157f66999a733c3c4e990371b6f8d7860de2..77f5f835c60c181a0a2d6fc782d756338bc2ccb0 100644 ---- a/src/main/java/net/minecraft/server/BlockIceFrost.java -+++ b/src/main/java/net/minecraft/server/BlockIceFrost.java -@@ -28,7 +28,8 @@ public class BlockIceFrost extends BlockIce { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java +index e32e94868386ff06ff29254e6cc3bee9b446a293..cbe8a6db356396f9fd9ce7cc61a5845bb8e6499d 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockIceFrost.java +@@ -40,7 +40,8 @@ public class BlockIceFrost extends BlockIce { EnumDirection enumdirection = aenumdirection[j]; blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection); @@ -18,7 +18,7 @@ index 061b157f66999a733c3c4e990371b6f8d7860de2..77f5f835c60c181a0a2d6fc782d75633 if (iblockdata1.a((Block) this) && !this.e(iblockdata1, (World) worldserver, blockposition_mutableblockposition)) { worldserver.getBlockTickList().a(blockposition_mutableblockposition, this, MathHelper.nextInt(random, worldserver.paperConfig.frostedIceDelayMin, worldserver.paperConfig.frostedIceDelayMax)); // Paper - use configurable min/max delay -@@ -71,7 +72,9 @@ public class BlockIceFrost extends BlockIce { +@@ -83,7 +84,9 @@ public class BlockIceFrost extends BlockIce { EnumDirection enumdirection = aenumdirection[l]; blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, enumdirection); diff --git a/Spigot-Server-Patches/0196-Disable-Explicit-Network-Manager-Flushing.patch b/Spigot-Server-Patches/0196-Disable-Explicit-Network-Manager-Flushing.patch index 7026e31144..c5919e14be 100644 --- a/Spigot-Server-Patches/0196-Disable-Explicit-Network-Manager-Flushing.patch +++ b/Spigot-Server-Patches/0196-Disable-Explicit-Network-Manager-Flushing.patch @@ -11,11 +11,11 @@ flushing on the netty event loop, so it won't do the flush on the main thread. Renable flushing by passing -Dpaper.explicit-flush=true -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 1b11b4a8d26bd174b0c6f97225555eb585f67836..3351389dc122b66c198fb21ff02976491e9b46d9 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -63,6 +63,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index 60e4a4aa3854aaeb250d1318f2f25cf3591ea1d3..297820baef99e97e1216a64c527219e9ccc3e320 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -73,6 +73,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { // Paper start - NetworkClient implementation public int protocolVersion; public java.net.InetSocketAddress virtualHost; @@ -23,7 +23,7 @@ index 1b11b4a8d26bd174b0c6f97225555eb585f67836..3351389dc122b66c198fb21ff0297649 // Paper end public NetworkManager(EnumProtocolDirection enumprotocoldirection) { -@@ -230,7 +231,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -240,7 +241,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } if (this.channel != null) { diff --git a/Spigot-Server-Patches/0197-Implement-extended-PaperServerListPingEvent.patch b/Spigot-Server-Patches/0197-Implement-extended-PaperServerListPingEvent.patch index fe0c1c10e3..159d485912 100644 --- a/Spigot-Server-Patches/0197-Implement-extended-PaperServerListPingEvent.patch +++ b/Spigot-Server-Patches/0197-Implement-extended-PaperServerListPingEvent.patch @@ -77,7 +77,7 @@ index 0000000000000000000000000000000000000000..39b236a6319b1f44fbe28bbe43f064be +import javax.annotation.Nonnull; +import net.minecraft.server.MinecraftServer; +import net.minecraft.server.NetworkManager; -+import net.minecraft.server.PacketStatusOutServerInfo; ++import net.minecraft.network.protocol.game.PacketStatusOutServerInfo; +import net.minecraft.server.ServerPing; + +public final class StandardPaperServerListPingEventImpl extends PaperServerListPingEventImpl { @@ -174,62 +174,19 @@ index 0000000000000000000000000000000000000000..39b236a6319b1f44fbe28bbe43f064be + } + +} -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5e64853fca8e1baa103dd69c050a4900ef7f7f37..41fbdaa99f2c884371b7922d28551dffd44686ed 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2,6 +2,9 @@ package net.minecraft.server; - - import com.google.common.base.Splitter; - import com.google.common.collect.ImmutableList; -+import co.aikar.timings.Timings; -+import com.destroystokyo.paper.event.server.PaperServerListPingEvent; -+import com.google.common.base.Stopwatch; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Sets; -@@ -1121,7 +1124,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { - this.T = i; - this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount())); -- GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)]; -+ GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper - int j = MathHelper.nextInt(this.r, 0, this.getPlayerCount() - agameprofile.length); - - for (int k = 0; k < agameprofile.length; ++k) { -diff --git a/src/main/java/net/minecraft/server/PacketStatusListener.java b/src/main/java/net/minecraft/server/PacketStatusListener.java -index 7875d4c08969b3adc6f95504686cc9fe99e3f29a..d0fad346dd4511722f958a8c0bda67492184fb62 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusListener.java -+++ b/src/main/java/net/minecraft/server/PacketStatusListener.java -@@ -35,6 +35,8 @@ public class PacketStatusListener implements PacketStatusInListener { - this.networkManager.close(PacketStatusListener.a); - } else { - this.d = true; -+ // Paper start - Replace everything -+ /* - // CraftBukkit start - // this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing())); - final Object[] players = minecraftServer.getPlayerList().players.toArray(); -@@ -130,6 +132,9 @@ public class PacketStatusListener implements PacketStatusInListener { - ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version)); - - this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping)); -+ */ -+ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.minecraftServer, this.networkManager); -+ // Paper end - } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java b/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -index 50d5fb62efa7c89c7a73ccf072a0e7e433bcc650..f81ed6cd2029bbd8bbf1ddac10851da31273e8dd 100644 ---- a/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -+++ b/src/main/java/net/minecraft/server/PacketStatusOutServerInfo.java -@@ -2,11 +2,14 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java b/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java +index 0ebeacaaeb265d202f52c758566a5160c42e8a55..cb37805c8cc5a064391f338c6359df518f6db39a 100644 +--- a/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java ++++ b/src/main/java/net/minecraft/network/protocol/status/PacketStatusOutServerInfo.java +@@ -2,6 +2,7 @@ package net.minecraft.network.protocol.status; import com.google.gson.Gson; import com.google.gson.GsonBuilder; +import io.papermc.paper.adventure.AdventureComponent; // Paper import java.io.IOException; + import net.minecraft.network.PacketDataSerializer; + import net.minecraft.network.chat.ChatModifier; +@@ -12,7 +13,9 @@ import net.minecraft.util.ChatTypeAdapterFactory; public class PacketStatusOutServerInfo implements Packet { @@ -240,11 +197,11 @@ index 50d5fb62efa7c89c7a73ccf072a0e7e433bcc650..f81ed6cd2029bbd8bbf1ddac10851da3 private ServerPing b; public PacketStatusOutServerInfo() {} -diff --git a/src/main/java/net/minecraft/server/ServerPing.java b/src/main/java/net/minecraft/server/ServerPing.java -index aa125a52dcdf4f137cfe17c5dc808b17d5e9de0b..ea52e89bd965afbd74f15b0e2974657319c28e4a 100644 ---- a/src/main/java/net/minecraft/server/ServerPing.java -+++ b/src/main/java/net/minecraft/server/ServerPing.java -@@ -29,6 +29,7 @@ public class ServerPing { +diff --git a/src/main/java/net/minecraft/network/protocol/status/ServerPing.java b/src/main/java/net/minecraft/network/protocol/status/ServerPing.java +index 005ae7a75dfb19152abb606da29acad07c85e499..b9e36a83837913cd3e5abe598f695ba7a9ffc417 100644 +--- a/src/main/java/net/minecraft/network/protocol/status/ServerPing.java ++++ b/src/main/java/net/minecraft/network/protocol/status/ServerPing.java +@@ -31,6 +31,7 @@ public class ServerPing { this.a = ichatbasecomponent; } @@ -252,7 +209,7 @@ index aa125a52dcdf4f137cfe17c5dc808b17d5e9de0b..ea52e89bd965afbd74f15b0e29746573 public ServerPing.ServerPingPlayerSample b() { return this.b; } -@@ -160,10 +161,12 @@ public class ServerPing { +@@ -162,10 +163,12 @@ public class ServerPing { return this.b; } @@ -265,8 +222,54 @@ index aa125a52dcdf4f137cfe17c5dc808b17d5e9de0b..ea52e89bd965afbd74f15b0e29746573 public void a(GameProfile[] agameprofile) { this.c = agameprofile; } +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 5b796a6e5f34c38e15d9ce288dfd9bf498cc328e..d69b6783572b44c9b8d49d0853a8282e14e64476 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -2,6 +2,9 @@ package net.minecraft.server; + + import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; ++import co.aikar.timings.Timings; ++import com.destroystokyo.paper.event.server.PaperServerListPingEvent; ++import com.google.common.base.Stopwatch; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +@@ -1228,7 +1231,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 5000000000L) { + this.T = i; + this.serverPing.setPlayerSample(new ServerPing.ServerPingPlayerSample(this.getMaxPlayers(), this.getPlayerCount())); +- GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), 12)]; ++ GameProfile[] agameprofile = new GameProfile[Math.min(this.getPlayerCount(), org.spigotmc.SpigotConfig.playerSample)]; // Paper + int j = MathHelper.nextInt(this.r, 0, this.getPlayerCount() - agameprofile.length); + + for (int k = 0; k < agameprofile.length; ++k) { +diff --git a/src/main/java/net/minecraft/server/network/PacketStatusListener.java b/src/main/java/net/minecraft/server/network/PacketStatusListener.java +index d219eda271a71f786808a6958b829fca40a1aaba..e1997563984540e6edf5d3b697d029dc5f3c40e1 100644 +--- a/src/main/java/net/minecraft/server/network/PacketStatusListener.java ++++ b/src/main/java/net/minecraft/server/network/PacketStatusListener.java +@@ -48,6 +48,8 @@ public class PacketStatusListener implements PacketStatusInListener { + this.networkManager.close(PacketStatusListener.a); + } else { + this.d = true; ++ // Paper start - Replace everything ++ /* + // CraftBukkit start + // this.networkManager.sendPacket(new PacketStatusOutServerInfo(this.minecraftServer.getServerPing())); + final Object[] players = minecraftServer.getPlayerList().players.toArray(); +@@ -143,6 +145,9 @@ public class PacketStatusListener implements PacketStatusInListener { + ping.setServerInfo(new ServerPing.ServerData(minecraftServer.getServerModName() + " " + minecraftServer.getVersion(), version)); + + this.networkManager.sendPacket(new PacketStatusOutServerInfo(ping)); ++ */ ++ com.destroystokyo.paper.network.StandardPaperServerListPingEventImpl.processRequest(this.minecraftServer, this.networkManager); ++ // Paper end + } + // CraftBukkit end + } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index bf00d6d263b692e8a597694c689768f177835fde..b830bfefd2984f012de0e3877592e5198a2a02ea 100644 +index e8e5e5b568ba53dd006f1461cb4f027ceeae5528..11f8a2e5bf43013bce8675ea310ff42eacf14754 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java @@ -289,7 +289,7 @@ public class SpigotConfig diff --git a/Spigot-Server-Patches/0199-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch b/Spigot-Server-Patches/0199-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch index 57d67b3c62..e59295a84a 100644 --- a/Spigot-Server-Patches/0199-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch +++ b/Spigot-Server-Patches/0199-Ability-to-change-PlayerProfile-in-AsyncPreLoginEven.patch @@ -5,27 +5,27 @@ Subject: [PATCH] Ability to change PlayerProfile in AsyncPreLoginEvent This will allow you to change the players name or skin on login. -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 144df45865105a65ed87053935878b3f12146f4a..92f42f17d7f554fca819d63c1f9401239894e0e1 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 714f44a668eb35b3c61bb9ab140f884917efd6f5..a903a073e6f5e8ae6ea383b786d930af69a966c5 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java @@ -1,5 +1,7 @@ - package net.minecraft.server; + package net.minecraft.server.network; +import com.destroystokyo.paper.profile.CraftPlayerProfile; +import com.destroystokyo.paper.profile.PlayerProfile; import com.mojang.authlib.GameProfile; import com.mojang.authlib.exceptions.AuthenticationUnavailableException; import java.math.BigInteger; -@@ -20,6 +22,7 @@ import org.apache.logging.log4j.Logger; - +@@ -38,6 +40,7 @@ import org.apache.logging.log4j.Logger; // CraftBukkit start + import net.minecraft.network.chat.ChatComponentText; import io.papermc.paper.adventure.PaperAdventure; // Paper +import org.bukkit.Bukkit; import org.bukkit.craftbukkit.util.Waitable; import org.bukkit.event.player.AsyncPlayerPreLoginEvent; import org.bukkit.event.player.PlayerPreLoginEvent; -@@ -297,8 +300,16 @@ public class LoginListener implements PacketLoginInListener { +@@ -315,8 +318,16 @@ public class LoginListener implements PacketLoginInListener { java.util.UUID uniqueId = i.getId(); final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server; diff --git a/Spigot-Server-Patches/0200-Player.setPlayerProfile-API.patch b/Spigot-Server-Patches/0200-Player.setPlayerProfile-API.patch index cb70eef42a..042d3bff30 100644 --- a/Spigot-Server-Patches/0200-Player.setPlayerProfile-API.patch +++ b/Spigot-Server-Patches/0200-Player.setPlayerProfile-API.patch @@ -5,24 +5,11 @@ Subject: [PATCH] Player.setPlayerProfile API This can be useful for changing name or skins after a player has logged in. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 010bc57772ec24aa3b075b79cab5aa290dfbe22d..f7da83b0104f7643ad2af2bca2eeb26ac08386ef 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -65,7 +65,7 @@ public abstract class EntityHuman extends EntityLiving { - protected int bG; - protected final float bH = 0.02F; - private int g; -- private final GameProfile bJ; -+ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER - private ItemStack bL; - private final ItemCooldown bM; - @Nullable -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 92f42f17d7f554fca819d63c1f9401239894e0e1..066b0dbdbc101a8235fb872c2d1e9d427dfd6bb8 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -38,7 +38,7 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index a903a073e6f5e8ae6ea383b786d930af69a966c5..2ce081e68fe27381d3e7f851b685cc547de35eb7 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -56,7 +56,7 @@ public class LoginListener implements PacketLoginInListener { public final NetworkManager networkManager; private LoginListener.EnumProtocolState g; private int h; @@ -31,7 +18,7 @@ index 92f42f17d7f554fca819d63c1f9401239894e0e1..066b0dbdbc101a8235fb872c2d1e9d42 private final String j; private SecretKey loginKey; private EntityPlayer l; -@@ -301,12 +301,12 @@ public class LoginListener implements PacketLoginInListener { +@@ -319,12 +319,12 @@ public class LoginListener implements PacketLoginInListener { final org.bukkit.craftbukkit.CraftServer server = LoginListener.this.server.server; // Paper start @@ -47,8 +34,21 @@ index 92f42f17d7f554fca819d63c1f9401239894e0e1..066b0dbdbc101a8235fb872c2d1e9d42 playerName = i.getName(); uniqueId = i.getId(); // Paper end +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 5bbb47eea88c068d0e4d22fd87a6dad46255ebe7..c7b2032fb677822c8352fabb29c881f609435cb8 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -159,7 +159,7 @@ public abstract class EntityHuman extends EntityLiving { + protected int bG; + protected final float bH = 0.02F; + private int g; +- private final GameProfile bJ; ++ private GameProfile bJ; public final void setProfile(final GameProfile profile) { this.bJ = profile; } // Paper - OBFHELPER + private ItemStack bL; + private final ItemCooldown bM; + @Nullable diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9a195b3b3524f6c004e651a4dbcab7607006a5ae..cddba4763f11ad51807693a07484511c473ffadf 100644 +index f8780db8f376ee71a35ebe1c2ab84a6117d0d74e..08ef5d2a275f8bf295501b22c5b743f60ac0d465 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1308,8 +1308,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -118,9 +118,9 @@ index 9a195b3b3524f6c004e651a4dbcab7607006a5ae..cddba4763f11ad51807693a07484511c + + //Respawn the player then update their position and selected slot + WorldServer worldserver = handle.getWorldServer(); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutRespawn(worldserver.getDimensionManager(), worldserver.getDimensionKey(), net.minecraft.server.BiomeManager.a(worldserver.getSeed()), handle.playerInteractManager.getGameMode(), handle.playerInteractManager.c(), worldserver.isDebugWorld(), worldserver.isFlatWorld(), true)); + handle.updateAbilities(); -+ connection.sendPacket(new net.minecraft.server.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); ++ connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutPosition(loc.getX(), loc.getY(), loc.getZ(), loc.getYaw(), loc.getPitch(), new HashSet<>(), 0)); + net.minecraft.server.MinecraftServer.getServer().getPlayerList().updateClient(handle); + + if (this.isOp()) { diff --git a/Spigot-Server-Patches/0201-Fix-Dragon-Server-Crashes.patch b/Spigot-Server-Patches/0201-Fix-Dragon-Server-Crashes.patch index 2d846a751a..1ec120745b 100644 --- a/Spigot-Server-Patches/0201-Fix-Dragon-Server-Crashes.patch +++ b/Spigot-Server-Patches/0201-Fix-Dragon-Server-Crashes.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Fix Dragon Server Crashes If the dragon tries to find "ground" and hits a hole, or off edge, it will infinitely keep looking for non air and eventually crash. -diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -index 99978948216ef39767cba16a85d52b4ddb77299c..771c0b10d171da56c5156a42a6ea70b51983c684 100644 ---- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -@@ -54,7 +54,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java +index fbecb61b8c511fc7daa21690b2a653254be74246..5adbd9fe858aad9c775a10254eb53b34719a9bd6 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java +@@ -63,7 +63,7 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded double d3 = d2; BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(d0, d2, d1); diff --git a/Spigot-Server-Patches/0204-Make-legacy-ping-handler-more-reliable.patch b/Spigot-Server-Patches/0204-Make-legacy-ping-handler-more-reliable.patch index a318f5d9ee..a437521ba2 100644 --- a/Spigot-Server-Patches/0204-Make-legacy-ping-handler-more-reliable.patch +++ b/Spigot-Server-Patches/0204-Make-legacy-ping-handler-more-reliable.patch @@ -27,11 +27,11 @@ respond to the request. [1]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h3-11 [2]: https://netty.io/wiki/user-guide-for-4.x.html#wiki-h4-13 -diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java -index 9ee5a1ff026d413c21da86643732f859b6123916..063efe9bbe3a95da91ef1e504033e29ccf3300af 100644 ---- a/src/main/java/net/minecraft/server/LegacyPingHandler.java -+++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java -@@ -14,6 +14,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +diff --git a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java +index e0edebf3eb93c11de2ed5c9013565950b4ad2375..0286d30b63e42224028b343315e1d1a9db2fe3d1 100644 +--- a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java ++++ b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java +@@ -15,6 +15,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { private static final Logger LOGGER = LogManager.getLogger(); private final ServerConnection b; @@ -39,7 +39,7 @@ index 9ee5a1ff026d413c21da86643732f859b6123916..063efe9bbe3a95da91ef1e504033e29c public LegacyPingHandler(ServerConnection serverconnection) { this.b = serverconnection; -@@ -22,6 +23,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -23,6 +24,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { public void channelRead(ChannelHandlerContext channelhandlercontext, Object object) throws Exception { ByteBuf bytebuf = (ByteBuf) object; @@ -56,7 +56,7 @@ index 9ee5a1ff026d413c21da86643732f859b6123916..063efe9bbe3a95da91ef1e504033e29c bytebuf.markReaderIndex(); boolean flag = true; -@@ -52,6 +63,10 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -53,6 +64,10 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { this.a(channelhandlercontext, this.a(s)); break; default: @@ -67,7 +67,7 @@ index 9ee5a1ff026d413c21da86643732f859b6123916..063efe9bbe3a95da91ef1e504033e29c boolean flag1 = bytebuf.readUnsignedByte() == 1; flag1 &= bytebuf.readUnsignedByte() == 250; -@@ -75,6 +90,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -76,6 +91,7 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { } finally { bytebuf1.release(); } @@ -75,7 +75,7 @@ index 9ee5a1ff026d413c21da86643732f859b6123916..063efe9bbe3a95da91ef1e504033e29c } bytebuf.release(); -@@ -92,6 +108,90 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -93,6 +109,90 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { } diff --git a/Spigot-Server-Patches/0205-Call-PaperServerListPingEvent-for-legacy-pings.patch b/Spigot-Server-Patches/0205-Call-PaperServerListPingEvent-for-legacy-pings.patch index fd1e33fc40..9274b7f30a 100644 --- a/Spigot-Server-Patches/0205-Call-PaperServerListPingEvent-for-legacy-pings.patch +++ b/Spigot-Server-Patches/0205-Call-PaperServerListPingEvent-for-legacy-pings.patch @@ -83,19 +83,19 @@ index 0000000000000000000000000000000000000000..74c012fd40491f1d870fbc1aa8c318a2 + } + +} -diff --git a/src/main/java/net/minecraft/server/LegacyPingHandler.java b/src/main/java/net/minecraft/server/LegacyPingHandler.java -index 063efe9bbe3a95da91ef1e504033e29ccf3300af..4a49fe4cc600e2b70963302ddae0c4479849f3f5 100644 ---- a/src/main/java/net/minecraft/server/LegacyPingHandler.java -+++ b/src/main/java/net/minecraft/server/LegacyPingHandler.java +diff --git a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java +index 0286d30b63e42224028b343315e1d1a9db2fe3d1..765dea6653b450802d45b76c7d2ac3d5778da9df 100644 +--- a/src/main/java/net/minecraft/server/network/LegacyPingHandler.java ++++ b/src/main/java/net/minecraft/server/network/LegacyPingHandler.java @@ -1,5 +1,7 @@ - package net.minecraft.server; + package net.minecraft.server.network; +import com.destroystokyo.paper.network.PaperLegacyStatusClient; + import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; import io.netty.channel.ChannelFutureListener; -@@ -45,12 +47,19 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -46,12 +48,19 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { MinecraftServer minecraftserver = this.b.d(); int i = bytebuf.readableBytes(); String s; @@ -117,7 +117,7 @@ index 063efe9bbe3a95da91ef1e504033e29ccf3300af..4a49fe4cc600e2b70963302ddae0c447 this.a(channelhandlercontext, this.a(s)); break; case 1: -@@ -59,7 +68,14 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -60,7 +69,14 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { } LegacyPingHandler.LOGGER.debug("Ping: (1.4-1.5.x) from {}:{}", inetsocketaddress.getAddress(), inetsocketaddress.getPort()); @@ -133,7 +133,7 @@ index 063efe9bbe3a95da91ef1e504033e29ccf3300af..4a49fe4cc600e2b70963302ddae0c447 this.a(channelhandlercontext, this.a(s)); break; default: -@@ -169,8 +185,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { +@@ -170,8 +186,16 @@ public class LegacyPingHandler extends ChannelInboundHandlerAdapter { LOGGER.debug("Ping: (1.6) from {}", ctx.channel().remoteAddress()); diff --git a/Spigot-Server-Patches/0208-Configurable-sprint-interruption-on-attack.patch b/Spigot-Server-Patches/0208-Configurable-sprint-interruption-on-attack.patch index 6abfada7f8..8d29c37902 100644 --- a/Spigot-Server-Patches/0208-Configurable-sprint-interruption-on-attack.patch +++ b/Spigot-Server-Patches/0208-Configurable-sprint-interruption-on-attack.patch @@ -19,11 +19,11 @@ index 48f0385c7203c7955de5a015f3dc42be2ab7b681..cebf1a623a9bec72d60fdd23dda01868 + disableSprintInterruptionOnAttack = getBoolean("game-mechanics.disable-sprint-interruption-on-attack", false); + } } -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index f7da83b0104f7643ad2af2bca2eeb26ac08386ef..c0c8373af47d24a8b9c25a3bebb59b13626a3733 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1086,7 +1086,11 @@ public abstract class EntityHuman extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index c7b2032fb677822c8352fabb29c881f609435cb8..e6b75b6a493f91ccdd67fa507c9869b4007fb907 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -1180,7 +1180,11 @@ public abstract class EntityHuman extends EntityLiving { } this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D)); diff --git a/Spigot-Server-Patches/0209-Fix-exploit-that-allowed-colored-signs-to-be-created.patch b/Spigot-Server-Patches/0209-Fix-exploit-that-allowed-colored-signs-to-be-created.patch index 898f6cf55a..dbcf3f4db5 100644 --- a/Spigot-Server-Patches/0209-Fix-exploit-that-allowed-colored-signs-to-be-created.patch +++ b/Spigot-Server-Patches/0209-Fix-exploit-that-allowed-colored-signs-to-be-created.patch @@ -4,11 +4,23 @@ Date: Thu, 26 Apr 2018 04:41:11 -0400 Subject: [PATCH] Fix exploit that allowed colored signs to be created -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 2cb29fe217dc489e533d29295099a3e21e18911d..76c3e9a0a10fdeda93af3bc0a3564e5fd9d83b1e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2629,7 +2629,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/SharedConstants.java b/src/main/java/net/minecraft/SharedConstants.java +index b92975aa85fd79c70d6bec014284e8f55d0d3a4b..d5d6c545182b9b0b6aa5e52f1f9858450a17038e 100644 +--- a/src/main/java/net/minecraft/SharedConstants.java ++++ b/src/main/java/net/minecraft/SharedConstants.java +@@ -20,6 +20,7 @@ public class SharedConstants { + return c0 != 167 && c0 >= ' ' && c0 != 127; + } + ++ public static String filterAllowedChatCharacters(String input) { return a(input); } // Paper - OBFHELPER + public static String a(String s) { + StringBuilder stringbuilder = new StringBuilder(); + char[] achar = s.toCharArray(); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index cbffc7e1cf7ca7597517cdae12ec9be5efe97217..415f34109019e68638f76fefa52bd8d40c449e12 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2774,7 +2774,7 @@ public class PlayerConnection implements PacketListenerPlayIn { List lines = new java.util.ArrayList<>(); for (int i = 0; i < list.size(); ++i) { @@ -17,15 +29,3 @@ index 2cb29fe217dc489e533d29295099a3e21e18911d..76c3e9a0a10fdeda93af3bc0a3564e5f } SignChangeEvent event = new SignChangeEvent(org.bukkit.craftbukkit.block.CraftBlock.at(worldserver, blockposition), this.getPlayer(), lines); this.server.getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/SharedConstants.java b/src/main/java/net/minecraft/server/SharedConstants.java -index 9663e8c10662c9660964afda62d8a65812fae69d..470690dbe19db1622eca44f6801ece37d7ad7426 100644 ---- a/src/main/java/net/minecraft/server/SharedConstants.java -+++ b/src/main/java/net/minecraft/server/SharedConstants.java -@@ -19,6 +19,7 @@ public class SharedConstants { - return c0 != 167 && c0 >= ' ' && c0 != 127; - } - -+ public static String filterAllowedChatCharacters(String input) { return a(input); } // Paper - OBFHELPER - public static String a(String s) { - StringBuilder stringbuilder = new StringBuilder(); - char[] achar = s.toCharArray(); diff --git a/Spigot-Server-Patches/0210-EndermanEscapeEvent.patch b/Spigot-Server-Patches/0210-EndermanEscapeEvent.patch index 52a5085645..428f29678a 100644 --- a/Spigot-Server-Patches/0210-EndermanEscapeEvent.patch +++ b/Spigot-Server-Patches/0210-EndermanEscapeEvent.patch @@ -7,11 +7,11 @@ Fires an event anytime an enderman intends to teleport away from the player You may cancel this, enabling ranged attacks to damage the enderman for example. -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 4e7553a70e3caafdc661215f6c3e2cbf49c6db91..b9ede7d533a813f4de27404dc14b0ef99c8fcd62 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -2,6 +2,7 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +index 2de3210bd8988b156b756723d0f781fd92bc151a..b889c1954df39b6180351c418393f5c772702589 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +@@ -2,6 +2,7 @@ package net.minecraft.world.entity.monster; import java.util.EnumSet; import java.util.Optional; @@ -19,7 +19,7 @@ index 4e7553a70e3caafdc661215f6c3e2cbf49c6db91..b9ede7d533a813f4de27404dc14b0ef9 import java.util.Random; import java.util.UUID; import java.util.function.Predicate; -@@ -55,6 +56,12 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -109,6 +110,12 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { setGoalTarget(entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason.UNKNOWN, true); } @@ -32,7 +32,7 @@ index 4e7553a70e3caafdc661215f6c3e2cbf49c6db91..b9ede7d533a813f4de27404dc14b0ef9 @Override public boolean setGoalTarget(EntityLiving entityliving, org.bukkit.event.entity.EntityTargetEvent.TargetReason reason, boolean fireEvent) { if (!super.setGoalTarget(entityliving, reason, fireEvent)) { -@@ -208,7 +215,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -262,7 +269,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { if (this.world.isDay() && this.ticksLived >= this.bs + 600) { float f = this.aR(); @@ -41,7 +41,7 @@ index 4e7553a70e3caafdc661215f6c3e2cbf49c6db91..b9ede7d533a813f4de27404dc14b0ef9 this.setGoalTarget((EntityLiving) null); this.eL(); } -@@ -306,17 +313,19 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -360,17 +367,19 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { if (this.isInvulnerable(damagesource)) { return false; } else if (damagesource instanceof EntityDamageSourceIndirect) { @@ -62,7 +62,7 @@ index 4e7553a70e3caafdc661215f6c3e2cbf49c6db91..b9ede7d533a813f4de27404dc14b0ef9 this.eL(); } -@@ -461,7 +470,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -515,7 +524,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { static class PathfinderGoalPlayerWhoLookedAtTarget extends PathfinderGoalNearestAttackableTarget { @@ -71,7 +71,7 @@ index 4e7553a70e3caafdc661215f6c3e2cbf49c6db91..b9ede7d533a813f4de27404dc14b0ef9 private EntityHuman j; private int k; private int l; -@@ -524,7 +533,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -578,7 +587,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { } else { if (this.c != null && !this.i.isPassenger()) { if (this.i.g((EntityHuman) this.c)) { diff --git a/Spigot-Server-Patches/0211-Enderman.teleportRandomly.patch b/Spigot-Server-Patches/0211-Enderman.teleportRandomly.patch index bdcf36ded7..b64598e139 100644 --- a/Spigot-Server-Patches/0211-Enderman.teleportRandomly.patch +++ b/Spigot-Server-Patches/0211-Enderman.teleportRandomly.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Enderman.teleportRandomly() Ability to trigger the vanilla "teleport randomly" mechanic of an enderman. -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index b9ede7d533a813f4de27404dc14b0ef99c8fcd62..1e7aa2ee1c399bf3484e0245d57ab428d48d32f5 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -224,6 +224,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +index b889c1954df39b6180351c418393f5c772702589..ef2f0211cd4d20dad0d3757c38c3c2882e99b2f2 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +@@ -278,6 +278,7 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { super.mobTick(); } @@ -18,7 +18,7 @@ index b9ede7d533a813f4de27404dc14b0ef99c8fcd62..1e7aa2ee1c399bf3484e0245d57ab428 if (!this.world.s_() && this.isAlive()) { double d0 = this.locX() + (this.random.nextDouble() - 0.5D) * 64.0D; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java -index 970efabd37d380ee1028c80a8e967e0f7aee9760..0c5f35934617529e92c02729687b524c3796128c 100644 +index 8894d619796c7b81acde9ff27d0f9191122eade4..f54175a4b13ddedc475ef028942edb08eb4ff631 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEnderman.java @@ -16,6 +16,7 @@ public class CraftEnderman extends CraftMonster implements Enderman { diff --git a/Spigot-Server-Patches/0212-Block-Enderpearl-Travel-Exploit.patch b/Spigot-Server-Patches/0212-Block-Enderpearl-Travel-Exploit.patch index cebdd7d2e2..9ac01e9110 100644 --- a/Spigot-Server-Patches/0212-Block-Enderpearl-Travel-Exploit.patch +++ b/Spigot-Server-Patches/0212-Block-Enderpearl-Travel-Exploit.patch @@ -26,11 +26,11 @@ index cebf1a623a9bec72d60fdd23dda01868ef6431d4..e8e1e7dafaf1c105b2f58cf3e118e3d6 + log("Disable Unloaded Chunk Enderpearl Exploit: " + (disableEnderpearlExploit ? "enabled" : "disabled")); + } } -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java -index 676848e2b3cfc93b0b344b76b7a88e37549a25f2..0b62041f6dc9cb0151ea55407f6706cac134f1b5 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java -@@ -48,6 +48,7 @@ public abstract class IProjectile extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +index 33b3643922f1d703221afb538cda6c097ddbae43..65cea9282467cb362ac6e9e0bb03c5d36085ee43 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +@@ -59,6 +59,7 @@ public abstract class IProjectile extends Entity { protected void loadData(NBTTagCompound nbttagcompound) { if (nbttagcompound.b("Owner")) { this.shooter = nbttagcompound.a("Owner"); diff --git a/Spigot-Server-Patches/0213-Expand-World.spawnParticle-API-and-add-Builder.patch b/Spigot-Server-Patches/0213-Expand-World.spawnParticle-API-and-add-Builder.patch index dd1589eac3..684c0bfd1f 100644 --- a/Spigot-Server-Patches/0213-Expand-World.spawnParticle-API-and-add-Builder.patch +++ b/Spigot-Server-Patches/0213-Expand-World.spawnParticle-API-and-add-Builder.patch @@ -9,11 +9,11 @@ Adds an option to control the force mode of the particle. This adds a new Builder API which is much friendlier to use. -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 885bf43a591492f19bd5a421ea4271854ae8f192..d192e341f0f6a3d03329dab16de3b19962091d2a 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -61,7 +61,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 1e9884e819ac2afe58b5f50b89355c2d58ed73d5..3876958f20e675c4c8fd505c5fb333ccb9cdc8c9 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -170,7 +170,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final Int2ObjectMap entitiesById = new Int2ObjectLinkedOpenHashMap(); private final Map entitiesByUUID = Maps.newHashMap(); private final Queue entitiesToAdd = Queues.newArrayDeque(); @@ -22,7 +22,7 @@ index 885bf43a591492f19bd5a421ea4271854ae8f192..d192e341f0f6a3d03329dab16de3b199 public final ChunkProviderServer chunkProvider; // Paper - public boolean tickingEntities; private final MinecraftServer server; -@@ -1368,12 +1368,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1477,12 +1477,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { } public int sendParticles(EntityPlayer sender, T t0, double d0, double d1, double d2, int i, double d3, double d4, double d5, double d6, boolean force) { @@ -43,7 +43,7 @@ index 885bf43a591492f19bd5a421ea4271854ae8f192..d192e341f0f6a3d03329dab16de3b199 if (this.a(entityplayer, force, d0, d1, d2, packetplayoutworldparticles)) { // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 4058484c256343a71d1392ae0aa54bf07fd0d26e..6e2f73cac222044256e97bc2c07f5581d63de1a2 100644 +index 4e255f2ca75ac0c1e1572f312a669cb6d3b60121..dfc3a2f6221c9e172d0d40510cb5edfc23649e53 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -2353,11 +2353,17 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/0214-EndermanAttackPlayerEvent.patch b/Spigot-Server-Patches/0214-EndermanAttackPlayerEvent.patch index d08b2f1cac..08c3406719 100644 --- a/Spigot-Server-Patches/0214-EndermanAttackPlayerEvent.patch +++ b/Spigot-Server-Patches/0214-EndermanAttackPlayerEvent.patch @@ -7,11 +7,11 @@ Allow control over whether or not an enderman aggros a player. This allows you to override/extend the pumpkin/stare logic. -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index 1e7aa2ee1c399bf3484e0245d57ab428d48d32f5..f4b823882e1e842c897c7946f7d1a46ce5366de0 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -167,7 +167,15 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +index ef2f0211cd4d20dad0d3757c38c3c2882e99b2f2..aa6cb15637144c9d8db1b1861e58f3f02d68357a 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +@@ -221,7 +221,15 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { this.a((WorldServer) this.world, nbttagcompound); } diff --git a/Spigot-Server-Patches/0215-WitchConsumePotionEvent.patch b/Spigot-Server-Patches/0215-WitchConsumePotionEvent.patch index 8664d99737..4c85394244 100644 --- a/Spigot-Server-Patches/0215-WitchConsumePotionEvent.patch +++ b/Spigot-Server-Patches/0215-WitchConsumePotionEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] WitchConsumePotionEvent Fires when a witch consumes the potion in their hand -diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index fd54fbe9d331a8065ecfea90e54975b5d8e6368a..44a744f0af2de92c33a43eaaf7de6f027e1d4e29 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java -@@ -85,7 +85,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java +index 814ef118e983ee6807108b2e07cd9b35ef9dae15..0bfdcbe4a792e8243de86ded6c64d930ec6e4de8 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java +@@ -124,7 +124,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); if (itemstack.getItem() == Items.POTION) { diff --git a/Spigot-Server-Patches/0216-WitchThrowPotionEvent.patch b/Spigot-Server-Patches/0216-WitchThrowPotionEvent.patch index a1eeb14474..a9232360d4 100644 --- a/Spigot-Server-Patches/0216-WitchThrowPotionEvent.patch +++ b/Spigot-Server-Patches/0216-WitchThrowPotionEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] WitchThrowPotionEvent Fired when a witch throws a potion at a player -diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index 44a744f0af2de92c33a43eaaf7de6f027e1d4e29..58949acbcb69649366df16a0d55e822a039e4d9a 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java -@@ -185,9 +185,16 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java +index 0bfdcbe4a792e8243de86ded6c64d930ec6e4de8..2e65f6107ffecfe00c9c09baa60dec3021aac527 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java +@@ -224,9 +224,16 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { potionregistry = Potions.WEAKNESS; } diff --git a/Spigot-Server-Patches/0218-WitchReadyPotionEvent.patch b/Spigot-Server-Patches/0218-WitchReadyPotionEvent.patch index 34d7fe161b..379b2c1751 100644 --- a/Spigot-Server-Patches/0218-WitchReadyPotionEvent.patch +++ b/Spigot-Server-Patches/0218-WitchReadyPotionEvent.patch @@ -4,11 +4,11 @@ Date: Tue, 5 Jun 2018 22:47:26 -0400 Subject: [PATCH] WitchReadyPotionEvent -diff --git a/src/main/java/net/minecraft/server/EntityWitch.java b/src/main/java/net/minecraft/server/EntityWitch.java -index 58949acbcb69649366df16a0d55e822a039e4d9a..0703124e5137ff0a5ae4d025488eb343d2813067 100644 ---- a/src/main/java/net/minecraft/server/EntityWitch.java -+++ b/src/main/java/net/minecraft/server/EntityWitch.java -@@ -118,7 +118,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java +index 2e65f6107ffecfe00c9c09baa60dec3021aac527..c6d79125e7dd982fc528ce61144005194cbaa323 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityWitch.java +@@ -157,7 +157,11 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { } if (potionregistry != null) { diff --git a/Spigot-Server-Patches/0219-ItemStack-getMaxItemUseDuration.patch b/Spigot-Server-Patches/0219-ItemStack-getMaxItemUseDuration.patch index 2201d37d53..3c41349491 100644 --- a/Spigot-Server-Patches/0219-ItemStack-getMaxItemUseDuration.patch +++ b/Spigot-Server-Patches/0219-ItemStack-getMaxItemUseDuration.patch @@ -5,11 +5,11 @@ Subject: [PATCH] ItemStack#getMaxItemUseDuration Allows you to determine how long it takes to use a usable/consumable item -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 2b2f5a8ac100c93b4c17d808b19a8252ed175760..bdb6f9bf3477f85859e3f0dd761e2e895f1a8e2b 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -552,6 +552,7 @@ public final class ItemStack { +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 58045d500a6fbb7eb568f48c7d8ce7730d357577..c525afbc7d73488db2cae1501cdbe80ec05aeb7c 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -606,6 +606,7 @@ public final class ItemStack { this.getItem().b(this, world, entityhuman); } @@ -18,7 +18,7 @@ index 2b2f5a8ac100c93b4c17d808b19a8252ed175760..bdb6f9bf3477f85859e3f0dd761e2e89 return this.getItem().e_(this); } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index 9913d0136841dac35b6649cb1afbe1e93b36bf4c..d315a102a5ae2a79189b39c3b534b8fd733cc9e4 100644 +index 7221ac52c9f66ae0af6f6cbf15c8d47f9c0291a0..315addab147dfecf4aa88d32d154cefe850d0a78 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -174,6 +174,13 @@ public final class CraftItemStack extends ItemStack { diff --git a/Spigot-Server-Patches/0220-Implement-EntityTeleportEndGatewayEvent.patch b/Spigot-Server-Patches/0220-Implement-EntityTeleportEndGatewayEvent.patch index 4c2a659ef5..946ec2d235 100644 --- a/Spigot-Server-Patches/0220-Implement-EntityTeleportEndGatewayEvent.patch +++ b/Spigot-Server-Patches/0220-Implement-EntityTeleportEndGatewayEvent.patch @@ -4,11 +4,11 @@ Date: Sat, 9 Jun 2018 14:08:39 +0200 Subject: [PATCH] Implement EntityTeleportEndGatewayEvent -diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index 91dacc5de8d695b2ea9b2f8b4547f6dbba0451ad..a242dd1f7ca7f2d93312d630173397a3abd83b1d 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java -+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -@@ -169,9 +169,20 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java +index 8f2db48201925f4a5dac5dfc19bb2b96438959e1..1d90cb32560a9102ebe43dfa9806b407d0ee1bd1 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java +@@ -193,9 +193,20 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick } // CraftBukkit end diff --git a/Spigot-Server-Patches/0221-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch b/Spigot-Server-Patches/0221-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch index 0610fe1f9b..d2a1410a73 100644 --- a/Spigot-Server-Patches/0221-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch +++ b/Spigot-Server-Patches/0221-Unset-Ignited-flag-on-cancel-of-Explosion-Event.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Unset Ignited flag on cancel of Explosion Event Otherwise the creeper infinite explodes -diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index 78d136eed54b815f5c866d3ab0d96c1d819bc6b2..b0de5c0705983debd7995c586612a7802f6d8f59 100644 ---- a/src/main/java/net/minecraft/server/EntityCreeper.java -+++ b/src/main/java/net/minecraft/server/EntityCreeper.java -@@ -13,7 +13,7 @@ public class EntityCreeper extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java +index e3124c46f740df3a24b22128d50ce7efb7d76f17..ea15f54b70361bca529936e6d2e9bc555c60a657 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java +@@ -48,7 +48,7 @@ public class EntityCreeper extends EntityMonster { private static final DataWatcherObject b = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.b); private static final DataWatcherObject POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); @@ -18,7 +18,7 @@ index 78d136eed54b815f5c866d3ab0d96c1d819bc6b2..b0de5c0705983debd7995c586612a780 private int bo; private int fuseTicks; public int maxFuseTicks = 30; -@@ -218,6 +218,7 @@ public class EntityCreeper extends EntityMonster { +@@ -253,6 +253,7 @@ public class EntityCreeper extends EntityMonster { this.createEffectCloud(); } else { fuseTicks = 0; diff --git a/Spigot-Server-Patches/0222-Fix-CraftEntity-hashCode.patch b/Spigot-Server-Patches/0222-Fix-CraftEntity-hashCode.patch index 5f2f43d37a..bb0a09f3ce 100644 --- a/Spigot-Server-Patches/0222-Fix-CraftEntity-hashCode.patch +++ b/Spigot-Server-Patches/0222-Fix-CraftEntity-hashCode.patch @@ -21,10 +21,10 @@ check is essentially the same as this.getHandle() == other.getHandle() However, replaced it too to make it clearer of intent. diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 976dbe680ef56095071b0416d5e1f0d68cf546e6..8eff62bcdc424cd8c040fd95124d11009f27a0d6 100644 +index 4c2a35fb33da19a15a220dc5e0c9fa3233d657fb..3642b17cafffd2818ee7a18d26bc25645f596115 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -746,14 +746,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -745,14 +745,15 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { return false; } final CraftEntity other = (CraftEntity) obj; diff --git a/Spigot-Server-Patches/0223-Configurable-Alternative-LootPool-Luck-Formula.patch b/Spigot-Server-Patches/0223-Configurable-Alternative-LootPool-Luck-Formula.patch index 3b713756c7..e0ee8431f3 100644 --- a/Spigot-Server-Patches/0223-Configurable-Alternative-LootPool-Luck-Formula.patch +++ b/Spigot-Server-Patches/0223-Configurable-Alternative-LootPool-Luck-Formula.patch @@ -52,11 +52,11 @@ index 05a5abb951abe37f30a719cb75376d2d43c0d252..77a03abd59db4a43f6f2d59d4c7ef176 + } + } } -diff --git a/src/main/java/net/minecraft/server/LootSelectorEntry.java b/src/main/java/net/minecraft/server/LootSelectorEntry.java -index ee9069c744df63cbb7f21dd9d28d6d554593674c..ca18d3156fd2b10f8ee48ff02f6f47e6e649200b 100644 ---- a/src/main/java/net/minecraft/server/LootSelectorEntry.java -+++ b/src/main/java/net/minecraft/server/LootSelectorEntry.java -@@ -11,8 +11,8 @@ import org.apache.commons.lang3.ArrayUtils; +diff --git a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java +index ceb9a1e1b1d55a0a8cd74189450f356b9ad4c46c..632002c4db01ca3f3c19aa583226cf36f17afe7f 100644 +--- a/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java ++++ b/src/main/java/net/minecraft/world/level/storage/loot/entries/LootSelectorEntry.java +@@ -20,8 +20,8 @@ import org.apache.commons.lang3.ArrayUtils; public abstract class LootSelectorEntry extends LootEntryAbstract { @@ -67,7 +67,7 @@ index ee9069c744df63cbb7f21dd9d28d6d554593674c..ca18d3156fd2b10f8ee48ff02f6f47e6 protected final LootItemFunction[] f; private final BiFunction g; private final LootEntry h = new LootSelectorEntry.c() { -@@ -143,11 +143,38 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { +@@ -152,11 +152,38 @@ public abstract class LootSelectorEntry extends LootEntryAbstract { public abstract class c implements LootEntry { diff --git a/Spigot-Server-Patches/0224-Print-Error-details-when-failing-to-save-player-data.patch b/Spigot-Server-Patches/0224-Print-Error-details-when-failing-to-save-player-data.patch index 92b60883de..de373f15f0 100644 --- a/Spigot-Server-Patches/0224-Print-Error-details-when-failing-to-save-player-data.patch +++ b/Spigot-Server-Patches/0224-Print-Error-details-when-failing-to-save-player-data.patch @@ -4,11 +4,11 @@ Date: Fri, 15 Jun 2018 20:37:03 -0400 Subject: [PATCH] Print Error details when failing to save player data -diff --git a/src/main/java/net/minecraft/server/WorldNBTStorage.java b/src/main/java/net/minecraft/server/WorldNBTStorage.java -index 6a9e0e644801ddc5f18a47d15d5f6d5b6dc13004..b5cf60495b85c6ae6c32ee8a1c65d80e59fdce3d 100644 ---- a/src/main/java/net/minecraft/server/WorldNBTStorage.java -+++ b/src/main/java/net/minecraft/server/WorldNBTStorage.java -@@ -36,7 +36,7 @@ public class WorldNBTStorage { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java +index 191c9e9a00b9871038f60d54bc22620322f6bdbd..4d30ca69dd303f1d76c8e6292021deda97851773 100644 +--- a/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldNBTStorage.java +@@ -43,7 +43,7 @@ public class WorldNBTStorage { SystemUtils.a(file1, file, file2); } catch (Exception exception) { diff --git a/Spigot-Server-Patches/0225-Make-shield-blocking-delay-configurable.patch b/Spigot-Server-Patches/0225-Make-shield-blocking-delay-configurable.patch index 5057fc41bc..10f4c7b786 100644 --- a/Spigot-Server-Patches/0225-Make-shield-blocking-delay-configurable.patch +++ b/Spigot-Server-Patches/0225-Make-shield-blocking-delay-configurable.patch @@ -18,11 +18,11 @@ index e8e1e7dafaf1c105b2f58cf3e118e3d665dc50ec..3e4bd1d6718d3ad2498fe9bd72eaac45 + shieldBlockingDelay = getInt("game-mechanics.shield-blocking-delay", 5); + } } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 087d961cb51dc3c9b24cf6e1785252c2c0afb296..f8c9c4e41faed2a76ca6ff4105351b09c2193cdd 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3218,7 +3218,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 1dcdf9e328670b42d656e8ab65cb3da8a2312fe6..9f6f6ac15688a1010d466e6f0cc3ac5b8297eb21 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3311,7 +3311,7 @@ public abstract class EntityLiving extends Entity { if (this.isHandRaised() && !this.activeItem.isEmpty()) { Item item = this.activeItem.getItem(); @@ -31,7 +31,7 @@ index 087d961cb51dc3c9b24cf6e1785252c2c0afb296..f8c9c4e41faed2a76ca6ff4105351b09 } else { return false; } -@@ -3474,4 +3474,15 @@ public abstract class EntityLiving extends Entity { +@@ -3567,4 +3567,15 @@ public abstract class EntityLiving extends Entity { public void broadcastItemBreak(EnumHand enumhand) { this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND); } @@ -48,7 +48,7 @@ index 087d961cb51dc3c9b24cf6e1785252c2c0afb296..f8c9c4e41faed2a76ca6ff4105351b09 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index e99e8e6f889edfa889619a12f9bfa4bfbde9a5a1..2e146ec4ba0c6db67c558a48ce5ec60bc2ca337f 100644 +index 49247437c91f1d8f24c2bf506d2de200758bad88..279de5299483d3fa2f0878d9fafb471d0b5c78a8 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -710,5 +710,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0226-Improve-EntityShootBowEvent.patch b/Spigot-Server-Patches/0226-Improve-EntityShootBowEvent.patch index 1ac847e796..4d145bf944 100644 --- a/Spigot-Server-Patches/0226-Improve-EntityShootBowEvent.patch +++ b/Spigot-Server-Patches/0226-Improve-EntityShootBowEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Improve EntityShootBowEvent Adds missing call to Illagers and also adds Arrow ItemStack to skeltons -diff --git a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -index b00a18643ea8425c5008a25563dbaa17d1a82ca4..50442b3a498d1bab4270e69952a79f5182153ece 100644 ---- a/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -+++ b/src/main/java/net/minecraft/server/EntityIllagerIllusioner.java -@@ -134,8 +134,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java b/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java +index 54a4a295660375a0fcc54e02d80d569d9a32e73e..fee9a5140f097225b5da58b18bfbd528dffdc77b 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityIllagerIllusioner.java +@@ -171,8 +171,18 @@ public class EntityIllagerIllusioner extends EntityIllagerWizard implements IRan double d3 = (double) MathHelper.sqrt(d0 * d0 + d2 * d2); entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); @@ -29,16 +29,16 @@ index b00a18643ea8425c5008a25563dbaa17d1a82ca4..50442b3a498d1bab4270e69952a79f51 } class a extends EntityIllagerWizard.PathfinderGoalCastSpell { -diff --git a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -index 48c7ba6ecc4ab42805363e31d0864fb685c8d3ca..ced89af70ca791bfe42c4e2d21604997a0cf3e0f 100644 ---- a/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -+++ b/src/main/java/net/minecraft/server/EntitySkeletonAbstract.java -@@ -155,7 +155,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java +index a2a67bccf38464731670e98cb155348df94474c5..4dca5ea9127c15b2739483b2ad74a5296a6b96ad 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySkeletonAbstract.java +@@ -197,7 +197,7 @@ public abstract class EntitySkeletonAbstract extends EntityMonster implements IR entityarrow.shoot(d0, d1 + d3 * 0.20000000298023224D, d2, 1.6F, (float) (14 - this.world.getDifficulty().a() * 4)); // CraftBukkit start -- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, EnumHand.MAIN_HAND, 0.8F, true); -+ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, EnumHand.MAIN_HAND, 0.8F, true); // Paper +- org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), null, entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); ++ org.bukkit.event.entity.EntityShootBowEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityShootBowEvent(this, this.getItemInMainHand(), entityarrow.getOriginalItemStack(), entityarrow, net.minecraft.world.EnumHand.MAIN_HAND, 0.8F, true); // Paper if (event.isCancelled()) { event.getProjectile().remove(); return; diff --git a/Spigot-Server-Patches/0227-PlayerReadyArrowEvent.patch b/Spigot-Server-Patches/0227-PlayerReadyArrowEvent.patch index 81b2134e91..a2b39a4c9f 100644 --- a/Spigot-Server-Patches/0227-PlayerReadyArrowEvent.patch +++ b/Spigot-Server-Patches/0227-PlayerReadyArrowEvent.patch @@ -6,11 +6,11 @@ Subject: [PATCH] PlayerReadyArrowEvent Called when a player is firing a bow and the server is choosing an arrow to use. Plugins can skip selection of certain arrows and control which is used. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index c0c8373af47d24a8b9c25a3bebb59b13626a3733..67df400f80b8bbafecaefa3e8986dd7fe615fd04 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -2045,6 +2045,17 @@ public abstract class EntityHuman extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index e6b75b6a493f91ccdd67fa507c9869b4007fb907..5a5d6b867d985b55a1bc7286606f73ee5874245f 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -2139,6 +2139,17 @@ public abstract class EntityHuman extends EntityLiving { return ImmutableList.of(EntityPose.STANDING, EntityPose.CROUCHING, EntityPose.SWIMMING); } @@ -28,7 +28,7 @@ index c0c8373af47d24a8b9c25a3bebb59b13626a3733..67df400f80b8bbafecaefa3e8986dd7f @Override public ItemStack f(ItemStack itemstack) { if (!(itemstack.getItem() instanceof ItemProjectileWeapon)) { -@@ -2061,7 +2072,7 @@ public abstract class EntityHuman extends EntityLiving { +@@ -2155,7 +2166,7 @@ public abstract class EntityHuman extends EntityLiving { for (int i = 0; i < this.inventory.getSize(); ++i) { ItemStack itemstack2 = this.inventory.getItem(i); diff --git a/Spigot-Server-Patches/0228-Implement-EntityKnockbackByEntityEvent.patch b/Spigot-Server-Patches/0228-Implement-EntityKnockbackByEntityEvent.patch index a2fcf1da11..d646001a8d 100644 --- a/Spigot-Server-Patches/0228-Implement-EntityKnockbackByEntityEvent.patch +++ b/Spigot-Server-Patches/0228-Implement-EntityKnockbackByEntityEvent.patch @@ -5,33 +5,11 @@ Subject: [PATCH] Implement EntityKnockbackByEntityEvent This event is called when an entity receives knockback by another entity. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 67df400f80b8bbafecaefa3e8986dd7fe615fd04..f95e46e80f9e572227ee98cc181098c36f1dd5fe 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -1080,7 +1080,7 @@ public abstract class EntityHuman extends EntityLiving { - if (flag5) { - if (i > 0) { - if (entity instanceof EntityLiving) { -- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); -+ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper - } else { - entity.i((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); - } -@@ -1104,7 +1104,7 @@ public abstract class EntityHuman extends EntityLiving { - if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { - // CraftBukkit start - Only apply knockback if the damage hits - if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) { -- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); -+ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper - } - // CraftBukkit end - } -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 6274cf1975270fdac8ae4986e1c170bd075d640e..fbecc8ccab47b428c43530ad344e325538cf242d 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -1500,7 +1500,7 @@ public abstract class EntityInsentient extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 0387052b45cdc849d9e67113532a7591f05e5531..486f4727dbcb7955103f854baed9b571fb3b9f3e 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -1565,7 +1565,7 @@ public abstract class EntityInsentient extends EntityLiving { if (flag) { if (f1 > 0.0F && entity instanceof EntityLiving) { @@ -40,11 +18,11 @@ index 6274cf1975270fdac8ae4986e1c170bd075d640e..fbecc8ccab47b428c43530ad344e3255 this.setMot(this.getMot().d(0.6D, 1.0D, 0.6D)); } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 646db2c9c3a05ac024ef43f65e9b8416154d7e90..2ac85eec14479415c0dd56e1aa255324715df23d 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1246,7 +1246,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 9f6f6ac15688a1010d466e6f0cc3ac5b8297eb21..61bd7afdafc77725c24c6af978578df0b2d8ca0f 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -1339,7 +1339,7 @@ public abstract class EntityLiving extends Entity { } this.ap = (float) (MathHelper.d(d1, d0) * 57.2957763671875D - (double) this.yaw); @@ -53,7 +31,7 @@ index 646db2c9c3a05ac024ef43f65e9b8416154d7e90..2ac85eec14479415c0dd56e1aa255324 } else { this.ap = (float) ((int) (Math.random() * 2.0D) * 180); } -@@ -1294,7 +1294,7 @@ public abstract class EntityLiving extends Entity { +@@ -1387,7 +1387,7 @@ public abstract class EntityLiving extends Entity { } protected void e(EntityLiving entityliving) { @@ -62,7 +40,7 @@ index 646db2c9c3a05ac024ef43f65e9b8416154d7e90..2ac85eec14479415c0dd56e1aa255324 } private boolean f(DamageSource damagesource) { -@@ -1537,6 +1537,11 @@ public abstract class EntityLiving extends Entity { +@@ -1630,6 +1630,11 @@ public abstract class EntityLiving extends Entity { } public void a(float f, double d0, double d1) { @@ -74,7 +52,7 @@ index 646db2c9c3a05ac024ef43f65e9b8416154d7e90..2ac85eec14479415c0dd56e1aa255324 f = (float) ((double) f * (1.0D - this.b(GenericAttributes.KNOCKBACK_RESISTANCE))); if (f > 0.0F) { this.impulse = true; -@@ -1544,6 +1549,16 @@ public abstract class EntityLiving extends Entity { +@@ -1637,6 +1642,16 @@ public abstract class EntityLiving extends Entity { Vec3D vec3d1 = (new Vec3D(d0, 0.0D, d1)).d().a((double) f); this.setMot(vec3d.x / 2.0D - vec3d1.x, this.onGround ? Math.min(0.4D, vec3d.y / 2.0D + (double) f) : vec3d.y, vec3d.z / 2.0D - vec3d1.z); @@ -91,3 +69,25 @@ index 646db2c9c3a05ac024ef43f65e9b8416154d7e90..2ac85eec14479415c0dd56e1aa255324 } } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 5a5d6b867d985b55a1bc7286606f73ee5874245f..e9dd1ee6dbc8baff395c69e2cb1d7b3a4551f90a 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -1174,7 +1174,7 @@ public abstract class EntityHuman extends EntityLiving { + if (flag5) { + if (i > 0) { + if (entity instanceof EntityLiving) { +- ((EntityLiving) entity).a((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ ((EntityLiving) entity).doKnockback((float) i * 0.5F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper + } else { + entity.i((double) (-MathHelper.sin(this.yaw * 0.017453292F) * (float) i * 0.5F), 0.1D, (double) (MathHelper.cos(this.yaw * 0.017453292F) * (float) i * 0.5F)); + } +@@ -1198,7 +1198,7 @@ public abstract class EntityHuman extends EntityLiving { + if (entityliving != this && entityliving != entity && !this.r(entityliving) && (!(entityliving instanceof EntityArmorStand) || !((EntityArmorStand) entityliving).isMarker()) && this.h((Entity) entityliving) < 9.0D) { + // CraftBukkit start - Only apply knockback if the damage hits + if (entityliving.damageEntity(DamageSource.playerAttack(this).sweep(), f4)) { +- entityliving.a(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F))); ++ entityliving.doKnockback(0.4F, (double) MathHelper.sin(this.yaw * 0.017453292F), (double) (-MathHelper.cos(this.yaw * 0.017453292F)), this); // Paper + } + // CraftBukkit end + } diff --git a/Spigot-Server-Patches/0230-LivingEntity-Hand-Raised-Item-Use-API.patch b/Spigot-Server-Patches/0230-LivingEntity-Hand-Raised-Item-Use-API.patch index 4007ea47c2..6a8ff6c92e 100644 --- a/Spigot-Server-Patches/0230-LivingEntity-Hand-Raised-Item-Use-API.patch +++ b/Spigot-Server-Patches/0230-LivingEntity-Hand-Raised-Item-Use-API.patch @@ -5,11 +5,11 @@ Subject: [PATCH] LivingEntity Hand Raised/Item Use API How long an entity has raised hands to charge an attack or use an item -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 014f27ab7c183e3b416e96d6bbbbfc776e54ca84..e118f96fb9b67874ec86db8dede00cf34473e085 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -119,7 +119,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 61bd7afdafc77725c24c6af978578df0b2d8ca0f..189a00cb68ce9a9060117b79c5356ebb93d7fa62 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -212,7 +212,7 @@ public abstract class EntityLiving extends Entity { private float bu; private int jumpTicks; private float bw; @@ -18,7 +18,7 @@ index 014f27ab7c183e3b416e96d6bbbbfc776e54ca84..e118f96fb9b67874ec86db8dede00cf3 protected int bd; protected int be; private BlockPosition bx; -@@ -3201,10 +3201,12 @@ public abstract class EntityLiving extends Entity { +@@ -3294,10 +3294,12 @@ public abstract class EntityLiving extends Entity { return this.activeItem; } @@ -32,7 +32,7 @@ index 014f27ab7c183e3b416e96d6bbbbfc776e54ca84..e118f96fb9b67874ec86db8dede00cf3 return this.isHandRaised() ? this.activeItem.k() - this.dZ() : 0; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 2e146ec4ba0c6db67c558a48ce5ec60bc2ca337f..a91070c3674dc47e0019e642f0f76a3cf76b7387 100644 +index 279de5299483d3fa2f0878d9fafb471d0b5c78a8..db58175ac8972a4a9f5b7b312c6301f87e943a0e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -720,5 +720,25 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0231-RangedEntity-API.patch b/Spigot-Server-Patches/0231-RangedEntity-API.patch index 7fceb3bbfb..e0765e9b69 100644 --- a/Spigot-Server-Patches/0231-RangedEntity-API.patch +++ b/Spigot-Server-Patches/0231-RangedEntity-API.patch @@ -8,13 +8,13 @@ and to perform an attack. diff --git a/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java new file mode 100644 -index 0000000000000000000000000000000000000000..696660b089ba355f865e5051237eefd0df667857 +index 0000000000000000000000000000000000000000..0195d4036f06db0f3f56f134dbfbc4360d44ed86 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/CraftRangedEntity.java @@ -0,0 +1,19 @@ +package com.destroystokyo.paper.entity; + -+import net.minecraft.server.IRangedEntity; ++import net.minecraft.world.entity.monster.IRangedEntity; +import org.bukkit.craftbukkit.entity.CraftLivingEntity; +import org.bukkit.entity.LivingEntity; + @@ -31,11 +31,11 @@ index 0000000000000000000000000000000000000000..696660b089ba355f865e5051237eefd0 + getHandle().setChargingAttack(raiseHands); + } +} -diff --git a/src/main/java/net/minecraft/server/IRangedEntity.java b/src/main/java/net/minecraft/server/IRangedEntity.java -index b4178ce1e86ad40b64a229e066f058a8e848324d..fbfed5140539384bdd31e0f2777a3f92690d2576 100644 ---- a/src/main/java/net/minecraft/server/IRangedEntity.java -+++ b/src/main/java/net/minecraft/server/IRangedEntity.java -@@ -2,5 +2,8 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java b/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java +index d79e6b28c77edc468c6471d909306c2135b496c7..0f0aaa8a15301dea8405e26333d30b385831506c 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java ++++ b/src/main/java/net/minecraft/world/entity/monster/IRangedEntity.java +@@ -4,5 +4,8 @@ import net.minecraft.world.entity.EntityLiving; public interface IRangedEntity { @@ -46,43 +46,33 @@ index b4178ce1e86ad40b64a229e066f058a8e848324d..fbfed5140539384bdd31e0f2777a3f92 + void setAggressive(boolean flag); default void setChargingAttack(boolean charging) { setAggressive(charging); }; // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java -index 6e41dfd92344e3de71642879993cf25a5dd8b30a..390183fffd952e583a7d7df9ae618458fb48d278 100644 +index 3bb39dae11847bea1330ef68f53c90309fd2a095..bba2e3fba5b225e90744e78df085b3c318a029ce 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftDrowned.java -@@ -1,11 +1,12 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntityDrowned; - import org.bukkit.craftbukkit.CraftServer; +@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.Drowned; import org.bukkit.entity.EntityType; -public class CraftDrowned extends CraftZombie implements Drowned { -+public class CraftDrowned extends CraftZombie implements Drowned, CraftRangedEntity { // Paper ++public class CraftDrowned extends CraftZombie implements Drowned, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftDrowned(CraftServer server, EntityDrowned entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java -index 2ec1af8be419d94dfde8fe2cc46bae88751a9d8f..f31d3eed3a53d171596b888351064f6d70986785 100644 +index 0dabb012b37b6dda58368765b220b7d0aaf8e2d4..3763fb13920c98bb7cd250883ec89cdd1805dbd6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftIllusioner.java -@@ -1,11 +1,12 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntityIllagerIllusioner; - import org.bukkit.craftbukkit.CraftServer; +@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Illusioner; -public class CraftIllusioner extends CraftSpellcaster implements Illusioner { -+public class CraftIllusioner extends CraftSpellcaster implements Illusioner, CraftRangedEntity { // Paper ++public class CraftIllusioner extends CraftSpellcaster implements Illusioner, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftIllusioner(CraftServer server, EntityIllagerIllusioner entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java -index 058010b9910a672264f198fcdcd17be42312e571..71faa1b38f613db468ee939a7ffac7aaed733d20 100644 +index 6dcf196fd83f2175a5d34c8d138d923c32ddb899..818034c62893a71808e3af0aa33393605611acdd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLlama.java @@ -1,5 +1,6 @@ @@ -90,7 +80,7 @@ index 058010b9910a672264f198fcdcd17be42312e571..71faa1b38f613db468ee939a7ffac7aa +import com.destroystokyo.paper.entity.CraftRangedEntity; import com.google.common.base.Preconditions; - import net.minecraft.server.EntityLlama; + import net.minecraft.world.entity.animal.horse.EntityLlama; import org.bukkit.craftbukkit.CraftServer; @@ -10,7 +11,7 @@ import org.bukkit.entity.Llama; import org.bukkit.entity.Llama.Color; @@ -102,117 +92,80 @@ index 058010b9910a672264f198fcdcd17be42312e571..71faa1b38f613db468ee939a7ffac7aa public CraftLlama(CraftServer server, EntityLlama entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java -index 6f83387c4c0978b427e64867f586890974dd9cbe..a7161a487ca9ff93b540a0b47e1ad47d55885735 100644 +index a224ebf16834fa10e169fa3239d89b1e60673dbb..b3b5d3a7f8ed522680f764cfd20d1e5c69627804 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPiglin.java -@@ -1,11 +1,13 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper -+ - import net.minecraft.server.EntityPiglin; - import org.bukkit.craftbukkit.CraftServer; +@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Piglin; -public class CraftPiglin extends CraftPiglinAbstract implements Piglin { -+public class CraftPiglin extends CraftPiglinAbstract implements Piglin, CraftRangedEntity { // Paper ++public class CraftPiglin extends CraftPiglinAbstract implements Piglin, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftPiglin(CraftServer server, EntityPiglin entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java -index 9c659d764b57adf7b5dda0dbd7358cf9df1a1065..662caa42ebb51c3a1ecf0fbe21605589882f62d0 100644 +index 72ac9eae71028a40541f949d617ce326c00c6369..87eeb5b632b581dca7613973bc9a25f152839a33 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPillager.java -@@ -1,5 +1,7 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper -+ - import net.minecraft.server.EntityPillager; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.craftbukkit.inventory.CraftInventory; -@@ -7,7 +9,7 @@ import org.bukkit.entity.EntityType; +@@ -7,7 +7,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Pillager; import org.bukkit.inventory.Inventory; -public class CraftPillager extends CraftIllager implements Pillager { -+public class CraftPillager extends CraftIllager implements Pillager, CraftRangedEntity { // Paper ++public class CraftPillager extends CraftIllager implements Pillager, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftPillager(CraftServer server, EntityPillager entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -index 1cd359b3d5e8a68edda9cecce30bd9dc4beadee2..cf68b17745e2fbd8769e6b73d54b908e957e4a88 100644 +index cebb90fd4a84c0a97d7493a6923d16d0c4215f5e..c2acfa2cc27a187154e17b7f45908682b41b52af 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeleton.java -@@ -1,12 +1,13 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntitySkeletonAbstract; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; +@@ -6,7 +6,7 @@ import org.bukkit.entity.EntityType; import org.bukkit.entity.Skeleton; import org.bukkit.entity.Skeleton.SkeletonType; -public class CraftSkeleton extends CraftMonster implements Skeleton { -+public class CraftSkeleton extends CraftMonster implements Skeleton, CraftRangedEntity { // Paper ++public class CraftSkeleton extends CraftMonster implements Skeleton, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftSkeleton(CraftServer server, EntitySkeletonAbstract entity) { super(server, entity); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java -index 27460c59e399bbe2a38eeb6256a8985ed9a04655..e482b1c9dc01b9fdac91681ff116cd21b06fc031 100644 +index 5720bdf64eadec1ebe1a2253e2b537ca299ffa6d..a262cf88eefca2767eb6e5da856626be34352ccd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSnowman.java -@@ -1,11 +1,12 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntitySnowman; - import org.bukkit.craftbukkit.CraftServer; +@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Snowman; -public class CraftSnowman extends CraftGolem implements Snowman { -+public class CraftSnowman extends CraftGolem implements Snowman, CraftRangedEntity { // Paper ++public class CraftSnowman extends CraftGolem implements Snowman, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftSnowman(CraftServer server, EntitySnowman entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -index 244e4dc8ec740e8071f249de7f461d3c3efe7199..bae107e76e4c8df446d4a7be8dda291d820074d7 100644 +index 796bd26d41b52941c38d81411688116af7053535..9cc34cdb43596eff34625045f884b93da3f27ab6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -@@ -1,11 +1,12 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper - import net.minecraft.server.EntityWitch; - import org.bukkit.craftbukkit.CraftServer; +@@ -5,7 +5,7 @@ import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Witch; -public class CraftWitch extends CraftRaider implements Witch { -+public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity { // Paper ++public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftWitch(CraftServer server, EntityWitch entity) { super(server, entity); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -index 38b555cc7ef80dc15ca8d37911b2acab5676e6a1..03cf6136e64bab7180933e106234b92c1255268d 100644 +index 7150702d8dac0d9db44661b1b17f520302988b45..1d94aeec37dcb9758d88ef25a5cad1333bbfbf6c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -@@ -1,5 +1,6 @@ - package org.bukkit.craftbukkit.entity; - -+import com.destroystokyo.paper.entity.CraftRangedEntity; - import net.minecraft.server.EntityWither; - import org.bukkit.boss.BossBar; - import org.bukkit.craftbukkit.CraftServer; -@@ -7,7 +8,7 @@ import org.bukkit.craftbukkit.boss.CraftBossBar; +@@ -7,7 +7,7 @@ import org.bukkit.craftbukkit.boss.CraftBossBar; import org.bukkit.entity.EntityType; import org.bukkit.entity.Wither; -public class CraftWither extends CraftMonster implements Wither { -+public class CraftWither extends CraftMonster implements Wither, CraftRangedEntity { // Paper ++public class CraftWither extends CraftMonster implements Wither, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper private BossBar bossBar; diff --git a/Spigot-Server-Patches/0232-Add-config-to-disable-ender-dragon-legacy-check.patch b/Spigot-Server-Patches/0232-Add-config-to-disable-ender-dragon-legacy-check.patch index 7ded062a2e..153410f43a 100644 --- a/Spigot-Server-Patches/0232-Add-config-to-disable-ender-dragon-legacy-check.patch +++ b/Spigot-Server-Patches/0232-Add-config-to-disable-ender-dragon-legacy-check.patch @@ -18,11 +18,11 @@ index 3e4bd1d6718d3ad2498fe9bd72eaac45044ecb77..4813f62d1e382d5ac6971b2244df3f13 + scanForLegacyEnderDragon = getBoolean("game-mechanics.scan-for-legacy-ender-dragon", true); + } } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index e77634bb4d33716ed41468722187080ae7243f3d..47182c5004f8023faeecec14a7fd090d40a14270 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -31,7 +31,7 @@ public class EnderDragonBattle { +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +index f727cc456bd23816c4e70be83c395d1d8ca7d876..0869af4670f040344f5b6c2c10bff5e5226f707c 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -73,7 +73,7 @@ public class EnderDragonBattle { private boolean dragonKilled; private boolean previouslyKilled; public UUID dragonUUID; @@ -31,7 +31,7 @@ index e77634bb4d33716ed41468722187080ae7243f3d..47182c5004f8023faeecec14a7fd090d public BlockPosition exitPortalLocation; public EnumDragonRespawn respawnPhase; private int q; -@@ -41,6 +41,10 @@ public class EnderDragonBattle { +@@ -83,6 +83,10 @@ public class EnderDragonBattle { this.bossBattle = (BossBattleServer) (new BossBattleServer(new ChatMessage("entity.minecraft.ender_dragon"), BossBattle.BarColor.PINK, BossBattle.BarStyle.PROGRESS)).setPlayMusic(true).c(true); this.gateways = Lists.newArrayList(); this.n = true; diff --git a/Spigot-Server-Patches/0234-InventoryCloseEvent-Reason-API.patch b/Spigot-Server-Patches/0234-InventoryCloseEvent-Reason-API.patch index 426141e7e4..ca44862bba 100644 --- a/Spigot-Server-Patches/0234-InventoryCloseEvent-Reason-API.patch +++ b/Spigot-Server-Patches/0234-InventoryCloseEvent-Reason-API.patch @@ -6,38 +6,11 @@ Subject: [PATCH] InventoryCloseEvent Reason API Allows you to determine why an inventory was closed, enabling plugin developers to "confirm" things based on if it was player triggered close or not. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index f95e46e80f9e572227ee98cc181098c36f1dd5fe..67e14b606f9eb83e111e76665bd1228034193513 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -155,7 +155,7 @@ public abstract class EntityHuman extends EntityLiving { - this.et(); - super.tick(); - if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) { -- this.closeInventory(); -+ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper - this.activeContainer = this.defaultContainer; - } - -@@ -350,6 +350,13 @@ public abstract class EntityHuman extends EntityLiving { - return 20; - } - -+ // Paper start - unused code, but to keep signatures aligned -+ public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { -+ closeInventory(); -+ this.activeContainer = this.defaultContainer; -+ } -+ // Paper end -+ - public void closeInventory() { - this.activeContainer = this.defaultContainer; - } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d..c0b1643dfb4701f0d790bcfae75ede417d5a3522 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -419,7 +419,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 8b79d547a3296f056731cbb66508494d84809e94..b3c5a22bf2eb360399ebfbf90fc74843dcd78509 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -546,7 +546,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // Paper end if (!this.world.isClientSide && !this.activeContainer.canUse(this)) { @@ -46,7 +19,7 @@ index 42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d..c0b1643dfb4701f0d790bcfae75ede41 this.activeContainer = this.defaultContainer; } -@@ -592,7 +592,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -719,7 +719,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { // SPIGOT-943 - only call if they have an inventory open if (this.activeContainer != this.defaultContainer) { @@ -55,7 +28,7 @@ index 42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d..c0b1643dfb4701f0d790bcfae75ede41 } net.kyori.adventure.text.Component deathMessage = event.deathMessage() != null ? event.deathMessage() : net.kyori.adventure.text.Component.empty(); // Paper - Adventure -@@ -1157,7 +1157,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1284,7 +1284,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return OptionalInt.empty(); } else { if (this.activeContainer != this.defaultContainer) { @@ -64,7 +37,7 @@ index 42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d..c0b1643dfb4701f0d790bcfae75ede41 } this.nextContainerCounter(); -@@ -1217,7 +1217,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1344,7 +1344,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // CraftBukkit end if (this.activeContainer != this.defaultContainer) { @@ -73,7 +46,7 @@ index 42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d..c0b1643dfb4701f0d790bcfae75ede41 } // this.nextContainerCounter(); // CraftBukkit - moved up -@@ -1281,7 +1281,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1408,7 +1408,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @Override public void closeInventory() { @@ -87,11 +60,33 @@ index 42bf31bd9569a8f1c2b36f1c3a2c5c0d805c9b5d..c0b1643dfb4701f0d790bcfae75ede41 this.playerConnection.sendPacket(new PacketPlayOutCloseWindow(this.activeContainer.windowId)); this.o(); } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 6051ceba109350fdb07f476df97a1f27345f20f1..7a52e92de0f0b1fccfc07045701d1b86f208290f 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -45,6 +45,7 @@ import org.bukkit.event.inventory.ClickType; +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 3876958f20e675c4c8fd505c5fb333ccb9cdc8c9..eb909ef3a34045480034bd7d7f3e5ac674f664b5 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1123,7 +1123,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + for (TileEntity tileentity : chunk.getTileEntities().values()) { + if (tileentity instanceof net.minecraft.world.IInventory) { + for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((net.minecraft.world.IInventory) tileentity).getViewers())) { +- h.closeInventory(); ++ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper + } + } + } +@@ -1181,7 +1181,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + // Spigot Start + if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { + for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { +- h.closeInventory(); ++ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper + } + } + // Spigot End +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 415f34109019e68638f76fefa52bd8d40c449e12..c4f14fabc83a9cb13f8f82b651119e0ac7d8aa02 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -190,6 +190,7 @@ import org.bukkit.event.inventory.ClickType; import org.bukkit.event.inventory.CraftItemEvent; import org.bukkit.event.inventory.InventoryAction; import org.bukkit.event.inventory.InventoryClickEvent; @@ -99,7 +94,7 @@ index 6051ceba109350fdb07f476df97a1f27345f20f1..7a52e92de0f0b1fccfc07045701d1b86 import org.bukkit.event.inventory.InventoryCreativeEvent; import org.bukkit.event.inventory.InventoryType.SlotType; import org.bukkit.event.player.AsyncPlayerChatEvent; -@@ -2163,10 +2164,15 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2308,10 +2309,15 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInCloseWindow packetplayinclosewindow) { @@ -116,11 +111,11 @@ index 6051ceba109350fdb07f476df97a1f27345f20f1..7a52e92de0f0b1fccfc07045701d1b86 this.player.o(); } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 2411832c96794f3c39a5e9083b20217880f773ff..ec175cd90491c3473543daa0b565fdc453888a34 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -418,7 +418,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 41b63da42067397122897d23fd7fb0e517d7c552..2939a8186254a39ef20d778421b0ed984bb20a32 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -493,7 +493,7 @@ public abstract class PlayerList { // CraftBukkit start - Quitting must be before we do final save of data, in case plugins need to modify it // See SPIGOT-5799, SPIGOT-6145 if (entityplayer.activeContainer != entityplayer.defaultContainer) { @@ -129,30 +124,35 @@ index 2411832c96794f3c39a5e9083b20217880f773ff..ec175cd90491c3473543daa0b565fdc4 } PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getName()))); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d192e341f0f6a3d03329dab16de3b19962091d2a..1a2760552cd42b302d4604917daf1fcd23765e59 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1014,7 +1014,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - for (TileEntity tileentity : chunk.getTileEntities().values()) { - if (tileentity instanceof IInventory) { - for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((IInventory) tileentity).getViewers())) { -- h.closeInventory(); -+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - } - } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index e9dd1ee6dbc8baff395c69e2cb1d7b3a4551f90a..5f92ba350658c7f1cac9111f06d95e6ffc5600c3 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -249,7 +249,7 @@ public abstract class EntityHuman extends EntityLiving { + this.et(); + super.tick(); + if (!this.world.isClientSide && this.activeContainer != null && !this.activeContainer.canUse(this)) { +- this.closeInventory(); ++ this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper + this.activeContainer = this.defaultContainer; } -@@ -1072,7 +1072,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - // Spigot Start - if (entity.getBukkitEntity() instanceof org.bukkit.inventory.InventoryHolder) { - for (org.bukkit.entity.HumanEntity h : Lists.newArrayList(((org.bukkit.inventory.InventoryHolder) entity.getBukkitEntity()).getInventory().getViewers())) { -- h.closeInventory(); -+ h.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.UNLOADED); // Paper - } - } - // Spigot End + +@@ -444,6 +444,13 @@ public abstract class EntityHuman extends EntityLiving { + return 20; + } + ++ // Paper start - unused code, but to keep signatures aligned ++ public void closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason reason) { ++ closeInventory(); ++ this.activeContainer = this.defaultContainer; ++ } ++ // Paper end ++ + public void closeInventory() { + this.activeContainer = this.defaultContainer; + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index b0142be8baeda1dbb921e171d903eea02953b5b2..8b692e93706fc571433df55f01428c846baf01f8 100644 +index a3396a19ba60daeb7240f23831e4bc28631098cc..2ca9d061ec951fb0563959620f0e99590e3038af 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -372,7 +372,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { @@ -180,7 +180,7 @@ index b0142be8baeda1dbb921e171d903eea02953b5b2..8b692e93706fc571433df55f01428c84 @Override public boolean isBlocking() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 9a49fb71a55aca88ed43322769bdb3c5605ea4b6..aab2f601bf6196e9a23762346d5e22e917f603ab 100644 +index 5a9b23fd4a414c52ce4b1ccb8696a4408b0b7c90..1851f261ce8e454cbe4012c0c4ea6a69e926daa0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -895,7 +895,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -193,7 +193,7 @@ index 9a49fb71a55aca88ed43322769bdb3c5605ea4b6..aab2f601bf6196e9a23762346d5e22e9 // Check if the fromWorld and toWorld are the same. diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 94a9ac289d858629684e2b98982c5c54b59efd0b..cc785729b522d1588897db870c55274a83c85f4e 100644 +index 8f60cc5bf1583b48c6052f7598e99b4c63203852..681eb48c568029d6e3c5fa140a2c330a5f27df6f 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1166,7 +1166,7 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0235-Vex-getSummoner-API.patch b/Spigot-Server-Patches/0235-Vex-getSummoner-API.patch index 27435743d2..c70d5e9bb3 100644 --- a/Spigot-Server-Patches/0235-Vex-getSummoner-API.patch +++ b/Spigot-Server-Patches/0235-Vex-getSummoner-API.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Vex#getSummoner API Get's the NPC that summoned this Vex -diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java -index b4bda8baff6ee124b0ec7aed155824a278f8ac50..00568a19d7a25189d599fc84afb6ca6d642e2855 100644 ---- a/src/main/java/net/minecraft/server/EntityVex.java -+++ b/src/main/java/net/minecraft/server/EntityVex.java -@@ -88,6 +88,7 @@ public class EntityVex extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java +index 3acf36a500424808cd91dc607df1ffbe23720c16..3b74ade60b3b0ae0e908866cb4ac11acd75620ff 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java +@@ -124,6 +124,7 @@ public class EntityVex extends EntityMonster { } @@ -18,28 +18,17 @@ index b4bda8baff6ee124b0ec7aed155824a278f8ac50..00568a19d7a25189d599fc84afb6ca6d return this.c; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java -index 737a37b6fe9cc4f6a93f7bae7e4f8326024929cc..169c951ec30fc5b78eb4ba29352ba009b7fa5efd 100644 +index ccaccffbf5eb18108760d1da09c4c1b2f33ebc42..962d6017f6acc47ebe4b754ccd9b97a1fc97cc58 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java -@@ -1,8 +1,10 @@ - package org.bukkit.craftbukkit.entity; - -+import net.minecraft.server.EntityInsentient; - import net.minecraft.server.EntityVex; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; -+import org.bukkit.entity.Mob; - import org.bukkit.entity.Vex; - - public class CraftVex extends CraftMonster implements Vex { -@@ -16,6 +18,13 @@ public class CraftVex extends CraftMonster implements Vex { +@@ -16,6 +16,13 @@ public class CraftVex extends CraftMonster implements Vex { return (EntityVex) super.getHandle(); } + // Paper start -+ public Mob getSummoner() { -+ EntityInsentient owner = getHandle().getOwner(); -+ return owner != null ? (Mob) owner.getBukkitEntity() : null; ++ public org.bukkit.entity.Mob getSummoner() { ++ net.minecraft.world.entity.EntityInsentient owner = getHandle().getOwner(); ++ return owner != null ? (org.bukkit.entity.Mob) owner.getBukkitEntity() : null; + } + // Paper end + diff --git a/Spigot-Server-Patches/0236-Refresh-player-inventory-when-cancelling-PlayerInter.patch b/Spigot-Server-Patches/0236-Refresh-player-inventory-when-cancelling-PlayerInter.patch index ae3bac9cfd..bdadbc4a03 100644 --- a/Spigot-Server-Patches/0236-Refresh-player-inventory-when-cancelling-PlayerInter.patch +++ b/Spigot-Server-Patches/0236-Refresh-player-inventory-when-cancelling-PlayerInter.patch @@ -15,11 +15,11 @@ The bucket is replaced with milk and the dye removed from inventory. Refresh the player inventory when PlayerInteractEntityEvent is cancelled to avoid this problem. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f4bcb078b53391976da1ea4ec95fdc62810bb8c7..2a23c11db0368f182fb50bc70ef682e46f96f5b2 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2076,6 +2076,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index c4f14fabc83a9cb13f8f82b651119e0ac7d8aa02..f727b6ffa0db33e59ce8e4ff64723c79b401ad70 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2221,6 +2221,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } if (event.isCancelled()) { diff --git a/Spigot-Server-Patches/0237-Don-t-change-the-Entity-Random-seed-for-squids.patch b/Spigot-Server-Patches/0237-Don-t-change-the-Entity-Random-seed-for-squids.patch index 14039f8d2a..e00010f9a0 100644 --- a/Spigot-Server-Patches/0237-Don-t-change-the-Entity-Random-seed-for-squids.patch +++ b/Spigot-Server-Patches/0237-Don-t-change-the-Entity-Random-seed-for-squids.patch @@ -4,11 +4,11 @@ Date: Thu, 19 Jul 2018 01:05:00 -0400 Subject: [PATCH] Don't change the Entity Random seed for squids -diff --git a/src/main/java/net/minecraft/server/EntitySquid.java b/src/main/java/net/minecraft/server/EntitySquid.java -index 050c4bdac8519250157b77c3221c99bd49e53a22..b21605a62365fe24f315f35bd840b4740fc80f0e 100644 ---- a/src/main/java/net/minecraft/server/EntitySquid.java -+++ b/src/main/java/net/minecraft/server/EntitySquid.java -@@ -21,7 +21,7 @@ public class EntitySquid extends EntityWaterAnimal { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java +index 2d9ac7baa924e6558727d58d43dbf6667f4f84a9..92ff03f8e8286f710fd5e63b4d103e489787d453 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntitySquid.java +@@ -47,7 +47,7 @@ public class EntitySquid extends EntityWaterAnimal { public EntitySquid(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/Spigot-Server-Patches/0238-Re-add-vanilla-entity-warnings-for-duplicates.patch b/Spigot-Server-Patches/0238-Re-add-vanilla-entity-warnings-for-duplicates.patch index ab1877e9b1..f3c28e7f60 100644 --- a/Spigot-Server-Patches/0238-Re-add-vanilla-entity-warnings-for-duplicates.patch +++ b/Spigot-Server-Patches/0238-Re-add-vanilla-entity-warnings-for-duplicates.patch @@ -7,11 +7,11 @@ These are a critical sign that somethin went wrong, and you've lost some data... We should kind of know about these things you know. -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index a0d1e9f7535db896c0589dc02cb03bda23086167..0156e97e736998ed63200d73f4244846050d8354 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -966,7 +966,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index eb909ef3a34045480034bd7d7f3e5ac674f664b5..4d3e3a4496ab28e0865f2ad871915fcb2ae57e36 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1075,7 +1075,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity1 == null) { return false; } else { diff --git a/Spigot-Server-Patches/0239-Avoid-item-merge-if-stack-size-above-max-stack-size.patch b/Spigot-Server-Patches/0239-Avoid-item-merge-if-stack-size-above-max-stack-size.patch index e74e7a8427..aded79d749 100644 --- a/Spigot-Server-Patches/0239-Avoid-item-merge-if-stack-size-above-max-stack-size.patch +++ b/Spigot-Server-Patches/0239-Avoid-item-merge-if-stack-size-above-max-stack-size.patch @@ -4,11 +4,11 @@ Date: Mon, 16 Jul 2018 12:42:20 +0200 Subject: [PATCH] Avoid item merge if stack size above max stack size -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index fac335b3f80e6af3b08544cfd4abe3c77b66b023..3ba7bd0461d1c58c235cf0cda8d4eecf36b57407 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -183,6 +183,10 @@ public class EntityItem extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index de11fd9772f30ac72c3ca52ec4efc3fef4091425..4cfe3475fa913cd46116f13ea8ed9caf5372a41a 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -209,6 +209,10 @@ public class EntityItem extends Entity { private void mergeNearby() { if (this.z()) { diff --git a/Spigot-Server-Patches/0241-add-more-information-to-Entity.toString.patch b/Spigot-Server-Patches/0241-add-more-information-to-Entity.toString.patch index 43604c9da5..e46c3eac6c 100644 --- a/Spigot-Server-Patches/0241-add-more-information-to-Entity.toString.patch +++ b/Spigot-Server-Patches/0241-add-more-information-to-Entity.toString.patch @@ -5,11 +5,11 @@ Subject: [PATCH] add more information to Entity.toString() UUID, ticks lived, valid, dead -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 3b134ea0a6b30dce70ed9d00414c305354e07476..74b1aa0d52d0e325f8162d78d60c27f855ef0112 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2437,7 +2437,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 6b6de18e368d48b61482a7210794b756d805a460..a4915d330d9df8773ce2643a17f353045fff7965 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2522,7 +2522,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public String toString() { diff --git a/Spigot-Server-Patches/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch b/Spigot-Server-Patches/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch index 89ed5f75be..0283a3d71f 100644 --- a/Spigot-Server-Patches/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch +++ b/Spigot-Server-Patches/0242-Add-Debug-Entities-option-to-debug-dupe-uuid-issues.patch @@ -5,24 +5,11 @@ Subject: [PATCH] Add Debug Entities option to debug dupe uuid issues Add -Ddebug.entities=true to your JVM flags to gain more information -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 18ec6f553ddea775b279658a280fc2a3e5f96fa9..be5ad564964f26c90440bb30464edbf9882ff1e1 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -76,6 +76,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper - private CraftEntity bukkitEntity; - -+ PlayerChunkMap.EntityTracker tracker; // Paper -+ Throwable addedToWorldStack; // Paper - entity debug - public CraftEntity getBukkitEntity() { - if (bukkitEntity == null) { - bukkitEntity = CraftEntity.getEntity(world.getServer(), this); -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 8bfa412b0d3f881f694abec89101e15aa2d00bb7..6d048fbb48444885051efcb83a55d32047ff6517 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1094,6 +1094,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 88e7fe1d50e644a107aa76c84b7fd1b9b43cd94b..f0347a71b5937f9b68a4024fd0595a2d3e98eef5 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -1138,6 +1138,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } else { PlayerChunkMap.EntityTracker playerchunkmap_entitytracker = new PlayerChunkMap.EntityTracker(entity, i, j, entitytypes.isDeltaTracking()); @@ -30,7 +17,7 @@ index 8bfa412b0d3f881f694abec89101e15aa2d00bb7..6d048fbb48444885051efcb83a55d320 this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); playerchunkmap_entitytracker.track(this.world.getPlayers()); if (entity instanceof EntityPlayer) { -@@ -1135,7 +1136,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1179,7 +1180,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (playerchunkmap_entitytracker1 != null) { playerchunkmap_entitytracker1.a(); } @@ -39,23 +26,11 @@ index 8bfa412b0d3f881f694abec89101e15aa2d00bb7..6d048fbb48444885051efcb83a55d320 } protected void g() { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d3c282eb5253351ec4288bffaeca715547089cec..cb1330ef117224aea07208cebff544c714ae313a 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -68,6 +68,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public boolean pvpMode; - public boolean keepSpawnInMemory = true; - public org.bukkit.generator.ChunkGenerator generator; -+ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper - - public boolean captureBlockStates = false; - public boolean captureTreeGeneration = false; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 89cd1348ab609555d7c49536fa56ba7dcde2d601..f0c088c4c3283725e515e468faab1dee6a04a853 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -88,6 +88,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 4d3e3a4496ab28e0865f2ad871915fcb2ae57e36..70b837ef82dfe46eb24625b96f9bdbe2e7f2cc2d 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -197,6 +197,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final Convertable.ConversionSession convertable; public final UUID uuid; boolean hasPhysicsEvent = true; // Paper @@ -65,7 +40,7 @@ index 89cd1348ab609555d7c49536fa56ba7dcde2d601..f0c088c4c3283725e515e468faab1dee @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI return this.chunkProvider.getChunkAt(x, z, false); -@@ -927,8 +930,28 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1036,8 +1039,28 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit start private boolean addEntity0(Entity entity, CreatureSpawnEvent.SpawnReason spawnReason) { org.spigotmc.AsyncCatcher.catchOp("entity add"); // Spigot @@ -95,7 +70,7 @@ index 89cd1348ab609555d7c49536fa56ba7dcde2d601..f0c088c4c3283725e515e468faab1dee // WorldServer.LOGGER.warn("Tried to add entity {} but it was marked as removed already", EntityTypes.getName(entity.getEntityType())); // CraftBukkit return false; } else if (this.isUUIDTaken(entity)) { -@@ -1126,7 +1149,24 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1235,7 +1258,24 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } @@ -121,3 +96,28 @@ index 89cd1348ab609555d7c49536fa56ba7dcde2d601..f0c088c4c3283725e515e468faab1dee this.getChunkProvider().addEntity(entity); // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index a4915d330d9df8773ce2643a17f353045fff7965..94c77ea291b13206c726725def2ecf4e6441bf3f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -161,6 +161,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper + private CraftEntity bukkitEntity; + ++ PlayerChunkMap.EntityTracker tracker; // Paper ++ Throwable addedToWorldStack; // Paper - entity debug + public CraftEntity getBukkitEntity() { + if (bukkitEntity == null) { + bukkitEntity = CraftEntity.getEntity(world.getServer(), this); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index f7df55cf3da909c253bab106cdb7149ee9c297d9..6b81392010c216a1c478cae170388d6836e4206e 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -120,6 +120,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean pvpMode; + public boolean keepSpawnInMemory = true; + public org.bukkit.generator.ChunkGenerator generator; ++ public static final boolean DEBUG_ENTITIES = Boolean.getBoolean("debug.entities"); // Paper + + public boolean captureBlockStates = false; + public boolean captureTreeGeneration = false; diff --git a/Spigot-Server-Patches/0243-EnderDragon-Events.patch b/Spigot-Server-Patches/0243-EnderDragon-Events.patch index 130b52ec2b..2ac7798d52 100644 --- a/Spigot-Server-Patches/0243-EnderDragon-Events.patch +++ b/Spigot-Server-Patches/0243-EnderDragon-Events.patch @@ -4,11 +4,11 @@ Date: Sat, 21 Jul 2018 01:51:27 -0500 Subject: [PATCH] EnderDragon Events -diff --git a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -index 771c0b10d171da56c5156a42a6ea70b51983c684..1ff1e2c788bb6c10132e45ef1c939725bac8fcbe 100644 ---- a/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -+++ b/src/main/java/net/minecraft/server/DragonControllerLandedFlame.java -@@ -71,7 +71,11 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java +index 5adbd9fe858aad9c775a10254eb53b34719a9bd6..91de4e6c1d478e001c8672d34b4ffe57f6cba0a6 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerLandedFlame.java +@@ -80,7 +80,11 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded this.d.setDuration(200); this.d.setParticle(Particles.DRAGON_BREATH); this.d.addEffect(new MobEffect(MobEffects.HARM)); @@ -20,7 +20,7 @@ index 771c0b10d171da56c5156a42a6ea70b51983c684..1ff1e2c788bb6c10132e45ef1c939725 } } -@@ -82,8 +86,8 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded +@@ -91,8 +95,8 @@ public class DragonControllerLandedFlame extends AbstractDragonControllerLanded ++this.c; } @@ -31,11 +31,11 @@ index 771c0b10d171da56c5156a42a6ea70b51983c684..1ff1e2c788bb6c10132e45ef1c939725 if (this.d != null) { this.d.die(); this.d = null; -diff --git a/src/main/java/net/minecraft/server/DragonControllerStrafe.java b/src/main/java/net/minecraft/server/DragonControllerStrafe.java -index 740d8a3bdf8a4097b7e1b75a08e0c9dc0eb6059a..48afea81d81ee3272389f88e2115ef8c851f81f0 100644 ---- a/src/main/java/net/minecraft/server/DragonControllerStrafe.java -+++ b/src/main/java/net/minecraft/server/DragonControllerStrafe.java -@@ -71,7 +71,9 @@ public class DragonControllerStrafe extends AbstractDragonController { +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java +index db3cef26c8d5cdf740bb151a5525d8740a0e8bbd..1a5d5d39d3090acc3914e40e8d30c4a09789dbc9 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/phases/DragonControllerStrafe.java +@@ -81,7 +81,9 @@ public class DragonControllerStrafe extends AbstractDragonController { EntityDragonFireball entitydragonfireball = new EntityDragonFireball(this.a.world, this.a, d9, d10, d11); entitydragonfireball.setPositionRotation(d6, d7, d8, 0.0F, 0.0F); @@ -45,11 +45,11 @@ index 740d8a3bdf8a4097b7e1b75a08e0c9dc0eb6059a..48afea81d81ee3272389f88e2115ef8c this.c = 0; if (this.d != null) { while (!this.d.c()) { -diff --git a/src/main/java/net/minecraft/server/EntityDragonFireball.java b/src/main/java/net/minecraft/server/EntityDragonFireball.java -index b75810cbe27ad3b0881259470b9838006c70f4b6..27032abad4f3da1d1b28a3cec49e3fc079deadb9 100644 ---- a/src/main/java/net/minecraft/server/EntityDragonFireball.java -+++ b/src/main/java/net/minecraft/server/EntityDragonFireball.java -@@ -46,8 +46,10 @@ public class EntityDragonFireball extends EntityFireball { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java +index 59b5484731a5f71005c3efa56cbe40012d9641b5..27853f510e15e40c66da2cb4905c43f5e8f99d3d 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityDragonFireball.java +@@ -58,8 +58,10 @@ public class EntityDragonFireball extends EntityFireball { } } diff --git a/Spigot-Server-Patches/0244-PlayerElytraBoostEvent.patch b/Spigot-Server-Patches/0244-PlayerElytraBoostEvent.patch index f53dfa1f00..684680a7ed 100644 --- a/Spigot-Server-Patches/0244-PlayerElytraBoostEvent.patch +++ b/Spigot-Server-Patches/0244-PlayerElytraBoostEvent.patch @@ -4,11 +4,11 @@ Date: Sat, 21 Jul 2018 01:59:59 -0500 Subject: [PATCH] PlayerElytraBoostEvent -diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index 6cc243025f5bdac9be39f8a88a018893a9941dba..885c03f62da3b14bf7aeb31f1ae6a95bc9f86de1 100644 ---- a/src/main/java/net/minecraft/server/ItemFireworks.java -+++ b/src/main/java/net/minecraft/server/ItemFireworks.java -@@ -36,11 +36,16 @@ public class ItemFireworks extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java +index a2950faa48021782f10db0673d12d178443f7ccc..79e9be800385b94c4493bd8970620d76bfbd65ae 100644 +--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java ++++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java +@@ -45,11 +45,16 @@ public class ItemFireworks extends Item { // Paper start final EntityFireworks entityfireworks = new EntityFireworks(world, itemstack, entityhuman); entityfireworks.spawningEntity = entityhuman.getUniqueID(); diff --git a/Spigot-Server-Patches/0245-Improve-BlockPosition-inlining.patch b/Spigot-Server-Patches/0245-Improve-BlockPosition-inlining.patch index eaf3fa863a..9d4fb270ac 100644 --- a/Spigot-Server-Patches/0245-Improve-BlockPosition-inlining.patch +++ b/Spigot-Server-Patches/0245-Improve-BlockPosition-inlining.patch @@ -20,11 +20,11 @@ This should result in an across the board speedup in anything that accesses bloc This is based upon conclusions drawn from inspecting the assenmbly generated bythe JIT compiler on my microbenchmarks. They had 'callq' (invoke) instead of 'mov' (get from memory) instructions. -diff --git a/src/main/java/net/minecraft/server/BaseBlockPosition.java b/src/main/java/net/minecraft/server/BaseBlockPosition.java -index 63a9ce32fb8b98695e104f7d820cd9b1a8f230b1..6b655b744d31d9660c7521ab596b27bcd92f4d58 100644 ---- a/src/main/java/net/minecraft/server/BaseBlockPosition.java -+++ b/src/main/java/net/minecraft/server/BaseBlockPosition.java -@@ -39,7 +39,7 @@ public class BaseBlockPosition implements Comparable { +diff --git a/src/main/java/net/minecraft/core/BaseBlockPosition.java b/src/main/java/net/minecraft/core/BaseBlockPosition.java +index 4b56683336fdab06804efdc8ca1f7c130b77291f..a44bcdb053877a6281e566ffe03ef72ffd50ca08 100644 +--- a/src/main/java/net/minecraft/core/BaseBlockPosition.java ++++ b/src/main/java/net/minecraft/core/BaseBlockPosition.java +@@ -41,7 +41,7 @@ public class BaseBlockPosition implements Comparable { this(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } @@ -33,7 +33,7 @@ index 63a9ce32fb8b98695e104f7d820cd9b1a8f230b1..6b655b744d31d9660c7521ab596b27bc if (this == object) { return true; } else if (!(object instanceof BaseBlockPosition)) { -@@ -51,7 +51,7 @@ public class BaseBlockPosition implements Comparable { +@@ -53,7 +53,7 @@ public class BaseBlockPosition implements Comparable { } } @@ -42,7 +42,7 @@ index 63a9ce32fb8b98695e104f7d820cd9b1a8f230b1..6b655b744d31d9660c7521ab596b27bc return (this.getY() + this.getZ() * 31) * 31 + this.getX(); } -@@ -59,15 +59,15 @@ public class BaseBlockPosition implements Comparable { +@@ -61,15 +61,15 @@ public class BaseBlockPosition implements Comparable { return this.getY() == baseblockposition.getY() ? (this.getZ() == baseblockposition.getZ() ? this.getX() - baseblockposition.getX() : this.getZ() - baseblockposition.getZ()) : this.getY() - baseblockposition.getY(); } @@ -61,11 +61,11 @@ index 63a9ce32fb8b98695e104f7d820cd9b1a8f230b1..6b655b744d31d9660c7521ab596b27bc return this.e; } -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 64e8088d394ddcda59d0209883b778ab74638c02..f112fe95cb89f6196a41252193e9eb44008cfc5f 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -82,6 +82,7 @@ public class BlockPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index 9fb6db18c5c1f39b5a564c0f5f70498825defa97..370b2c4460d6b52b5ef7da89f5ebf7ef50deb582 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -88,6 +88,7 @@ public class BlockPosition extends BaseBlockPosition { return a(this.getX(), this.getY(), this.getZ()); } diff --git a/Spigot-Server-Patches/0246-Optimize-RegistryID.c.patch b/Spigot-Server-Patches/0246-Optimize-RegistryID.c.patch index 192c4e4166..028620de8b 100644 --- a/Spigot-Server-Patches/0246-Optimize-RegistryID.c.patch +++ b/Spigot-Server-Patches/0246-Optimize-RegistryID.c.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize RegistryID.c() This is a frequent hotspot for world loading/saving. -diff --git a/src/main/java/net/minecraft/server/RegistryID.java b/src/main/java/net/minecraft/server/RegistryID.java -index 5078a5ce391b445b64b2a16b123a3e3d5841619b..c35764009faeb3d2bb505b135dc542c7a580f254 100644 ---- a/src/main/java/net/minecraft/server/RegistryID.java -+++ b/src/main/java/net/minecraft/server/RegistryID.java -@@ -14,12 +14,14 @@ public class RegistryID implements Registry { +diff --git a/src/main/java/net/minecraft/util/RegistryID.java b/src/main/java/net/minecraft/util/RegistryID.java +index 6150f7a5c5004ac79414ab22dbaa3439dc8afdb4..a59dbfa01743137702b122f73c778452e63115b5 100644 +--- a/src/main/java/net/minecraft/util/RegistryID.java ++++ b/src/main/java/net/minecraft/util/RegistryID.java +@@ -15,12 +15,14 @@ public class RegistryID implements Registry { private K[] d; private int e; private int f; @@ -24,7 +24,7 @@ index 5078a5ce391b445b64b2a16b123a3e3d5841619b..c35764009faeb3d2bb505b135dc542c7 } // Paper start - decompile fix -@@ -51,9 +53,14 @@ public class RegistryID implements Registry { +@@ -52,9 +54,14 @@ public class RegistryID implements Registry { } private int c() { @@ -39,7 +39,7 @@ index 5078a5ce391b445b64b2a16b123a3e3d5841619b..c35764009faeb3d2bb505b135dc542c7 return this.e; } -@@ -67,6 +74,7 @@ public class RegistryID implements Registry { +@@ -68,6 +75,7 @@ public class RegistryID implements Registry { this.d = (K[]) (new Object[i]); // Paper - decompile fix this.e = 0; this.f = 0; @@ -47,7 +47,7 @@ index 5078a5ce391b445b64b2a16b123a3e3d5841619b..c35764009faeb3d2bb505b135dc542c7 for (int j = 0; j < ak.length; ++j) { if (ak[j] != null) { -@@ -92,6 +100,7 @@ public class RegistryID implements Registry { +@@ -93,6 +101,7 @@ public class RegistryID implements Registry { this.b[k] = k0; this.c[k] = i; this.d[i] = k0; @@ -55,7 +55,7 @@ index 5078a5ce391b445b64b2a16b123a3e3d5841619b..c35764009faeb3d2bb505b135dc542c7 ++this.f; if (i == this.e) { ++this.e; -@@ -156,6 +165,7 @@ public class RegistryID implements Registry { +@@ -157,6 +166,7 @@ public class RegistryID implements Registry { Arrays.fill(this.d, (Object) null); this.e = 0; this.f = 0; diff --git a/Spigot-Server-Patches/0247-Option-to-prevent-armor-stands-from-doing-entity-loo.patch b/Spigot-Server-Patches/0247-Option-to-prevent-armor-stands-from-doing-entity-loo.patch index 83a9dc7725..0e003fb8ae 100644 --- a/Spigot-Server-Patches/0247-Option-to-prevent-armor-stands-from-doing-entity-loo.patch +++ b/Spigot-Server-Patches/0247-Option-to-prevent-armor-stands-from-doing-entity-loo.patch @@ -18,11 +18,11 @@ index 4813f62d1e382d5ac6971b2244df3f13c80d1950..3562950df4868b1393790b1a1ff1fe0d + armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index e17637cfee773b1b79c05d7a8e6558963c7a9c14..9a3183e55fcb6809d2b324ad52e27f3e77d8fcb2 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -321,6 +321,7 @@ public class EntityArmorStand extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index e9ea670248eb0680cdff9a72412e9331fc57ff8a..0936924707306204c06064ee796413159835bfa9 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -355,6 +355,7 @@ public class EntityArmorStand extends EntityLiving { @Override protected void collideNearby() { @@ -30,11 +30,11 @@ index e17637cfee773b1b79c05d7a8e6558963c7a9c14..9a3183e55fcb6809d2b324ad52e27f3e List list = this.world.getEntities(this, this.getBoundingBox(), EntityArmorStand.br); for (int i = 0; i < list.size(); ++i) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index cb1330ef117224aea07208cebff544c714ae313a..51c57f4752ea49859b9e00045a40899783731f28 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -801,6 +801,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 6b81392010c216a1c478cae170388d6836e4206e..06ec41f816bc75ee0fa6418c21ff5a416c834518 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -853,6 +853,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { // Paper end } } diff --git a/Spigot-Server-Patches/0248-Vanished-players-don-t-have-rights.patch b/Spigot-Server-Patches/0248-Vanished-players-don-t-have-rights.patch index d8d7d99682..2b4c3c5d9a 100644 --- a/Spigot-Server-Patches/0248-Vanished-players-don-t-have-rights.patch +++ b/Spigot-Server-Patches/0248-Vanished-players-don-t-have-rights.patch @@ -4,23 +4,11 @@ Date: Mon, 23 Jul 2018 14:22:26 +0200 Subject: [PATCH] Vanished players don't have rights -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index e0ae51ede44de5c894df526c1fc6d94c46d72013..8bcca73ae48ee822d32a6d23be2e1056a376e5f6 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -453,6 +453,7 @@ public abstract class BlockBase { - return this.a != null ? this.a.b : this.b(iblockaccess, blockposition, VoxelShapeCollision.a()); - } - -+ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER - public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { - return this.getBlock().c(this.p(), iblockaccess, blockposition, voxelshapecollision); - } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index be5ad564964f26c90440bb30464edbf9882ff1e1..c7c8dd944c084c281568cb6444c8bda35b35a4df 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -98,7 +98,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 94c77ea291b13206c726725def2ecf4e6441bf3f..d9dac0420fff1ae06ebbe6cf0d9c9fb2b71eb673 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -183,7 +183,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne private static double e = 1.0D; private final EntityTypes f; private int id; @@ -29,11 +17,11 @@ index be5ad564964f26c90440bb30464edbf9882ff1e1..c7c8dd944c084c281568cb6444c8bda3 public final List passengers; protected int j; @Nullable -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java -index 0b62041f6dc9cb0151ea55407f6706cac134f1b5..97aed437adb98bc468ec757df8b6d375b5101834 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java -@@ -129,8 +129,14 @@ public abstract class IProjectile extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +index 65cea9282467cb362ac6e9e0bb03c5d36085ee43..8967cf1e0238941370412109eff2ccf19f86b727 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +@@ -140,8 +140,14 @@ public abstract class IProjectile extends Entity { protected boolean a(Entity entity) { if (!entity.isSpectator() && entity.isAlive() && entity.isInteractable()) { Entity entity1 = this.getShooter(); @@ -49,11 +37,11 @@ index 0b62041f6dc9cb0151ea55407f6706cac134f1b5..97aed437adb98bc468ec757df8b6d375 } else { return false; } -diff --git a/src/main/java/net/minecraft/server/ItemBlock.java b/src/main/java/net/minecraft/server/ItemBlock.java -index 6fb62f75fef4651986c8314c22a465304e7aa97a..ae2ad70699347e169d941266ec3ad1af4c9b3786 100644 ---- a/src/main/java/net/minecraft/server/ItemBlock.java -+++ b/src/main/java/net/minecraft/server/ItemBlock.java -@@ -155,7 +155,8 @@ public class ItemBlock extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemBlock.java b/src/main/java/net/minecraft/world/item/ItemBlock.java +index ec12bea9de910824927ba31628b49f6713f31a29..59d52c252b2e59923b8e513dd4d2e1ec9ce34dc7 100644 +--- a/src/main/java/net/minecraft/world/item/ItemBlock.java ++++ b/src/main/java/net/minecraft/world/item/ItemBlock.java +@@ -177,7 +177,8 @@ public class ItemBlock extends Item { EntityHuman entityhuman = blockactioncontext.getEntity(); VoxelShapeCollision voxelshapecollision = entityhuman == null ? VoxelShapeCollision.a() : VoxelShapeCollision.a((Entity) entityhuman); // CraftBukkit start - store default return @@ -63,43 +51,11 @@ index 6fb62f75fef4651986c8314c22a465304e7aa97a..ae2ad70699347e169d941266ec3ad1af org.bukkit.entity.Player player = (blockactioncontext.getEntity() instanceof EntityPlayer) ? (org.bukkit.entity.Player) blockactioncontext.getEntity().getBukkitEntity() : null; BlockCanBuildEvent event = new BlockCanBuildEvent(CraftBlock.at(blockactioncontext.getWorld(), blockactioncontext.getClickPosition()), player, CraftBlockData.fromData(iblockdata), defaultReturn); -diff --git a/src/main/java/net/minecraft/server/VoxelShape.java b/src/main/java/net/minecraft/server/VoxelShape.java -index 30ddad5d98817eeb621de66a1a333d5013bfa9b1..eb926b74e17fb2f88c1d6ce2fb546541f8e6e274 100644 ---- a/src/main/java/net/minecraft/server/VoxelShape.java -+++ b/src/main/java/net/minecraft/server/VoxelShape.java -@@ -46,6 +46,7 @@ public abstract class VoxelShape { - return this.a.a(); - } - -+ public final VoxelShape offset(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER - public VoxelShape a(double d0, double d1, double d2) { - return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); - } -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index ed0f9c5d29c4f88b7beee4b0ecdd7a56de2d7a9e..881cea7c466f29ff4a89db28d104e8500a548b1f 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -35,6 +35,7 @@ public final class VoxelShapes { - return a(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); - } - -+ public static final VoxelShape of(AxisAlignedBB axisAlignedbb) { return VoxelShapes.a(axisAlignedbb); } // Paper - OBFHELPER - public static VoxelShape a(AxisAlignedBB axisalignedbb) { - int i = a(axisalignedbb.minX, axisalignedbb.maxX); - int j = a(axisalignedbb.minY, axisalignedbb.maxY); -@@ -129,6 +130,7 @@ public final class VoxelShapes { - } - } - -+ public static final boolean applyOperation(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { return VoxelShapes.c(voxelshape, voxelshape1, operatorboolean); } // Paper - OBFHELPER - public static boolean c(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { - if (operatorboolean.apply(false, false)) { - throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException())); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 51c57f4752ea49859b9e00045a40899783731f28..26669ded3ec47d13e4e79d65d0f05a588f9e1f63 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -178,6 +178,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 06ec41f816bc75ee0fa6418c21ff5a416c834518..7b552e4e71c82833da2114604de98350567128f0 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -230,6 +230,46 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.tileLimiter = new org.spigotmc.TickLimiter(spigotConfig.tileMaxTickTime); } @@ -146,8 +102,52 @@ index 51c57f4752ea49859b9e00045a40899783731f28..26669ded3ec47d13e4e79d65d0f05a58 @Override public boolean s_() { return this.isClientSide; +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index a96c7b0883f3bdf8b731aeccaf1217583a32f5c8..61e2da8d8b2ebf50b28362c5c89bf5c32dbba1ba 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -504,6 +504,7 @@ public abstract class BlockBase { + return this.a != null ? this.a.b : this.b(iblockaccess, blockposition, VoxelShapeCollision.a()); + } + ++ public final VoxelShape getCollisionShape(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { return this.b(iblockaccess, blockposition, voxelshapecollision); } // Paper - OBFHELPER + public VoxelShape b(IBlockAccess iblockaccess, BlockPosition blockposition, VoxelShapeCollision voxelshapecollision) { + return this.getBlock().c(this.p(), iblockaccess, blockposition, voxelshapecollision); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java +index 1b82349b96b3ec9490d06d1c1d1cbf2b1578d313..887016224c16f8a38c10a98eb0e2ae6cb353a153 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShape.java +@@ -54,6 +54,7 @@ public abstract class VoxelShape { + return this.a.a(); + } + ++ public final VoxelShape offset(double x, double y, double z) { return this.a(x, y, z); } // Paper - OBFHELPER + public VoxelShape a(double d0, double d1, double d2) { + return (VoxelShape) (this.isEmpty() ? VoxelShapes.a() : new VoxelShapeArray(this.a, new DoubleListOffset(this.a(EnumDirection.EnumAxis.X), d0), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Y), d1), new DoubleListOffset(this.a(EnumDirection.EnumAxis.Z), d2))); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index fdd9e37a8c90fc3311e515355af0a0593efbdacc..cf32a4f63e8e59535c02a3f9c57f98833a2b0e83 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -45,6 +45,7 @@ public final class VoxelShapes { + return a(new AxisAlignedBB(d0, d1, d2, d3, d4, d5)); + } + ++ public static final VoxelShape of(AxisAlignedBB axisAlignedbb) { return VoxelShapes.a(axisAlignedbb); } // Paper - OBFHELPER + public static VoxelShape a(AxisAlignedBB axisalignedbb) { + int i = a(axisalignedbb.minX, axisalignedbb.maxX); + int j = a(axisalignedbb.minY, axisalignedbb.maxY); +@@ -139,6 +140,7 @@ public final class VoxelShapes { + } + } + ++ public static final boolean applyOperation(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { return VoxelShapes.c(voxelshape, voxelshape1, operatorboolean); } // Paper - OBFHELPER + public static boolean c(VoxelShape voxelshape, VoxelShape voxelshape1, OperatorBoolean operatorboolean) { + if (operatorboolean.apply(false, false)) { + throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException())); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index cc785729b522d1588897db870c55274a83c85f4e..d67c82b7727d68addc3a0d8ca6ba53fb21694892 100644 +index 681eb48c568029d6e3c5fa140a2c330a5f27df6f..e0e48094160b55b55efb9b567fa5fd7d497ed628 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1202,6 +1202,14 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0249-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch b/Spigot-Server-Patches/0249-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch index 49acb393e1..37b456246d 100644 --- a/Spigot-Server-Patches/0249-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch +++ b/Spigot-Server-Patches/0249-Mark-chunk-dirty-anytime-entities-change-to-guarante.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Mark chunk dirty anytime entities change to guarantee it saves -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 380690cdb1052b12d0574c111c2162bd7ed8ecca..84ad87f4a1ab9c136e00f4c9f029853d82f57247 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -524,6 +524,7 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 86872f4e65d7e0ca68237a42fe87f33ba7a92802..bae9ba25136d66f59b03f0ad3d6ac1f915097ae2 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -558,6 +558,7 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list this.entitySlices[k].add(entity); @@ -17,7 +17,7 @@ index 380690cdb1052b12d0574c111c2162bd7ed8ecca..84ad87f4a1ab9c136e00f4c9f029853d } @Override -@@ -552,6 +553,7 @@ public class Chunk implements IChunkAccess { +@@ -586,6 +587,7 @@ public class Chunk implements IChunkAccess { return; } entityCounts.decrement(entity.getMinecraftKeyString()); diff --git a/Spigot-Server-Patches/0250-Add-some-Debug-to-Chunk-Entity-slices.patch b/Spigot-Server-Patches/0250-Add-some-Debug-to-Chunk-Entity-slices.patch index c8c69a78f4..3de571ed47 100644 --- a/Spigot-Server-Patches/0250-Add-some-Debug-to-Chunk-Entity-slices.patch +++ b/Spigot-Server-Patches/0250-Add-some-Debug-to-Chunk-Entity-slices.patch @@ -8,11 +8,23 @@ If we detect unexpected state, log and try to recover This should hopefully avoid duplicate entities ever being created if the entity was to end up in 2 different chunk slices -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 84ad87f4a1ab9c136e00f4c9f029853d82f57247..e829f62397d092fa919d387b157a65b0c627e2e2 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -515,6 +515,25 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index d9dac0420fff1ae06ebbe6cf0d9c9fb2b71eb673..398c1f223d25931fb4de65582ab162bfc4be5050 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -156,6 +156,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + } + }; ++ List entitySlice = null; + // Paper end + + public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index bae9ba25136d66f59b03f0ad3d6ac1f915097ae2..1fa3e4418d14bd761ffbca6ea5dd80f6251caf16 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -549,6 +549,25 @@ public class Chunk implements IChunkAccess { if (k >= this.entitySlices.length) { k = this.entitySlices.length - 1; } @@ -38,7 +50,7 @@ index 84ad87f4a1ab9c136e00f4c9f029853d82f57247..e829f62397d092fa919d387b157a65b0 if (!entity.inChunk || entity.getCurrentChunk() != this) entityCounts.increment(entity.getMinecraftKeyString()); // Paper entity.inChunk = true; -@@ -524,6 +543,7 @@ public class Chunk implements IChunkAccess { +@@ -558,6 +577,7 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list this.entitySlices[k].add(entity); @@ -46,7 +58,7 @@ index 84ad87f4a1ab9c136e00f4c9f029853d82f57247..e829f62397d092fa919d387b157a65b0 this.markDirty(); // Paper } -@@ -549,6 +569,10 @@ public class Chunk implements IChunkAccess { +@@ -583,6 +603,10 @@ public class Chunk implements IChunkAccess { // Paper start if (entity.currentChunk != null && entity.currentChunk.get() == this) entity.setCurrentChunk(null); @@ -57,15 +69,3 @@ index 84ad87f4a1ab9c136e00f4c9f029853d82f57247..e829f62397d092fa919d387b157a65b0 if (!this.entitySlices[i].remove(entity)) { return; } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c7c8dd944c084c281568cb6444c8bda35b35a4df..da195d9bb6995fcbe569ca2e2b08c473431376a6 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -71,6 +71,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - } - }; -+ List entitySlice = null; - // Paper end - - public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper diff --git a/Spigot-Server-Patches/0251-SkeletonHorse-Additions.patch b/Spigot-Server-Patches/0251-SkeletonHorse-Additions.patch index 532e0ab0b3..96ea01f30a 100644 --- a/Spigot-Server-Patches/0251-SkeletonHorse-Additions.patch +++ b/Spigot-Server-Patches/0251-SkeletonHorse-Additions.patch @@ -4,11 +4,23 @@ Date: Fri, 27 Jul 2018 22:36:31 -0500 Subject: [PATCH] SkeletonHorse Additions -diff --git a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -index bb23e313b236ceb81c60d62833dc6f5afee044eb..a53d335f3af9df80bec3f94f81fb5ff0e0e5ebb5 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -+++ b/src/main/java/net/minecraft/server/EntityHorseSkeleton.java -@@ -6,7 +6,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +index dfcfdb31ca9531913d705aaaf85fb67399cfdc8c..4776a47566aac487dc77fd6b4b9b42b95974e31a 100644 +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -25,6 +25,7 @@ public final class IEntitySelector { + public static final Predicate f = (entity) -> { + return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; + }; ++ public static Predicate notSpectator() { return g; } // Paper - OBFHELPER + public static final Predicate g = (entity) -> { + return !entity.isSpectator(); + }; +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java +index 0ddb676a2d1c38c97cd7750c1594fd6468156d0a..da5365372e89b847d626e52c5541544467f14702 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseSkeleton.java +@@ -26,7 +26,7 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { private final PathfinderGoalHorseTrap bw = new PathfinderGoalHorseTrap(this); private boolean bx; @@ -17,7 +29,7 @@ index bb23e313b236ceb81c60d62833dc6f5afee044eb..a53d335f3af9df80bec3f94f81fb5ff0 public EntityHorseSkeleton(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -125,10 +125,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { +@@ -145,10 +145,12 @@ public class EntityHorseSkeleton extends EntityHorseAbstract { return 0.96F; } @@ -30,12 +42,46 @@ index bb23e313b236ceb81c60d62833dc6f5afee044eb..a53d335f3af9df80bec3f94f81fb5ff0 public void t(boolean flag) { if (flag != this.bx) { this.bx = flag; -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 14400d0e4b0713e852861ed55e289e4dead95cea..90c94729edf8d18f33d72e872f7969abef0067a0 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java +index 9b6a4f93dca6eeddad43d5f5675c551fb3fd2fdb..cf250cc6b7a77a7af742eab0b89cff2bc17fc5e4 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/PathfinderGoalHorseTrap.java +@@ -15,9 +15,14 @@ import net.minecraft.world.item.Items; + import net.minecraft.world.item.enchantment.EnchantmentManager; + import net.minecraft.world.level.World; + ++import org.bukkit.entity.HumanEntity; ++ ++import java.util.List; ++ + public class PathfinderGoalHorseTrap extends PathfinderGoal { + + private final EntityHorseSkeleton a; ++ private List eligiblePlayers; // Paper + + public PathfinderGoalHorseTrap(EntityHorseSkeleton entityhorseskeleton) { + this.a = entityhorseskeleton; +@@ -25,12 +30,13 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { + + @Override + public boolean a() { +- return this.a.world.isPlayerNearby(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D); ++ return !(eligiblePlayers = this.a.world.findNearbyBukkitPlayers(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D, false)).isEmpty(); // Paper + } + + @Override + public void e() { + WorldServer worldserver = (WorldServer) this.a.world; ++ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper + DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates()); + + this.a.t(false); +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index 6d5d4c3df65995b9a13b66d070ba08d553cc98a2..8fdc4b22e8c99d653bd213fe64339c133b46b4e9 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java @@ -1,6 +1,9 @@ - package net.minecraft.server; + package net.minecraft.world.level; +import com.google.common.collect.ImmutableList; import com.google.common.collect.Lists; @@ -44,7 +90,7 @@ index 14400d0e4b0713e852861ed55e289e4dead95cea..90c94729edf8d18f33d72e872f7969ab import java.util.Iterator; import java.util.List; import java.util.UUID; -@@ -106,6 +109,28 @@ public interface IEntityAccess { +@@ -115,6 +118,28 @@ public interface IEntityAccess { return entityhuman; } @@ -73,53 +119,8 @@ index 14400d0e4b0713e852861ed55e289e4dead95cea..90c94729edf8d18f33d72e872f7969ab @Nullable default EntityHuman findNearbyPlayer(Entity entity, double d0) { return this.a(entity.locX(), entity.locY(), entity.locZ(), d0, false); -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index ff1ddb4db5406f81453a8f075033d00e06bce6a5..863f4464c688912b3e0ce61cbbbf263e38a3af4b 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -20,6 +20,7 @@ public final class IEntitySelector { - public static final Predicate f = (entity) -> { - return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; - }; -+ public static Predicate notSpectator() { return g; } // Paper - OBFHELPER - public static final Predicate g = (entity) -> { - return !entity.isSpectator(); - }; -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -index 8433a1a9a7de6a705a7fbecb593742ffa2e544f0..b0d1abeda19423d8adf0ff596442b00ac2e53357 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalHorseTrap.java -@@ -1,8 +1,13 @@ - package net.minecraft.server; - -+import org.bukkit.entity.HumanEntity; -+ -+import java.util.List; -+ - public class PathfinderGoalHorseTrap extends PathfinderGoal { - - private final EntityHorseSkeleton a; -+ private List eligiblePlayers; // Paper - - public PathfinderGoalHorseTrap(EntityHorseSkeleton entityhorseskeleton) { - this.a = entityhorseskeleton; -@@ -10,12 +15,13 @@ public class PathfinderGoalHorseTrap extends PathfinderGoal { - - @Override - public boolean a() { -- return this.a.world.isPlayerNearby(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D); -+ return !(eligiblePlayers = this.a.world.findNearbyBukkitPlayers(this.a.locX(), this.a.locY(), this.a.locZ(), 10.0D, false)).isEmpty(); // Paper - } - - @Override - public void e() { - WorldServer worldserver = (WorldServer) this.a.world; -+ if (!new com.destroystokyo.paper.event.entity.SkeletonHorseTrapEvent((org.bukkit.entity.SkeletonHorse) this.a.getBukkitEntity(), eligiblePlayers).callEvent()) return; // Paper - DifficultyDamageScaler difficultydamagescaler = worldserver.getDamageScaler(this.a.getChunkCoordinates()); - - this.a.t(false); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java -index e822c2200d6270ca538eadd9637b748fc3602cb6..2a7d1d4ec2c1ff16840614165c6f0c37dc534d87 100644 +index 4aec5fdb6b0379b0797969ff3c8f8a9629a18bfb..7366d56cefad45883f353ea5fb16b41f87006ec1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSkeletonHorse.java @@ -26,4 +26,26 @@ public class CraftSkeletonHorse extends CraftAbstractHorse implements SkeletonHo diff --git a/Spigot-Server-Patches/0252-Prevent-Saving-Bad-entities-to-chunks.patch b/Spigot-Server-Patches/0252-Prevent-Saving-Bad-entities-to-chunks.patch index 10c26b7419..7df29dd5de 100644 --- a/Spigot-Server-Patches/0252-Prevent-Saving-Bad-entities-to-chunks.patch +++ b/Spigot-Server-Patches/0252-Prevent-Saving-Bad-entities-to-chunks.patch @@ -17,11 +17,49 @@ an invalid entity. This should reduce log occurrences of dupe uuid messages. -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index d30c4d5a4ee83e21ba9269c0b92af2b72b85d3cc..3a292bccb2295bf7ae46fc3d7e5c9c63a72f403d 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -307,6 +307,7 @@ public class ChunkRegionLoader { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 70b837ef82dfe46eb24625b96f9bdbe2e7f2cc2d..b121d404f3afb69fa1d0eae727c1dba92eadb0e5 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1155,6 +1155,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + List[] aentityslice = chunk.getEntitySlices(); // Spigot + int i = aentityslice.length; + ++ java.util.List toMoveChunks = new java.util.ArrayList<>(); // Paper + for (int j = 0; j < i; ++j) { + List entityslice = aentityslice[j]; // Spigot + Iterator iterator = entityslice.iterator(); +@@ -1167,11 +1168,25 @@ public class WorldServer extends World implements GeneratorAccessSeed { + throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); + } + ++ // Paper start - move out entities that shouldn't be in this chunk before it unloads ++ if (!entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { ++ toMoveChunks.add(entity); ++ continue; ++ } ++ // Paper end ++ + this.entitiesById.remove(entity.getId()); + this.unregisterEntity(entity); ++ ++ if (entity.dead) iterator.remove(); // Paper - don't save dead entities during unload + } + } + } ++ // Paper start - move out entities that shouldn't be in this chunk before it unloads ++ for (Entity entity : toMoveChunks) { ++ this.chunkCheck(entity); ++ } ++ // Paper end + + } + +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index f301c7ba4b17b92c6cf2fcee6da1e67081dad4fa..1711c40e163a1148e2f7be58d4c020c61bef8bb2 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -349,6 +349,7 @@ public class ChunkRegionLoader { nbttagcompound1.set("TileEntities", nbttaglist1); NBTTagList nbttaglist2 = new NBTTagList(); @@ -29,7 +67,7 @@ index d30c4d5a4ee83e21ba9269c0b92af2b72b85d3cc..3a292bccb2295bf7ae46fc3d7e5c9c63 if (ichunkaccess.getChunkStatus().getType() == ChunkStatus.Type.LEVELCHUNK) { Chunk chunk = (Chunk) ichunkaccess; -@@ -324,13 +325,28 @@ public class ChunkRegionLoader { +@@ -366,13 +367,28 @@ public class ChunkRegionLoader { while (iterator1.hasNext()) { Entity entity = (Entity) iterator1.next(); NBTTagCompound nbttagcompound4 = new NBTTagCompound(); @@ -59,7 +97,7 @@ index d30c4d5a4ee83e21ba9269c0b92af2b72b85d3cc..3a292bccb2295bf7ae46fc3d7e5c9c63 } else { ProtoChunk protochunk = (ProtoChunk) ichunkaccess; -@@ -389,6 +405,19 @@ public class ChunkRegionLoader { +@@ -431,6 +447,19 @@ public class ChunkRegionLoader { nbttagcompound1.set("Structures", a(chunkcoordintpair, ichunkaccess.h(), ichunkaccess.v())); return nbttagcompound; } @@ -79,41 +117,3 @@ index d30c4d5a4ee83e21ba9269c0b92af2b72b85d3cc..3a292bccb2295bf7ae46fc3d7e5c9c63 public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { if (nbttagcompound != null) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 041dfa08066667501f18e043e8b894c660b949a7..d6c319c1177e43eebeb7d9f366da3495b38b6b97 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1046,6 +1046,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - List[] aentityslice = chunk.getEntitySlices(); // Spigot - int i = aentityslice.length; - -+ java.util.List toMoveChunks = new java.util.ArrayList<>(); // Paper - for (int j = 0; j < i; ++j) { - List entityslice = aentityslice[j]; // Spigot - Iterator iterator = entityslice.iterator(); -@@ -1058,11 +1059,25 @@ public class WorldServer extends World implements GeneratorAccessSeed { - throw (IllegalStateException) SystemUtils.c((Throwable) (new IllegalStateException("Removing entity while ticking!"))); - } - -+ // Paper start - move out entities that shouldn't be in this chunk before it unloads -+ if (!entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { -+ toMoveChunks.add(entity); -+ continue; -+ } -+ // Paper end -+ - this.entitiesById.remove(entity.getId()); - this.unregisterEntity(entity); -+ -+ if (entity.dead) iterator.remove(); // Paper - don't save dead entities during unload - } - } - } -+ // Paper start - move out entities that shouldn't be in this chunk before it unloads -+ for (Entity entity : toMoveChunks) { -+ this.chunkCheck(entity); -+ } -+ // Paper end - - } - diff --git a/Spigot-Server-Patches/0253-Don-t-call-getItemMeta-on-hasItemMeta.patch b/Spigot-Server-Patches/0253-Don-t-call-getItemMeta-on-hasItemMeta.patch index 69fb6e318b..ab3543b44f 100644 --- a/Spigot-Server-Patches/0253-Don-t-call-getItemMeta-on-hasItemMeta.patch +++ b/Spigot-Server-Patches/0253-Don-t-call-getItemMeta-on-hasItemMeta.patch @@ -11,7 +11,7 @@ Returns true if getDamage() == 0 or has damage tag or other tag is set. Check the `ItemMetaTest#testTaggedButNotMeta` method to see how this method behaves. diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java -index d315a102a5ae2a79189b39c3b534b8fd733cc9e4..addb8ef990de3dfbf74969ef4c22276d2fa2614a 100644 +index 315addab147dfecf4aa88d32d154cefe850d0a78..09d7a86b5f6cffdf6664ad657dd4f8dd8eabdd70 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -570,7 +570,7 @@ public final class CraftItemStack extends ItemStack { @@ -22,26 +22,12 @@ index d315a102a5ae2a79189b39c3b534b8fd733cc9e4..addb8ef990de3dfbf74969ef4c22276d + return hasItemMeta(handle) && (handle.getDamage() != 0 || (handle.getTag() != null && handle.getTag().map.size() >= (handle.getTag().hasKey(CraftMetaItem.DAMAGE.NBT) ? 2 : 1))); // Paper - keep 1.12 CraftBukkit behavior without calling getItemMeta } - static boolean hasItemMeta(net.minecraft.server.ItemStack item) { + static boolean hasItemMeta(net.minecraft.world.item.ItemStack item) { diff --git a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -index ddbcbd565d5dcb5b1c8d46558e06887e85d589c5..b0edd62eb9066d145cfc52272c71d5f00b7e928d 100644 +index 42f577ed3508ba5a380648461e149f16ce97c9bd..b85a0a4c4f134dd6012d9141244ecf97b4300b65 100644 --- a/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java +++ b/src/test/java/org/bukkit/craftbukkit/inventory/ItemMetaTest.java -@@ -2,10 +2,9 @@ package org.bukkit.craftbukkit.inventory; - - import static org.hamcrest.Matchers.*; - import static org.junit.Assert.*; --import java.util.ArrayList; --import java.util.Arrays; --import java.util.List; --import java.util.UUID; -+ -+import java.util.*; -+ - import com.destroystokyo.paper.inventory.meta.ArmorStandMeta; // Paper - import net.minecraft.server.Block; - import net.minecraft.server.IRegistry; -@@ -97,6 +96,34 @@ public class ItemMetaTest extends AbstractTestingBase { +@@ -96,6 +96,34 @@ public class ItemMetaTest extends AbstractTestingBase { assertThat(itemMeta.hasConflictingEnchant(null), is(false)); } @@ -55,7 +41,7 @@ index ddbcbd565d5dcb5b1c8d46558e06887e85d589c5..b0edd62eb9066d145cfc52272c71d5f0 + stack.setDurability((short) 2); + assertThat("ItemStack with non-zero durability should have ItemMeta", stack.hasItemMeta(), is(true)); + -+ stack.setLore(Collections.singletonList("Lore")); ++ stack.setLore(java.util.Collections.singletonList("Lore")); + assertThat("ItemStack with lore and durability should have ItemMeta", stack.hasItemMeta(), is(true)); + + stack.setDurability((short) 0); diff --git a/Spigot-Server-Patches/0254-Ignore-Dead-Entities-in-entityList-iteration.patch b/Spigot-Server-Patches/0254-Ignore-Dead-Entities-in-entityList-iteration.patch index 7b5ad470dd..be04f42799 100644 --- a/Spigot-Server-Patches/0254-Ignore-Dead-Entities-in-entityList-iteration.patch +++ b/Spigot-Server-Patches/0254-Ignore-Dead-Entities-in-entityList-iteration.patch @@ -11,7 +11,7 @@ This will ensure that dead entities are skipped from iteration since they shouldn't of been in the list in the first place. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 411aebed946991b899205fcc1fcf7f3bf83718c0..aa606e66c874d5147074b85cc9a5ceef71175740 100644 +index 6943524c2dd8b12691b8ac5b08daee823ce50c3d..b67bd98cca4a06bc0ebaed577195dffc3b3251ec 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -209,6 +209,7 @@ public class PaperCommand extends Command { @@ -22,51 +22,11 @@ index 411aebed946991b899205fcc1fcf7f3bf83718c0..aa606e66c874d5147074b85cc9a5ceef MutablePair> info = list.computeIfAbsent(key, k -> MutablePair.of(0, Maps.newHashMap())); ChunkCoordIntPair chunk = new ChunkCoordIntPair(e.chunkX, e.chunkZ); -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index e829f62397d092fa919d387b157a65b0c627e2e2..3cb1ee261724e34a23c4a0f98673da1597786a01 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -825,6 +825,7 @@ public class Chunk implements IChunkAccess { - - for (int i1 = 0; i1 < l; ++i1) { - Entity entity1 = (Entity) list1.get(i1); -+ if (entity1.shouldBeRemoved) continue; // Paper - - if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) { - if (predicate == null || predicate.test(entity1)) { -@@ -862,6 +863,7 @@ public class Chunk implements IChunkAccess { - - while (iterator.hasNext()) { - T entity = (T) iterator.next(); // CraftBukkit - decompile error -+ if (entity.shouldBeRemoved) continue; // Paper - - if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) { - list.add(entity); -@@ -884,6 +886,7 @@ public class Chunk implements IChunkAccess { - - while (iterator.hasNext()) { - T t0 = (T) iterator.next(); // CraftBukkit - decompile error -+ if (t0.shouldBeRemoved) continue; // Paper - - if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check - list.add(t0); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index da195d9bb6995fcbe569ca2e2b08c473431376a6..49c7b40744adcd36e5ae1eef026679e9b646feac 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -190,6 +190,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - protected int numCollisions = 0; // Paper - public void inactiveTick() { } - // Spigot end -+ public boolean shouldBeRemoved; // Paper - - public float getBukkitYaw() { - return this.yaw; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f649b6cc5840a79c80217427abdadd889bf2738c..e26b1362899a9fad5e0e3a4e49acd98b67a4f03b 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1198,6 +1198,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index b121d404f3afb69fa1d0eae727c1dba92eadb0e5..7db20b7d8582595bc40f585104db21e04550d43d 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1307,6 +1307,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { entity.origin = entity.getBukkitEntity().getLocation(); } // Paper end @@ -74,7 +34,7 @@ index f649b6cc5840a79c80217427abdadd889bf2738c..e26b1362899a9fad5e0e3a4e49acd98b new com.destroystokyo.paper.event.entity.EntityAddToWorldEvent(entity.getBukkitEntity()).callEvent(); // Paper - fire while valid } -@@ -1210,6 +1211,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1319,6 +1320,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.removeEntityFromChunk(entity); this.entitiesById.remove(entity.getId()); this.unregisterEntity(entity); @@ -82,22 +42,62 @@ index f649b6cc5840a79c80217427abdadd889bf2738c..e26b1362899a9fad5e0e3a4e49acd98b } } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 398c1f223d25931fb4de65582ab162bfc4be5050..110b88a098de307ed02b7f72c02c333cd32ec531 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -275,6 +275,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + protected int numCollisions = 0; // Paper + public void inactiveTick() { } + // Spigot end ++ public boolean shouldBeRemoved; // Paper + + public float getBukkitYaw() { + return this.yaw; +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 1fa3e4418d14bd761ffbca6ea5dd80f6251caf16..246a4b69e1b4ee6affa9564d50f261fac2f269d0 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -859,6 +859,7 @@ public class Chunk implements IChunkAccess { + + for (int i1 = 0; i1 < l; ++i1) { + Entity entity1 = (Entity) list1.get(i1); ++ if (entity1.shouldBeRemoved) continue; // Paper + + if (entity1.getBoundingBox().c(axisalignedbb) && entity1 != entity) { + if (predicate == null || predicate.test(entity1)) { +@@ -896,6 +897,7 @@ public class Chunk implements IChunkAccess { + + while (iterator.hasNext()) { + T entity = (T) iterator.next(); // CraftBukkit - decompile error ++ if (entity.shouldBeRemoved) continue; // Paper + + if ((entitytypes == null || entity.getEntityType() == entitytypes) && entity.getBoundingBox().c(axisalignedbb) && predicate.test(entity)) { + list.add(entity); +@@ -918,6 +920,7 @@ public class Chunk implements IChunkAccess { + + while (iterator.hasNext()) { + T t0 = (T) iterator.next(); // CraftBukkit - decompile error ++ if (t0.shouldBeRemoved) continue; // Paper + + if (oclass.isInstance(t0) && t0.getBoundingBox().c(axisalignedbb) && (predicate == null || predicate.test(t0))) { // Spigot - instance check + list.add(t0); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d8d8a8e10911424ba6ce8a80c58f172fbe0b44af..be028a80247dfb3bf7c726b1868c6e5c5bd99264 100644 +index 71916f826ecd6203207cd5e2f9e51120fe539661..2869a121ff5477bf12b1e078e413be8e0dce1ff3 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -1046,6 +1046,7 @@ public class CraftWorld implements World { for (Object o : world.entitiesById.values()) { - if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; + if (o instanceof net.minecraft.world.entity.Entity) { + net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o; + if (mcEnt.shouldBeRemoved) continue; // Paper Entity bukkitEntity = mcEnt.getBukkitEntity(); // Assuming that bukkitEntity isn't null @@ -1065,6 +1066,7 @@ public class CraftWorld implements World { for (Object o : world.entitiesById.values()) { - if (o instanceof net.minecraft.server.Entity) { - net.minecraft.server.Entity mcEnt = (net.minecraft.server.Entity) o; + if (o instanceof net.minecraft.world.entity.Entity) { + net.minecraft.world.entity.Entity mcEnt = (net.minecraft.world.entity.Entity) o; + if (mcEnt.shouldBeRemoved) continue; // Paper Entity bukkitEntity = mcEnt.getBukkitEntity(); @@ -105,16 +105,16 @@ index d8d8a8e10911424ba6ce8a80c58f172fbe0b44af..be028a80247dfb3bf7c726b1868c6e5c @@ -1091,6 +1093,7 @@ public class CraftWorld implements World { for (Object entity: world.entitiesById.values()) { - if (entity instanceof net.minecraft.server.Entity) { -+ if (((net.minecraft.server.Entity) entity).shouldBeRemoved) continue; // Paper - Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + if (entity instanceof net.minecraft.world.entity.Entity) { ++ if (((net.minecraft.world.entity.Entity) entity).shouldBeRemoved) continue; // Paper + Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity(); if (bukkitEntity == null) { @@ -1114,6 +1117,7 @@ public class CraftWorld implements World { for (Object entity: world.entitiesById.values()) { - if (entity instanceof net.minecraft.server.Entity) { -+ if (((net.minecraft.server.Entity) entity).shouldBeRemoved) continue; // Paper - Entity bukkitEntity = ((net.minecraft.server.Entity) entity).getBukkitEntity(); + if (entity instanceof net.minecraft.world.entity.Entity) { ++ if (((net.minecraft.world.entity.Entity) entity).shouldBeRemoved) continue; // Paper + Entity bukkitEntity = ((net.minecraft.world.entity.Entity) entity).getBukkitEntity(); if (bukkitEntity == null) { diff --git a/Spigot-Server-Patches/0255-Implement-Expanded-ArmorStand-API.patch b/Spigot-Server-Patches/0255-Implement-Expanded-ArmorStand-API.patch index 68bae3f15e..ebce045866 100644 --- a/Spigot-Server-Patches/0255-Implement-Expanded-ArmorStand-API.patch +++ b/Spigot-Server-Patches/0255-Implement-Expanded-ArmorStand-API.patch @@ -7,11 +7,11 @@ Add the following: - Add proper methods for getting and setting items in both hands. Deprecates old methods - Enable/Disable slot interactions -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 9a3183e55fcb6809d2b324ad52e27f3e77d8fcb2..abcf3ab8bab2ca98ab0f7e852b8185e27949a210 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -395,6 +395,7 @@ public class EntityArmorStand extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 0936924707306204c06064ee796413159835bfa9..94cb66e0651d918ad984e2056602c70335ce2032 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -429,6 +429,7 @@ public class EntityArmorStand extends EntityLiving { return enumitemslot; } @@ -20,7 +20,7 @@ index 9a3183e55fcb6809d2b324ad52e27f3e77d8fcb2..abcf3ab8bab2ca98ab0f7e852b8185e2 return (this.disabledSlots & 1 << enumitemslot.getSlotFlag()) != 0 || enumitemslot.a() == EnumItemSlot.Function.HAND && !this.hasArms(); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 6ff7a59cc7052e900516a89db8daf0720c64a1ac..557cdb6ca007c617278e8cf723a2a11eae67d57d 100644 +index 6f922e4cbb095439fcd76ee0d0c08bc4160b8107..226d3a242c602a3e4d16b6eab11d938a1e3e84ba 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -239,5 +239,78 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { diff --git a/Spigot-Server-Patches/0256-AnvilDamageEvent.patch b/Spigot-Server-Patches/0256-AnvilDamageEvent.patch index d8bc4d00aa..3862e6017e 100644 --- a/Spigot-Server-Patches/0256-AnvilDamageEvent.patch +++ b/Spigot-Server-Patches/0256-AnvilDamageEvent.patch @@ -4,11 +4,11 @@ Date: Fri, 20 Jul 2018 23:37:03 -0500 Subject: [PATCH] AnvilDamageEvent -diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 6b98557f59cb92db9987a58db58cfa3adbd6de48..24631b2bcb2a1d057c1fb6596ff401133c8b548a 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvil.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java -@@ -67,7 +67,16 @@ public class ContainerAnvil extends ContainerAnvilAbstract { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java +index 9658c8206b5bab07838284935e9d5e0879e405f2..ff618bbb3fc4acfce51f5e5e6a504a63e9ad77cd 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java +@@ -80,7 +80,16 @@ public class ContainerAnvil extends ContainerAnvilAbstract { if (!entityhuman.abilities.canInstantlyBuild && iblockdata.a((Tag) TagsBlock.ANVIL) && entityhuman.getRandom().nextFloat() < 0.12F) { IBlockData iblockdata1 = BlockAnvil.c(iblockdata); diff --git a/Spigot-Server-Patches/0257-Add-TNTPrimeEvent.patch b/Spigot-Server-Patches/0257-Add-TNTPrimeEvent.patch index c0228b2317..a078c9f762 100644 --- a/Spigot-Server-Patches/0257-Add-TNTPrimeEvent.patch +++ b/Spigot-Server-Patches/0257-Add-TNTPrimeEvent.patch @@ -4,11 +4,35 @@ Date: Mon, 16 Jul 2018 00:05:05 +0300 Subject: [PATCH] Add TNTPrimeEvent -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index e79f3872de2989d0b9b28a8b49cc399968f5bdbf..4716f366342a3ef70d0ea50e3747786fad1e3573 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java -@@ -3,6 +3,7 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +index 97ef4c65c8cc569a99d9697f56bd44d32b151328..51993191e01f55e16667c25b8b57d6a6ddaf493b 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -61,6 +61,7 @@ import org.bukkit.craftbukkit.block.CraftBlock; + import org.bukkit.event.entity.EntityExplodeEvent; + import org.bukkit.event.entity.EntityRegainHealthEvent; + // CraftBukkit end ++import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent + + public class EntityEnderDragon extends EntityInsentient implements IMonster { + +@@ -515,6 +516,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { + }); + craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b); + } ++ // Paper start - TNTPrimeEvent ++ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); ++ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent()) ++ continue; ++ // Paper end + nmsBlock.wasExploded(world, blockposition, explosionSource); + + this.world.a(blockposition, false); +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java +index c22fad0038fdb0769e23db782e3341206fbd80f9..d2d59cc1acc7f67de62ac8d765f2b6b491b69053 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java +@@ -3,6 +3,7 @@ package net.minecraft.world.level.block; import com.google.common.collect.ImmutableMap; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntOpenHashMap; @@ -16,7 +40,7 @@ index e79f3872de2989d0b9b28a8b49cc399968f5bdbf..4716f366342a3ef70d0ea50e3747786f import java.util.Map; import java.util.Random; import java.util.function.Function; -@@ -269,7 +270,7 @@ public class BlockFire extends BlockFireAbstract { +@@ -289,7 +290,7 @@ public class BlockFire extends BlockFireAbstract { world.setTypeAndData(blockposition, this.a(world, blockposition, l), 3); } else { @@ -25,7 +49,7 @@ index e79f3872de2989d0b9b28a8b49cc399968f5bdbf..4716f366342a3ef70d0ea50e3747786f } Block block = iblockdata.getBlock(); -@@ -277,6 +278,13 @@ public class BlockFire extends BlockFireAbstract { +@@ -297,6 +298,13 @@ public class BlockFire extends BlockFireAbstract { if (block instanceof BlockTNT) { BlockTNT blocktnt = (BlockTNT) block; @@ -39,48 +63,48 @@ index e79f3872de2989d0b9b28a8b49cc399968f5bdbf..4716f366342a3ef70d0ea50e3747786f BlockTNT.a(world, blockposition); } } -diff --git a/src/main/java/net/minecraft/server/BlockTNT.java b/src/main/java/net/minecraft/server/BlockTNT.java -index c6fe9c1f7ef06c4524533130b493ca5e72bd1693..7b601955f3fd36f06c838b896b455a606954d980 100644 ---- a/src/main/java/net/minecraft/server/BlockTNT.java -+++ b/src/main/java/net/minecraft/server/BlockTNT.java -@@ -1,6 +1,7 @@ - package net.minecraft.server; - - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTNT.java b/src/main/java/net/minecraft/world/level/block/BlockTNT.java +index b5d40898bb4a10b3170cd1f42f1a44de539d53c3..71c46d5042f7e4585b364682cd5464edccdf43f6 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockTNT.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTNT.java +@@ -22,6 +22,7 @@ import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.level.block.state.properties.BlockProperties; + import net.minecraft.world.level.block.state.properties.BlockStateBoolean; + import net.minecraft.world.phys.MovingObjectPositionBlock; +import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent public class BlockTNT extends Block { -@@ -15,6 +16,11 @@ public class BlockTNT extends Block { +@@ -36,6 +37,11 @@ public class BlockTNT extends Block { public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { if (!iblockdata1.a(iblockdata.getBlock())) { if (world.isBlockIndirectlyPowered(blockposition)) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) + return; + // Paper end a(world, blockposition); world.a(blockposition, false); } -@@ -25,6 +31,11 @@ public class BlockTNT extends Block { +@@ -46,6 +52,11 @@ public class BlockTNT extends Block { @Override public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { if (world.isBlockIndirectlyPowered(blockposition)) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition);; ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition);; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.REDSTONE, null).callEvent()) + return; + // Paper end a(world, blockposition); world.a(blockposition, false); } -@@ -43,6 +54,12 @@ public class BlockTNT extends Block { +@@ -64,6 +75,12 @@ public class BlockTNT extends Block { @Override public void wasExploded(World world, BlockPosition blockposition, Explosion explosion) { if (!world.isClientSide) { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); + org.bukkit.entity.Entity source = explosion.source != null ? explosion.source.getBukkitEntity() : null; + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, source).callEvent()) + return; @@ -88,24 +112,24 @@ index c6fe9c1f7ef06c4524533130b493ca5e72bd1693..7b601955f3fd36f06c838b896b455a60 EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(world, (double) blockposition.getX() + 0.5D, (double) blockposition.getY(), (double) blockposition.getZ() + 0.5D, explosion.getSource()); entitytntprimed.setFuseTicks((short) (world.random.nextInt(entitytntprimed.getFuseTicks() / 4) + entitytntprimed.getFuseTicks() / 8)); -@@ -71,6 +88,11 @@ public class BlockTNT extends Block { +@@ -92,6 +109,11 @@ public class BlockTNT extends Block { if (item != Items.FLINT_AND_STEEL && item != Items.FIRE_CHARGE) { return super.interact(iblockdata, world, blockposition, entityhuman, enumhand, movingobjectpositionblock); } else { + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); + if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.ITEM, entityhuman.getBukkitEntity()).callEvent()) + return EnumInteractionResult.FAIL; + // Paper end a(world, blockposition, (EntityLiving) entityhuman); world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 11); if (!entityhuman.isCreative()) { -@@ -100,6 +122,13 @@ public class BlockTNT extends Block { +@@ -121,6 +143,13 @@ public class BlockTNT extends Block { } // CraftBukkit end + // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = MCUtil.toBukkitBlock(world, blockposition); ++ org.bukkit.block.Block tntBlock = net.minecraft.server.MCUtil.toBukkitBlock(world, blockposition); + if (!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.PROJECTILE, iprojectile.getBukkitEntity()).callEvent()) { + return; + } @@ -114,27 +138,3 @@ index c6fe9c1f7ef06c4524533130b493ca5e72bd1693..7b601955f3fd36f06c838b896b455a60 a(world, blockposition, entity instanceof EntityLiving ? (EntityLiving) entity : null); world.a(blockposition, false); } -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 348d3575115ed6c95b4aee56f0fd930103651489..90a3d3711f71209b7db89d2515377ed1818c3c83 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -12,6 +12,7 @@ import org.bukkit.craftbukkit.block.CraftBlock; - import org.bukkit.event.entity.EntityExplodeEvent; - import org.bukkit.event.entity.EntityRegainHealthEvent; - // CraftBukkit end -+import com.destroystokyo.paper.event.block.TNTPrimeEvent; // Paper - TNTPrimeEvent - - public class EntityEnderDragon extends EntityInsentient implements IMonster { - -@@ -466,6 +467,11 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { - }); - craftBlock.getNMS().dropNaturally((WorldServer) world, blockposition, ItemStack.b); - } -+ // Paper start - TNTPrimeEvent -+ org.bukkit.block.Block tntBlock = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); -+ if(!new TNTPrimeEvent(tntBlock, TNTPrimeEvent.PrimeReason.EXPLOSION, explosionSource.getSource().getBukkitEntity()).callEvent()) -+ continue; -+ // Paper end - nmsBlock.wasExploded(world, blockposition, explosionSource); - - this.world.a(blockposition, false); diff --git a/Spigot-Server-Patches/0258-Break-up-and-make-tab-spam-limits-configurable.patch b/Spigot-Server-Patches/0258-Break-up-and-make-tab-spam-limits-configurable.patch index 1713440648..21290b9078 100644 --- a/Spigot-Server-Patches/0258-Break-up-and-make-tab-spam-limits-configurable.patch +++ b/Spigot-Server-Patches/0258-Break-up-and-make-tab-spam-limits-configurable.patch @@ -44,11 +44,11 @@ index 77a03abd59db4a43f6f2d59d4c7ef176e782f205..bd508025b771424c942fd856c31d520b + tabSpamLimit = getInt("settings.spam-limiter.tab-spam-limit", tabSpamLimit); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 92e5e880081066c01310ac5561a90f16af7a629b..370bf14e04a5989ed306f94e669bd789e3ebd61b 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -83,6 +83,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index f727b6ffa0db33e59ce8e4ff64723c79b401ad70..e24997fd0d43ff8293537e8fdefe66f1f3dadcdb 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -228,6 +228,7 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit start - multithreaded fields private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); @@ -56,7 +56,7 @@ index 92e5e880081066c01310ac5561a90f16af7a629b..370bf14e04a5989ed306f94e669bd789 // CraftBukkit end private int j; private final Int2ShortMap k = new Int2ShortOpenHashMap(); -@@ -218,6 +219,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -363,6 +364,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.minecraftServer.getMethodProfiler().exit(); // CraftBukkit start for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; @@ -64,7 +64,7 @@ index 92e5e880081066c01310ac5561a90f16af7a629b..370bf14e04a5989ed306f94e669bd789 /* Use thread-safe field access instead if (this.chatThrottle > 0) { --this.chatThrottle; -@@ -569,7 +571,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -714,7 +716,7 @@ public class PlayerConnection implements PacketListenerPlayIn { public void a(PacketPlayInTabComplete packetplayintabcomplete) { // PlayerConnectionUtils.ensureMainThread(packetplayintabcomplete, this, this.player.getWorldServer()); // Paper - run this async // CraftBukkit start diff --git a/Spigot-Server-Patches/0259-Add-hand-to-bucket-events.patch b/Spigot-Server-Patches/0259-Add-hand-to-bucket-events.patch index 8fdd1b7f6e..bb9f886d57 100644 --- a/Spigot-Server-Patches/0259-Add-hand-to-bucket-events.patch +++ b/Spigot-Server-Patches/0259-Add-hand-to-bucket-events.patch @@ -4,101 +4,11 @@ Date: Thu, 2 Aug 2018 08:44:35 -0500 Subject: [PATCH] Add hand to bucket events -diff --git a/src/main/java/net/minecraft/server/EntityCow.java b/src/main/java/net/minecraft/server/EntityCow.java -index c20484220edc849e43a1067d169d4d36f0059836..42e6761c8b18b79ffd3f4d5e853ea87a2c153c23 100644 ---- a/src/main/java/net/minecraft/server/EntityCow.java -+++ b/src/main/java/net/minecraft/server/EntityCow.java -@@ -58,7 +58,7 @@ public class EntityCow extends EntityAnimal { - - if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) { - // CraftBukkit start - Got milk? -- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET); -+ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand - - if (event.isCancelled()) { - return EnumInteractionResult.PASS; -diff --git a/src/main/java/net/minecraft/server/ItemBucket.java b/src/main/java/net/minecraft/server/ItemBucket.java -index 70a0efac7a549fa0e9895813335f034ec98d3d2b..223361a1a8b41ebe91e0db39f40cf12a4968b1b4 100644 ---- a/src/main/java/net/minecraft/server/ItemBucket.java -+++ b/src/main/java/net/minecraft/server/ItemBucket.java -@@ -42,7 +42,7 @@ public class ItemBucket extends Item { - if (iblockdata.getBlock() instanceof IFluidSource) { - // CraftBukkit start - FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); -- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); -+ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); // Paper - add enumhand - - if (event.isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) -@@ -70,7 +70,7 @@ public class ItemBucket extends Item { - iblockdata = world.getType(blockposition); - BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; - -- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit -+ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand - this.a(world, itemstack, blockposition2); - if (entityhuman instanceof EntityPlayer) { - CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); -@@ -95,10 +95,12 @@ public class ItemBucket extends Item { - public void a(World world, ItemStack itemstack, BlockPosition blockposition) {} - - public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) { -- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null); -+ // Paper start - add enumHand -+ return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null, null); - } - -- public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) { -+ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack, EnumHand enumhand) { -+ // Paper end - // CraftBukkit end - if (!(this.fluidType instanceof FluidTypeFlowing)) { - return false; -@@ -111,7 +113,7 @@ public class ItemBucket extends Item { - - // CraftBukkit start - if (flag1 && entityhuman != null) { -- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack); -+ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand - if (event.isCancelled()) { - ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 -@@ -120,7 +122,7 @@ public class ItemBucket extends Item { - } - // CraftBukkit end - if (!flag1) { -- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit -+ return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand - } else if (world.getDimensionManager().isNether() && this.fluidType.a((Tag) TagsFluid.WATER)) { - int i = blockposition.getX(); - int j = blockposition.getY(); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 26669ded3ec47d13e4e79d65d0f05a588f9e1f63..d6bce67fff263d2c04be29020a8dc66fa260a53e 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -218,6 +218,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - } - // Paper end - -+ // Paper start - moved up from WorldServer -+ public BlockPosition getSpawn() { -+ BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); -+ -+ if (!this.getWorldBorder().a(blockposition)) { -+ blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); -+ } -+ -+ return blockposition; -+ } -+ // Paper end - @Override - public boolean s_() { - return this.isClientSide; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index e26b1362899a9fad5e0e3a4e49acd98b67a4f03b..f9d2228fb0543c60d2e0848afb4f927b6a7bce51 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1547,15 +1547,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 7db20b7d8582595bc40f585104db21e04550d43d..690e40aeed96a8d83e86c9aff0e910f6aa97c1c9 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1656,15 +1656,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.getMinecraftServer().getPlayerList().sendAll(new PacketPlayOutSpawnPosition(blockposition, f)); } @@ -125,8 +35,98 @@ index e26b1362899a9fad5e0e3a4e49acd98b67a4f03b..f9d2228fb0543c60d2e0848afb4f927b public float v() { return this.worldData.d(); +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityCow.java b/src/main/java/net/minecraft/world/entity/animal/EntityCow.java +index ef48ae4d398a1dd5bc67262ccdb5d8fc6bb2769c..1b43688ad232620410aa924cef02b54630ab1313 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityCow.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityCow.java +@@ -88,7 +88,7 @@ public class EntityCow extends EntityAnimal { + + if (itemstack.getItem() == Items.BUCKET && !this.isBaby()) { + // CraftBukkit start - Got milk? +- org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET); ++ org.bukkit.event.player.PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) entityhuman.world, entityhuman, this.getChunkCoordinates(), this.getChunkCoordinates(), null, itemstack, Items.MILK_BUCKET, enumhand); // Paper - add enumHand + + if (event.isCancelled()) { + return EnumInteractionResult.PASS; +diff --git a/src/main/java/net/minecraft/world/item/ItemBucket.java b/src/main/java/net/minecraft/world/item/ItemBucket.java +index 4bcac8defeaa146713cce43e04a51c1c9afddb1f..d126f668828e0788e369294c0b376ef52b344f2c 100644 +--- a/src/main/java/net/minecraft/world/item/ItemBucket.java ++++ b/src/main/java/net/minecraft/world/item/ItemBucket.java +@@ -71,7 +71,7 @@ public class ItemBucket extends Item { + if (iblockdata.getBlock() instanceof IFluidSource) { + // CraftBukkit start + FluidType dummyFluid = ((IFluidSource) iblockdata.getBlock()).removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); +- PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a()); ++ PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.a(), enumhand); // Paper - add enumhand + + if (event.isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-5163 (see PlayerInteractManager) +@@ -99,7 +99,7 @@ public class ItemBucket extends Item { + iblockdata = world.getType(blockposition); + BlockPosition blockposition2 = iblockdata.getBlock() instanceof IFluidContainer && this.fluidType == FluidTypes.WATER ? blockposition : blockposition1; + +- if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack)) { // CraftBukkit ++ if (this.a(entityhuman, world, blockposition2, movingobjectpositionblock1, movingobjectpositionblock1.getDirection(), blockposition, itemstack, enumhand)) { // CraftBukkit // Paper - add enumhand + this.a(world, itemstack, blockposition2); + if (entityhuman instanceof EntityPlayer) { + CriterionTriggers.y.a((EntityPlayer) entityhuman, blockposition2, itemstack); +@@ -124,10 +124,12 @@ public class ItemBucket extends Item { + public void a(World world, ItemStack itemstack, BlockPosition blockposition) {} + + public boolean a(@Nullable EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock) { +- return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null); ++ // Paper start - add enumHand ++ return a(entityhuman, world, blockposition, movingobjectpositionblock, null, null, null, null); + } + +- public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack) { ++ public boolean a(EntityHuman entityhuman, World world, BlockPosition blockposition, @Nullable MovingObjectPositionBlock movingobjectpositionblock, EnumDirection enumdirection, BlockPosition clicked, ItemStack itemstack, EnumHand enumhand) { ++ // Paper end + // CraftBukkit end + if (!(this.fluidType instanceof FluidTypeFlowing)) { + return false; +@@ -140,7 +142,7 @@ public class ItemBucket extends Item { + + // CraftBukkit start + if (flag1 && entityhuman != null) { +- PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack); ++ PlayerBucketEmptyEvent event = CraftEventFactory.callPlayerBucketEmptyEvent((WorldServer) world, entityhuman, blockposition, clicked, enumdirection, itemstack, enumhand); // Paper - add enumhand + if (event.isCancelled()) { + ((EntityPlayer) entityhuman).playerConnection.sendPacket(new PacketPlayOutBlockChange(world, blockposition)); // SPIGOT-4238: needed when looking through entity + ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541 +@@ -149,7 +151,7 @@ public class ItemBucket extends Item { + } + // CraftBukkit end + if (!flag1) { +- return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack); // CraftBukkit ++ return movingobjectpositionblock != null && this.a(entityhuman, world, movingobjectpositionblock.getBlockPosition().shift(movingobjectpositionblock.getDirection()), (MovingObjectPositionBlock) null, enumdirection, clicked, itemstack, enumhand); // CraftBukkit // Paper - add enumhand + } else if (world.getDimensionManager().isNether() && this.fluidType.a((Tag) TagsFluid.WATER)) { + int i = blockposition.getX(); + int j = blockposition.getY(); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 7b552e4e71c82833da2114604de98350567128f0..b0044d97afca1f658c193278eed542a743f20668 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -270,6 +270,17 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + } + // Paper end + ++ // Paper start - moved up from WorldServer ++ public BlockPosition getSpawn() { ++ BlockPosition blockposition = new BlockPosition(this.worldData.a(), this.worldData.b(), this.worldData.c()); ++ ++ if (!this.getWorldBorder().a(blockposition)) { ++ blockposition = this.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING, new BlockPosition(this.getWorldBorder().getCenterX(), 0.0D, this.getWorldBorder().getCenterZ())); ++ } ++ ++ return blockposition; ++ } ++ // Paper end + @Override + public boolean s_() { + return this.isClientSide; diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index d67c82b7727d68addc3a0d8ca6ba53fb21694892..c70d96f4800b42893ecf46aa820c201e5d9dd0f4 100644 +index e0e48094160b55b55efb9b567fa5fd7d497ed628..ecd3b31216616b0ffe239785e3942cfb4bfebcf8 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -227,7 +227,7 @@ public class CraftEventFactory { @@ -141,7 +141,7 @@ index d67c82b7727d68addc3a0d8ca6ba53fb21694892..c70d96f4800b42893ecf46aa820c201e @@ -406,6 +406,20 @@ public class CraftEventFactory { } - private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item) { + private static PlayerEvent getPlayerBucketEvent(boolean isFilling, WorldServer world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item) { + // Paper start - add enumHand + return getPlayerBucketEvent(isFilling, world, who, changed, clicked, clickedFace, itemstack, item, null); + } @@ -150,11 +150,11 @@ index d67c82b7727d68addc3a0d8ca6ba53fb21694892..c70d96f4800b42893ecf46aa820c201e + return (PlayerBucketEmptyEvent) getPlayerBucketEvent(false, world, who, changed, clicked, clickedFace, itemstack, Items.BUCKET, enumHand); + } + -+ public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.server.Item bucket, EnumHand enumHand) { ++ public static PlayerBucketFillEvent callPlayerBucketFillEvent(World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemInHand, net.minecraft.world.item.Item bucket, EnumHand enumHand) { + return (PlayerBucketFillEvent) getPlayerBucketEvent(true, world, who, clicked, changed, clickedFace, itemInHand, bucket, enumHand); + } + -+ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.server.Item item, EnumHand enumHand) { ++ private static PlayerEvent getPlayerBucketEvent(boolean isFilling, World world, EntityHuman who, BlockPosition changed, BlockPosition clicked, EnumDirection clickedFace, ItemStack itemstack, net.minecraft.world.item.Item item, EnumHand enumHand) { + // Paper end Player player = (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asNewCraftStack(item); diff --git a/Spigot-Server-Patches/0260-MC-135506-Experience-should-save-as-Integers.patch b/Spigot-Server-Patches/0260-MC-135506-Experience-should-save-as-Integers.patch index 0356da73d9..462f19eec4 100644 --- a/Spigot-Server-Patches/0260-MC-135506-Experience-should-save-as-Integers.patch +++ b/Spigot-Server-Patches/0260-MC-135506-Experience-should-save-as-Integers.patch @@ -4,11 +4,11 @@ Date: Fri, 3 Aug 2018 00:04:54 -0400 Subject: [PATCH] MC-135506: Experience should save as Integers -diff --git a/src/main/java/net/minecraft/server/EntityExperienceOrb.java b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -index 837a2c8f6af6e51316511e3948869ac059c8fc0d..4a94ce72d559263ef5fa4fb16dc286f531f51d55 100644 ---- a/src/main/java/net/minecraft/server/EntityExperienceOrb.java -+++ b/src/main/java/net/minecraft/server/EntityExperienceOrb.java -@@ -203,7 +203,7 @@ public class EntityExperienceOrb extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +index dc257a7cafc4b728aa5c99ca332143bb05896d7e..c1fa9437015a554ee875d4d2948dfcc2c8353f12 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java ++++ b/src/main/java/net/minecraft/world/entity/EntityExperienceOrb.java +@@ -217,7 +217,7 @@ public class EntityExperienceOrb extends Entity { public void saveData(NBTTagCompound nbttagcompound) { nbttagcompound.setShort("Health", (short) this.e); nbttagcompound.setShort("Age", (short) this.c); @@ -17,7 +17,7 @@ index 837a2c8f6af6e51316511e3948869ac059c8fc0d..4a94ce72d559263ef5fa4fb16dc286f5 this.savePaperNBT(nbttagcompound); // Paper } -@@ -211,7 +211,7 @@ public class EntityExperienceOrb extends Entity { +@@ -225,7 +225,7 @@ public class EntityExperienceOrb extends Entity { public void loadData(NBTTagCompound nbttagcompound) { this.e = nbttagcompound.getShort("Health"); this.c = nbttagcompound.getShort("Age"); diff --git a/Spigot-Server-Patches/0261-Fix-client-rendering-skulls-from-same-user.patch b/Spigot-Server-Patches/0261-Fix-client-rendering-skulls-from-same-user.patch index 91034d678c..10cce8f5d2 100644 --- a/Spigot-Server-Patches/0261-Fix-client-rendering-skulls-from-same-user.patch +++ b/Spigot-Server-Patches/0261-Fix-client-rendering-skulls-from-same-user.patch @@ -11,24 +11,11 @@ the texture payload, or random. This allows the client to render multiple skull textures from the same user, for when different skins were used when skull was made. -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index bdb6f9bf3477f85859e3f0dd761e2e895f1a8e2b..22568201a292edc8e25396e55cad1572d419b775 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -60,7 +60,7 @@ public final class ItemStack { - private int g; - @Deprecated - private Item item; -- private NBTTagCompound tag; -+ NBTTagCompound tag; // Paper -> package private - private boolean j; - private Entity k; - private ShapeDetectorBlock l; -diff --git a/src/main/java/net/minecraft/server/PacketDataSerializer.java b/src/main/java/net/minecraft/server/PacketDataSerializer.java -index 391f96e585d80f7921fd96f207b0b60d88961ae7..3a257d3b0a6adb4d0a43833b996d70765559eff8 100644 ---- a/src/main/java/net/minecraft/server/PacketDataSerializer.java -+++ b/src/main/java/net/minecraft/server/PacketDataSerializer.java -@@ -298,9 +298,18 @@ public class PacketDataSerializer extends ByteBuf { +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java +index df459918c14589155a574730205cb35d463b8079..4fc06bc5ef630b07fc8462cf835e6f92b151e6c6 100644 +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -311,9 +311,18 @@ public class PacketDataSerializer extends ByteBuf { if (item.usesDurability() || item.n()) { // Spigot start - filter itemstack = itemstack.cloneItemStack(); @@ -48,7 +35,7 @@ index 391f96e585d80f7921fd96f207b0b60d88961ae7..3a257d3b0a6adb4d0a43833b996d7076 } this.a(nbttagcompound); -@@ -320,7 +329,16 @@ public class PacketDataSerializer extends ByteBuf { +@@ -333,7 +342,16 @@ public class PacketDataSerializer extends ByteBuf { itemstack.setTag(this.l()); // CraftBukkit start if (itemstack.getTag() != null) { @@ -66,11 +53,11 @@ index 391f96e585d80f7921fd96f207b0b60d88961ae7..3a257d3b0a6adb4d0a43833b996d7076 } // CraftBukkit end return itemstack; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 36a7e41cc5036345929ebf4d2fa160a8c16c2c0a..0ef4fbb19fc816f578ad741c4406790f4185093d 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -58,6 +58,7 @@ public class PacketPlayOutMapChunk implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index b6b55d5baa5e8a6b69a3e4865c06bc8a4d61a4f3..7b47d4f1cbf9f8646e0b1af9277cf341ea28a2b3 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -69,6 +69,7 @@ public class PacketPlayOutMapChunk implements Packet { if (this.f() || (i & 1 << j) != 0) { NBTTagCompound nbttagcompound = tileentity.b(); @@ -78,11 +65,24 @@ index 36a7e41cc5036345929ebf4d2fa160a8c16c2c0a..0ef4fbb19fc816f578ad741c4406790f this.g.add(nbttagcompound); } -diff --git a/src/main/java/net/minecraft/server/TileEntitySkull.java b/src/main/java/net/minecraft/server/TileEntitySkull.java -index 4fae1b3274a96b871b39de083e9b28ab6129533f..579a81e521fdfabfa0318d06c6760a8ab7a88c1e 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySkull.java -+++ b/src/main/java/net/minecraft/server/TileEntitySkull.java -@@ -145,9 +145,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index c525afbc7d73488db2cae1501cdbe80ec05aeb7c..de171e18fbc6cc5ee06e75f4a3c60fd4c710d8bb 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -114,7 +114,7 @@ public final class ItemStack { + private int g; + @Deprecated + private Item item; +- private NBTTagCompound tag; ++ NBTTagCompound tag; // Paper -> package private + private boolean j; + private Entity k; + private ShapeDetectorBlock l; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java +index 06ab45e0927403beb6b5e11d2b5ea93d4786f1d3..fcc393bcf3e40c347a0320544cc93eb84a4d0b90 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySkull.java +@@ -153,9 +153,37 @@ public class TileEntitySkull extends TileEntity /*implements ITickable*/ { // Pa @Nullable @Override public PacketPlayOutTileEntityData getUpdatePacket() { diff --git a/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch b/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch index 8083a8e66b..b4e112664c 100644 --- a/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/Spigot-Server-Patches/0262-Add-Early-Warning-Feature-to-WatchDog.patch @@ -36,10 +36,10 @@ index bd508025b771424c942fd856c31d520b6f548082..62621562137cba4804f0465c58d25ca2 public static int tabSpamLimit = 500; private static void tabSpamLimiters() { diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 41fbdaa99f2c884371b7922d28551dffd44686ed..c24397d2ded7d3ea6f7440035ed64d29602900a6 100644 +index d69b6783572b44c9b8d49d0853a8282e14e64476..aa5abee5dd7dc601f3f738f11faf434d90e493a4 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -900,6 +900,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> { +@@ -28,7 +30,22 @@ public abstract class JsonList> { protected static final Logger LOGGER = LogManager.getLogger(); private static final Gson b = (new GsonBuilder()).setPrettyPrinting().create(); private final File c; @@ -61,7 +61,7 @@ index da21918ce0339a0eb8f65ce7791a04ceb12749b7..1fc0139cb9694ddea41f57d95774c3b4 public JsonList(File file) { this.c = file; -@@ -49,8 +66,13 @@ public abstract class JsonList> { +@@ -51,8 +68,13 @@ public abstract class JsonList> { @Nullable public V get(K k0) { @@ -77,7 +77,7 @@ index da21918ce0339a0eb8f65ce7791a04ceb12749b7..1fc0139cb9694ddea41f57d95774c3b4 } public void remove(K k0) { -@@ -79,9 +101,11 @@ public abstract class JsonList> { +@@ -81,9 +103,11 @@ public abstract class JsonList> { // CraftBukkit end public boolean isEmpty() { @@ -90,7 +90,7 @@ index da21918ce0339a0eb8f65ce7791a04ceb12749b7..1fc0139cb9694ddea41f57d95774c3b4 protected String a(K k0) { return k0.toString(); } -@@ -90,8 +114,9 @@ public abstract class JsonList> { +@@ -92,8 +116,9 @@ public abstract class JsonList> { return this.d.containsKey(this.a(k0)); } @@ -101,7 +101,7 @@ index da21918ce0339a0eb8f65ce7791a04ceb12749b7..1fc0139cb9694ddea41f57d95774c3b4 Iterator iterator = this.d.values().iterator(); while (iterator.hasNext()) { -@@ -108,8 +133,10 @@ public abstract class JsonList> { +@@ -110,8 +135,10 @@ public abstract class JsonList> { K k0 = (K) iterator.next(); // CraftBukkit - decompile error this.d.remove(this.a(k0)); @@ -113,7 +113,7 @@ index da21918ce0339a0eb8f65ce7791a04ceb12749b7..1fc0139cb9694ddea41f57d95774c3b4 } protected abstract JsonListEntry a(JsonObject jsonobject); -@@ -119,6 +146,7 @@ public abstract class JsonList> { +@@ -121,6 +148,7 @@ public abstract class JsonList> { } public void save() throws IOException { @@ -121,11 +121,11 @@ index da21918ce0339a0eb8f65ce7791a04ceb12749b7..1fc0139cb9694ddea41f57d95774c3b4 JsonArray jsonarray = new JsonArray(); this.d.values().stream().map((jsonlistentry) -> { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index ec175cd90491c3473543daa0b565fdc453888a34..79f6984a8e5bb73daeae1725a11840556c398de2 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -542,7 +542,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 2939a8186254a39ef20d778421b0ed984bb20a32..1dfa84dfb7b62c50081ad32b012d108a0b77b83c 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -617,7 +617,7 @@ public abstract class PlayerList { } else if (!this.isWhitelisted(gameprofile, event)) { // Paper //chatmessage = new ChatMessage("multiplayer.disconnect.not_whitelisted"); // Paper //event.disallow(PlayerLoginEvent.Result.KICK_WHITELIST, org.spigotmc.SpigotConfig.whitelistMessage); // Spigot // Paper - moved to isWhitelisted diff --git a/Spigot-Server-Patches/0265-Use-a-Queue-for-Queueing-Commands.patch b/Spigot-Server-Patches/0265-Use-a-Queue-for-Queueing-Commands.patch index ddf703357e..eead0924bc 100644 --- a/Spigot-Server-Patches/0265-Use-a-Queue-for-Queueing-Commands.patch +++ b/Spigot-Server-Patches/0265-Use-a-Queue-for-Queueing-Commands.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Use a Queue for Queueing Commands Lists are bad as Queues mmmkay. -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 750b1dc10ffb7adb9194e6cc8ace8fa92a5f0dec..bec26885108442c8e22cdddf5e764ecab6994dca 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -36,7 +36,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index a0804c4df6f047cf913ae70970219617052e853f..2d42b863b3fd83d1ee0532d1fcb63861641ec47b 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -75,7 +75,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer private static final Logger LOGGER = LogManager.getLogger(); private static final Pattern k = Pattern.compile("^[a-fA-F0-9]{40}$"); @@ -18,7 +18,7 @@ index 750b1dc10ffb7adb9194e6cc8ace8fa92a5f0dec..bec26885108442c8e22cdddf5e764eca private RemoteStatusListener remoteStatusListener; public final RemoteControlCommandListener remoteControlCommandListener; private RemoteControlListener remoteControlListener; -@@ -395,8 +395,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -434,8 +434,10 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer public void handleCommandQueue() { MinecraftTimings.serverCommandTimer.startTiming(); // Spigot diff --git a/Spigot-Server-Patches/0266-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch b/Spigot-Server-Patches/0266-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch index 9c404c8555..2e0e968f6b 100644 --- a/Spigot-Server-Patches/0266-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch +++ b/Spigot-Server-Patches/0266-Ability-to-get-Tile-Entities-from-a-chunk-without-sn.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Ability to get Tile Entities from a chunk without snapshots diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 1a312a868f6a65e7d4a53406825e9efd96d98607..569c0dd3d22c6ae154d3184905f5c09f9cbee238 100644 +index 32e4e59767587455272e685dfd23f945ba05f976..a8e94f69faec93661dc6ae2efeec44b8bfd2e965 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -3,8 +3,10 @@ package org.bukkit.craftbukkit; @@ -17,8 +17,8 @@ index 1a312a868f6a65e7d4a53406825e9efd96d98607..569c0dd3d22c6ae154d3184905f5c09f import java.util.Collection; +import java.util.List; import java.util.function.Predicate; - import net.minecraft.server.BiomeStorage; - import net.minecraft.server.BlockPosition; + import net.minecraft.core.BlockPosition; + import net.minecraft.core.IRegistry; @@ -130,9 +132,16 @@ public class CraftChunk implements Chunk { @Override @@ -34,7 +34,7 @@ index 1a312a868f6a65e7d4a53406825e9efd96d98607..569c0dd3d22c6ae154d3184905f5c09f } + // Paper end int index = 0; - net.minecraft.server.Chunk chunk = getHandle(); + net.minecraft.world.level.chunk.Chunk chunk = getHandle(); @@ -144,11 +153,33 @@ public class CraftChunk implements Chunk { } @@ -54,7 +54,7 @@ index 1a312a868f6a65e7d4a53406825e9efd96d98607..569c0dd3d22c6ae154d3184905f5c09f + if (!isLoaded()) { + getWorld().getChunkAt(x, z); // Transient load for this tick + } -+ net.minecraft.server.Chunk chunk = getHandle(); ++ net.minecraft.world.level.chunk.Chunk chunk = getHandle(); + + List entities = new ArrayList<>(); + diff --git a/Spigot-Server-Patches/0267-Allow-disabling-armour-stand-ticking.patch b/Spigot-Server-Patches/0267-Allow-disabling-armour-stand-ticking.patch index 456c61587f..fa440c0f81 100644 --- a/Spigot-Server-Patches/0267-Allow-disabling-armour-stand-ticking.patch +++ b/Spigot-Server-Patches/0267-Allow-disabling-armour-stand-ticking.patch @@ -19,11 +19,11 @@ index 3562950df4868b1393790b1a1ff1fe0dc589c155..5ab0e7183e48134b7a0f736462516b1a + log("ArmorStand ticking is " + (this.armorStandTick ? "enabled" : "disabled") + " by default"); + } } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc4723dd2fddc 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -46,9 +46,16 @@ public class EntityArmorStand extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 94cb66e0651d918ad984e2056602c70335ce2032..b2a661ddcf13f7d7758cc1cac1f4d2c3fa6c4635 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -80,9 +80,16 @@ public class EntityArmorStand extends EntityLiving { public Vector3f leftLegPose; public Vector3f rightLegPose; public boolean canMove = true; // Paper @@ -40,7 +40,7 @@ index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc472 this.handItems = NonNullList.a(2, ItemStack.b); this.armorItems = NonNullList.a(4, ItemStack.b); this.headPose = EntityArmorStand.bj; -@@ -144,6 +151,7 @@ public class EntityArmorStand extends EntityLiving { +@@ -178,6 +185,7 @@ public class EntityArmorStand extends EntityLiving { this.armorItems.set(enumitemslot.b(), itemstack); } @@ -48,7 +48,7 @@ index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc472 } @Override -@@ -224,6 +232,7 @@ public class EntityArmorStand extends EntityLiving { +@@ -258,6 +266,7 @@ public class EntityArmorStand extends EntityLiving { } nbttagcompound.set("Pose", this.B()); @@ -56,7 +56,7 @@ index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc472 } @Override -@@ -255,6 +264,12 @@ public class EntityArmorStand extends EntityLiving { +@@ -289,6 +298,12 @@ public class EntityArmorStand extends EntityLiving { this.setBasePlate(nbttagcompound.getBoolean("NoBasePlate")); this.setMarker(nbttagcompound.getBoolean("Marker")); this.noclip = !this.A(); @@ -69,7 +69,7 @@ index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc472 NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Pose"); this.g(nbttagcompound1); -@@ -610,7 +625,29 @@ public class EntityArmorStand extends EntityLiving { +@@ -644,7 +659,29 @@ public class EntityArmorStand extends EntityLiving { @Override public void tick() { @@ -99,7 +99,7 @@ index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc472 Vector3f vector3f = (Vector3f) this.datawatcher.get(EntityArmorStand.c); if (!this.headPose.equals(vector3f)) { -@@ -733,29 +770,36 @@ public class EntityArmorStand extends EntityLiving { +@@ -767,29 +804,36 @@ public class EntityArmorStand extends EntityLiving { public void setHeadPose(Vector3f vector3f) { this.headPose = vector3f; this.datawatcher.set(EntityArmorStand.c, vector3f); @@ -137,7 +137,7 @@ index abcf3ab8bab2ca98ab0f7e852b8185e27949a210..5076dd7e874be76d81b13f53076bc472 this.datawatcher.set(EntityArmorStand.bh, vector3f); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java -index 557cdb6ca007c617278e8cf723a2a11eae67d57d..40e9005c0f520a26a419beae17705171e61c646a 100644 +index 226d3a242c602a3e4d16b6eab11d938a1e3e84ba..e87f293cf26d7ce2a8c385936d09be9b41968cea 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArmorStand.java @@ -312,5 +312,16 @@ public class CraftArmorStand extends CraftLivingEntity implements ArmorStand { diff --git a/Spigot-Server-Patches/0268-Optimize-BlockPosition-helper-methods.patch b/Spigot-Server-Patches/0268-Optimize-BlockPosition-helper-methods.patch index 593fcdf42c..d248d915c6 100644 --- a/Spigot-Server-Patches/0268-Optimize-BlockPosition-helper-methods.patch +++ b/Spigot-Server-Patches/0268-Optimize-BlockPosition-helper-methods.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize BlockPosition helper methods Resolves #1338 -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index f112fe95cb89f6196a41252193e9eb44008cfc5f..f068436960c96b0df427bcdf337a4dcc6a9f66f5 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -115,58 +115,75 @@ public class BlockPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index 370b2c4460d6b52b5ef7da89f5ebf7ef50deb582..4c9ec211470f95d538d1d95c74796190edf99b87 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -121,58 +121,75 @@ public class BlockPosition extends BaseBlockPosition { @Override public BlockPosition up() { diff --git a/Spigot-Server-Patches/0270-Slime-Pathfinder-Events.patch b/Spigot-Server-Patches/0270-Slime-Pathfinder-Events.patch index e1acb7bf39..c9e838ba63 100644 --- a/Spigot-Server-Patches/0270-Slime-Pathfinder-Events.patch +++ b/Spigot-Server-Patches/0270-Slime-Pathfinder-Events.patch @@ -4,13 +4,13 @@ Date: Fri, 24 Aug 2018 08:18:42 -0500 Subject: [PATCH] Slime Pathfinder Events -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10975ffc79 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -6,6 +6,14 @@ import java.util.Optional; - import java.util.Random; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +index 01d5b0db9a34d88172e8c7c84c4e1d0b2562217c..40e39e382092b1a8f831da0cea1557a781c98600 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +@@ -45,6 +45,14 @@ import net.minecraft.world.level.levelgen.SeededRandom; + import net.minecraft.world.level.storage.loot.LootTables; + import net.minecraft.world.phys.Vec3D; +// Paper start +import com.destroystokyo.paper.event.entity.SlimeChangeDirectionEvent; @@ -23,7 +23,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 // CraftBukkit start import java.util.ArrayList; import java.util.List; -@@ -66,6 +74,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -105,6 +113,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public void saveData(NBTTagCompound nbttagcompound) { super.saveData(nbttagcompound); @@ -31,7 +31,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 nbttagcompound.setInt("Size", this.getSize() - 1); nbttagcompound.setBoolean("wasOnGround", this.bp); } -@@ -80,6 +89,11 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -119,6 +128,11 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.setSize(i + 1, false); super.loadData(nbttagcompound); @@ -43,7 +43,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 this.bp = nbttagcompound.getBoolean("wasOnGround"); } -@@ -359,7 +373,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -398,7 +412,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public boolean a() { @@ -52,7 +52,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 } @Override -@@ -380,7 +394,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -419,7 +433,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public boolean a() { @@ -61,7 +61,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 } @Override -@@ -406,14 +420,18 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -445,14 +459,18 @@ public class EntitySlime extends EntityInsentient implements IMonster { @Override public boolean a() { @@ -82,7 +82,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 } ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.b, false); -@@ -434,7 +452,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -473,7 +491,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { public boolean a() { EntityLiving entityliving = this.a.getGoalTarget(); @@ -99,7 +99,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 } @Override -@@ -447,7 +473,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -486,7 +512,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { public boolean b() { EntityLiving entityliving = this.a.getGoalTarget(); @@ -116,7 +116,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 } @Override -@@ -455,6 +489,13 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -494,6 +528,13 @@ public class EntitySlime extends EntityInsentient implements IMonster { this.a.a((Entity) this.a.getGoalTarget(), 10.0F, 10.0F); ((EntitySlime.ControllerMoveSlime) this.a.getControllerMove()).a(this.a.yaw, this.a.eL()); } @@ -130,7 +130,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 } static class ControllerMoveSlime extends ControllerMove { -@@ -513,4 +554,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { +@@ -552,4 +593,15 @@ public class EntitySlime extends EntityInsentient implements IMonster { } } } @@ -147,7 +147,7 @@ index d774a0893b2e6599bade3a9edf22668a30587503..60818e1a7ce9c637bef8dc05de8cba10 + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java -index ce6ed6e890795ff2840c800a8fd56fdc618b383a..6e9f1b66dfc12491c945f87c51e81aa02424e885 100644 +index aa0ac8d8493dc79dda3fed2ff4d80c5b7a7e3df6..cf5c6030105e56813f526e710e5db0c59d88c99e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftSlime.java @@ -35,4 +35,14 @@ public class CraftSlime extends CraftMob implements Slime { diff --git a/Spigot-Server-Patches/0271-Configurable-speed-for-water-flowing-over-lava.patch b/Spigot-Server-Patches/0271-Configurable-speed-for-water-flowing-over-lava.patch index 0e64e30765..56b931091b 100644 --- a/Spigot-Server-Patches/0271-Configurable-speed-for-water-flowing-over-lava.patch +++ b/Spigot-Server-Patches/0271-Configurable-speed-for-water-flowing-over-lava.patch @@ -19,11 +19,11 @@ index 5ab0e7183e48134b7a0f736462516b1a8a333b04..f280dbff4a09bc611a9ca565c6d697d0 + log("Water over lava flow speed: " + waterOverLavaFlowSpeed); + } } -diff --git a/src/main/java/net/minecraft/server/BlockFluids.java b/src/main/java/net/minecraft/server/BlockFluids.java -index 4c076dd29cc221b43f9a53e484594dbb4dee56f5..07a9d462abad9a432dd5a153277839feeabad4bf 100644 ---- a/src/main/java/net/minecraft/server/BlockFluids.java -+++ b/src/main/java/net/minecraft/server/BlockFluids.java -@@ -76,11 +76,28 @@ public class BlockFluids extends Block implements IFluidSource { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFluids.java b/src/main/java/net/minecraft/world/level/block/BlockFluids.java +index 0654c77ab059dea2ad06cb16d07950e153d3f15d..9fcdb06c7907554fc7cdf887a2c313c9f1d1659b 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFluids.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFluids.java +@@ -100,11 +100,28 @@ public class BlockFluids extends Block implements IFluidSource { @Override public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { if (this.a(world, blockposition, iblockdata)) { @@ -53,7 +53,7 @@ index 4c076dd29cc221b43f9a53e484594dbb4dee56f5..07a9d462abad9a432dd5a153277839fe @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { if (iblockdata.getFluid().isSource() || iblockdata1.getFluid().isSource()) { -@@ -93,7 +110,7 @@ public class BlockFluids extends Block implements IFluidSource { +@@ -117,7 +134,7 @@ public class BlockFluids extends Block implements IFluidSource { @Override public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { if (this.a(world, blockposition, iblockdata)) { diff --git a/Spigot-Server-Patches/0272-Optimize-CraftBlockData-Creation.patch b/Spigot-Server-Patches/0272-Optimize-CraftBlockData-Creation.patch index b2a4bd7feb..0edba12deb 100644 --- a/Spigot-Server-Patches/0272-Optimize-CraftBlockData-Creation.patch +++ b/Spigot-Server-Patches/0272-Optimize-CraftBlockData-Creation.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Optimize CraftBlockData Creation Avoids a hashmap lookup by cacheing a reference to the CraftBlockData and cloning it when one is needed. -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index 8bcca73ae48ee822d32a6d23be2e1056a376e5f6..62e7c6cb1b363d1ee626c4405f8c30e74aba03e9 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -323,6 +323,14 @@ public abstract class BlockBase { +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index 61e2da8d8b2ebf50b28362c5c89bf5c32dbba1ba..58c9f11bda5b8a0d80739d7c243e8e5cba4fe0af 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -374,6 +374,14 @@ public abstract class BlockBase { this.o = blockbase_info.t; this.p = blockbase_info.u; } @@ -26,7 +26,7 @@ index 8bcca73ae48ee822d32a6d23be2e1056a376e5f6..62e7c6cb1b363d1ee626c4405f8c30e7 public void a() { if (!this.getBlock().o()) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 0a377b2026d147abe3d0ec44ed605a20d4664fea..41a32f2c77f2e7b79a067a0ce15c894e53ed8709 100644 +index 76fd1fea386d0e65c63c529dba772f01d9888407..ed88da727feddc319a650fb35710d16727f6dbd7 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -509,7 +509,17 @@ public class CraftBlockData implements BlockData { diff --git a/Spigot-Server-Patches/0273-Optimize-RegistryMaterials.patch b/Spigot-Server-Patches/0273-Optimize-RegistryMaterials.patch index c3f7153786..a37df72fa3 100644 --- a/Spigot-Server-Patches/0273-Optimize-RegistryMaterials.patch +++ b/Spigot-Server-Patches/0273-Optimize-RegistryMaterials.patch @@ -7,19 +7,19 @@ Use larger initial sizes to increase bucket capacity on the BiMap BiMap.get was seen to be using a good bit of CPU time. -diff --git a/src/main/java/net/minecraft/server/RegistryMaterials.java b/src/main/java/net/minecraft/server/RegistryMaterials.java -index 6000711dd40628bd80a681e63c053a403c88a883..b9de548c9049fca7a24b5259b6c9a01fca0f16ae 100644 ---- a/src/main/java/net/minecraft/server/RegistryMaterials.java -+++ b/src/main/java/net/minecraft/server/RegistryMaterials.java -@@ -26,6 +26,7 @@ import java.util.OptionalInt; - import java.util.Random; - import java.util.Set; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/core/RegistryMaterials.java b/src/main/java/net/minecraft/core/RegistryMaterials.java +index f3f6ed83d509d228944d15fc2b2b4cb85b05e366..18f78a5cb03dd9c8349c28b99d013752e32c9167 100644 +--- a/src/main/java/net/minecraft/core/RegistryMaterials.java ++++ b/src/main/java/net/minecraft/core/RegistryMaterials.java +@@ -30,6 +30,7 @@ import net.minecraft.SystemUtils; + import net.minecraft.resources.MinecraftKey; + import net.minecraft.resources.RegistryDataPackCodec; + import net.minecraft.resources.ResourceKey; +import it.unimi.dsi.fastutil.objects.Reference2IntOpenHashMap; // Paper import org.apache.commons.lang3.Validate; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -34,7 +35,7 @@ public class RegistryMaterials extends IRegistryWritable { +@@ -38,7 +39,7 @@ public class RegistryMaterials extends IRegistryWritable { protected static final Logger LOGGER = LogManager.getLogger(); private final ObjectList bf = new ObjectArrayList(256); @@ -28,7 +28,7 @@ index 6000711dd40628bd80a681e63c053a403c88a883..b9de548c9049fca7a24b5259b6c9a01f private final BiMap bh; private final BiMap, T> bi; private final Map bj; -@@ -45,9 +46,9 @@ public class RegistryMaterials extends IRegistryWritable { +@@ -49,9 +50,9 @@ public class RegistryMaterials extends IRegistryWritable { public RegistryMaterials(ResourceKey> resourcekey, Lifecycle lifecycle) { super(resourcekey, lifecycle); this.bg.defaultReturnValue(-1); @@ -41,7 +41,7 @@ index 6000711dd40628bd80a681e63c053a403c88a883..b9de548c9049fca7a24b5259b6c9a01f this.bk = lifecycle; } -@@ -191,7 +192,7 @@ public class RegistryMaterials extends IRegistryWritable { +@@ -195,7 +196,7 @@ public class RegistryMaterials extends IRegistryWritable { this.b = collection.toArray(new Object[collection.size()]); } @@ -50,7 +50,7 @@ index 6000711dd40628bd80a681e63c053a403c88a883..b9de548c9049fca7a24b5259b6c9a01f } public static Codec> a(ResourceKey> resourcekey, Lifecycle lifecycle, Codec codec) { -@@ -211,7 +212,7 @@ public class RegistryMaterials extends IRegistryWritable { +@@ -215,7 +216,7 @@ public class RegistryMaterials extends IRegistryWritable { Iterator iterator = registrymaterials.iterator(); while (iterator.hasNext()) { diff --git a/Spigot-Server-Patches/0274-Add-PhantomPreSpawnEvent.patch b/Spigot-Server-Patches/0274-Add-PhantomPreSpawnEvent.patch index 5b12817e5e..7ca23533af 100644 --- a/Spigot-Server-Patches/0274-Add-PhantomPreSpawnEvent.patch +++ b/Spigot-Server-Patches/0274-Add-PhantomPreSpawnEvent.patch @@ -4,11 +4,11 @@ Date: Sat, 25 Aug 2018 19:56:51 -0500 Subject: [PATCH] Add PhantomPreSpawnEvent -diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index c5ac72e2d5ffdfe0e605a4f2b9003ac6125a1e2b..1afcf17a8ca4eb17125e2a9d066c5a15a3818417 100644 ---- a/src/main/java/net/minecraft/server/EntityPhantom.java -+++ b/src/main/java/net/minecraft/server/EntityPhantom.java -@@ -125,6 +125,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java +index 6053894c5250e9a1a0c4aa2d681127dfd652b34f..bdb0a9541b4f167b95578034ec15e7051a7721be 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java +@@ -161,6 +161,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { } this.setSize(nbttagcompound.getInt("Size")); @@ -20,7 +20,7 @@ index c5ac72e2d5ffdfe0e605a4f2b9003ac6125a1e2b..1afcf17a8ca4eb17125e2a9d066c5a15 } @Override -@@ -134,6 +139,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { +@@ -170,6 +175,11 @@ public class EntityPhantom extends EntityFlying implements IMonster { nbttagcompound.setInt("AY", this.d.getY()); nbttagcompound.setInt("AZ", this.d.getZ()); nbttagcompound.setInt("Size", this.getSize()); @@ -32,7 +32,7 @@ index c5ac72e2d5ffdfe0e605a4f2b9003ac6125a1e2b..1afcf17a8ca4eb17125e2a9d066c5a15 } @Override -@@ -180,6 +190,14 @@ public class EntityPhantom extends EntityFlying implements IMonster { +@@ -216,6 +226,14 @@ public class EntityPhantom extends EntityFlying implements IMonster { return entitysize.a(f); } @@ -47,11 +47,11 @@ index c5ac72e2d5ffdfe0e605a4f2b9003ac6125a1e2b..1afcf17a8ca4eb17125e2a9d066c5a15 class b extends PathfinderGoal { private final PathfinderTargetCondition b; -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index 8947c7dfb0d7520b6a8fb0a75ddaf8163fd4baa5..2e3d8d78c7a2b6c9a76c3446f8532137c537c79c 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -@@ -53,8 +53,17 @@ public class MobSpawnerPhantom implements MobSpawner { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java +index cfc32acee1e456a0fda12a5faa4035e29d0c3d5e..afbcabca5180e26e85af820ad4ca2de1163b55a1 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java +@@ -73,8 +73,17 @@ public class MobSpawnerPhantom implements MobSpawner { int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1); for (int l = 0; l < k; ++l) { @@ -71,7 +71,7 @@ index 8947c7dfb0d7520b6a8fb0a75ddaf8163fd4baa5..2e3d8d78c7a2b6c9a76c3446f8532137 groupdataentity = entityphantom.prepare(worldserver, difficultydamagescaler, EnumMobSpawn.NATURAL, groupdataentity, (NBTTagCompound) null); worldserver.addAllEntities(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java -index 9f9ee9239037acced498bbebe0ea396473b487ec..2b97313694605171ea4627edde036e3754b5e03b 100644 +index 6ec7cf434b6586342da3f351466f5c7d72df290d..0cea1d8e23da3a79ef06e43752665a5401b01b4b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java @@ -35,4 +35,10 @@ public class CraftPhantom extends CraftFlying implements Phantom { diff --git a/Spigot-Server-Patches/0275-Add-More-Creeper-API.patch b/Spigot-Server-Patches/0275-Add-More-Creeper-API.patch index 6fb6c526e2..7b462d6587 100644 --- a/Spigot-Server-Patches/0275-Add-More-Creeper-API.patch +++ b/Spigot-Server-Patches/0275-Add-More-Creeper-API.patch @@ -4,11 +4,11 @@ Date: Fri, 24 Aug 2018 11:50:26 -0500 Subject: [PATCH] Add More Creeper API -diff --git a/src/main/java/net/minecraft/server/EntityCreeper.java b/src/main/java/net/minecraft/server/EntityCreeper.java -index b0de5c0705983debd7995c586612a7802f6d8f59..b2f028422d9a7a84e49e383b78032feb887a85c0 100644 ---- a/src/main/java/net/minecraft/server/EntityCreeper.java -+++ b/src/main/java/net/minecraft/server/EntityCreeper.java -@@ -15,7 +15,7 @@ public class EntityCreeper extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java +index ea15f54b70361bca529936e6d2e9bc555c60a657..9c8abb18c0ed850939b6691396f5d551e13c7af9 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityCreeper.java +@@ -50,7 +50,7 @@ public class EntityCreeper extends EntityMonster { private static final DataWatcherObject POWERED = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject d = DataWatcher.a(EntityCreeper.class, DataWatcherRegistry.i); private static final DataWatcherObject isIgnitedDW = d; // Paper OBFHELPER private int bo; @@ -17,7 +17,7 @@ index b0de5c0705983debd7995c586612a7802f6d8f59..b2f028422d9a7a84e49e383b78032feb public int maxFuseTicks = 30; public int explosionRadius = 3; private int bs; -@@ -255,7 +255,18 @@ public class EntityCreeper extends EntityMonster { +@@ -290,7 +290,18 @@ public class EntityCreeper extends EntityMonster { } public void ignite() { @@ -38,7 +38,7 @@ index b0de5c0705983debd7995c586612a7802f6d8f59..b2f028422d9a7a84e49e383b78032feb public boolean canCauseHeadDrop() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java -index 896405148c489011e4f06c43fe961045b7426377..075a5e77e2c2a873b048b9886d630e71238988da 100644 +index 013e0b1bca7cb348316bf3917455b160af0c57cc..8499a37611d7bb4f0a6598d6e78de1d52ae5ea02 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftCreeper.java @@ -88,4 +88,18 @@ public class CraftCreeper extends CraftMonster implements Creeper { diff --git a/Spigot-Server-Patches/0278-Add-ray-tracing-methods-to-LivingEntity.patch b/Spigot-Server-Patches/0278-Add-ray-tracing-methods-to-LivingEntity.patch index 846830b082..4e7d50ca7e 100644 --- a/Spigot-Server-Patches/0278-Add-ray-tracing-methods-to-LivingEntity.patch +++ b/Spigot-Server-Patches/0278-Add-ray-tracing-methods-to-LivingEntity.patch @@ -4,11 +4,11 @@ Date: Mon, 3 Sep 2018 18:20:03 -0500 Subject: [PATCH] Add ray tracing methods to LivingEntity -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index e118f96fb9b67874ec86db8dede00cf34473e085..858db1505aa06d85f4e0b522d221f6543ff40f56 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3492,6 +3492,23 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 189a00cb68ce9a9060117b79c5356ebb93d7fa62..9d8f92c313829bb32c17907bf2ef23d069517dc3 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3585,6 +3585,23 @@ public abstract class EntityLiving extends Entity { this.broadcastItemBreak(enumhand == EnumHand.MAIN_HAND ? EnumItemSlot.MAINHAND : EnumItemSlot.OFFHAND); } // Paper start @@ -33,7 +33,7 @@ index e118f96fb9b67874ec86db8dede00cf34473e085..858db1505aa06d85f4e0b522d221f654 public int getShieldBlockingDelay() { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index a91070c3674dc47e0019e642f0f76a3cf76b7387..3ec331f51bb305a82d2a12423c28d1f2e8ab8365 100644 +index db58175ac8972a4a9f5b7b312c6301f87e943a0e..a60a12a7705be29b6f318c587e1c6149b89d86c3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -201,6 +201,28 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0279-Expose-attack-cooldown-methods-for-Player.patch b/Spigot-Server-Patches/0279-Expose-attack-cooldown-methods-for-Player.patch index aef72413ea..cb48db1e26 100644 --- a/Spigot-Server-Patches/0279-Expose-attack-cooldown-methods-for-Player.patch +++ b/Spigot-Server-Patches/0279-Expose-attack-cooldown-methods-for-Player.patch @@ -4,11 +4,11 @@ Date: Tue, 4 Sep 2018 15:02:00 -0500 Subject: [PATCH] Expose attack cooldown methods for Player -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 67e14b606f9eb83e111e76665bd1228034193513..d9eaa6ed3408d377218d64d75e97c2ed00ab0b08 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -2006,6 +2006,7 @@ public abstract class EntityHuman extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 5f92ba350658c7f1cac9111f06d95e6ffc5600c3..bed54f9732bbfe9edab81744276643da482785d3 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -2100,6 +2100,7 @@ public abstract class EntityHuman extends EntityLiving { this.datawatcher.set(EntityHuman.bl, nbttagcompound); } @@ -17,12 +17,12 @@ index 67e14b606f9eb83e111e76665bd1228034193513..d9eaa6ed3408d377218d64d75e97c2ed return (float) (1.0D / this.b(GenericAttributes.ATTACK_SPEED) * 20.0D); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 778bbaf03d050271c7b97c2dc72ee57d46600e0d..794235ef374e1f035220d8485f5a937e3e9ff72c 100644 +index 1851f261ce8e454cbe4012c0c4ea6a69e926daa0..c763f2bbd10ce6b62d703d3eabb894f24be91b11 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2181,6 +2181,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { - connection.sendPacket(new net.minecraft.server.PacketPlayOutOpenBook(net.minecraft.server.EnumHand.MAIN_HAND)); - connection.sendPacket(new net.minecraft.server.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); + connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutOpenBook(net.minecraft.world.EnumHand.MAIN_HAND)); + connection.sendPacket(new net.minecraft.network.protocol.game.PacketPlayOutSetSlot(0, slot, inventory.getItemInHand())); } + + public float getCooldownPeriod() { diff --git a/Spigot-Server-Patches/0280-Improve-death-events.patch b/Spigot-Server-Patches/0280-Improve-death-events.patch index 271ae60c1d..a464187a36 100644 --- a/Spigot-Server-Patches/0280-Improve-death-events.patch +++ b/Spigot-Server-Patches/0280-Improve-death-events.patch @@ -14,11 +14,62 @@ to cancel the death which has the benefit of also receiving the dropped items and experience which is otherwise only properly possible by using internal code. -diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java -index 0790d45e3c8ac68c280b9378d93061b48b045639..a8054a599e3eb502e7bbce903b5683987f95fb66 100644 ---- a/src/main/java/net/minecraft/server/CombatTracker.java -+++ b/src/main/java/net/minecraft/server/CombatTracker.java -@@ -192,6 +192,7 @@ public class CombatTracker { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index b3c5a22bf2eb360399ebfbf90fc74843dcd78509..b1e45c326b27d640337fc69bd0e107f5db3eb4cf 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -213,6 +213,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public int ping; + public boolean viewingCredits; + private int containerUpdateDelay; // Paper ++ // Paper start - cancellable death event ++ public boolean queueHealthUpdatePacket = false; ++ public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; ++ // Paper end + + // CraftBukkit start + public String displayName; +@@ -716,6 +720,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); + + org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure ++ // Paper start - cancellable death event ++ if (event.isCancelled()) { ++ // make compatible with plugins that might have already set the health in an event listener ++ if (this.getHealth() <= 0) { ++ this.setHealth((float) event.getReviveHealth()); ++ } ++ return; ++ } ++ // Paper end + + // SPIGOT-943 - only call if they have an inventory open + if (this.activeContainer != this.defaultContainer) { +@@ -862,8 +875,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + } + } +- +- return super.damageEntity(damagesource, f); ++ // Paper start - cancellable death events ++ //return super.damageEntity(damagesource, f); ++ this.queueHealthUpdatePacket = true; ++ boolean damaged = super.damageEntity(damagesource, f); ++ this.queueHealthUpdatePacket = false; ++ if (this.queuedHealthUpdatePacket != null) { ++ this.playerConnection.sendPacket(this.queuedHealthUpdatePacket); ++ this.queuedHealthUpdatePacket = null; ++ } ++ return damaged; ++ // Paper end + } + } + } +diff --git a/src/main/java/net/minecraft/world/damagesource/CombatTracker.java b/src/main/java/net/minecraft/world/damagesource/CombatTracker.java +index f6f79ed9c38206cc6a4feb5504e854a476868aec..7d2b947b3c2b255c01241f2c4a6d7377a0a7c671 100644 +--- a/src/main/java/net/minecraft/world/damagesource/CombatTracker.java ++++ b/src/main/java/net/minecraft/world/damagesource/CombatTracker.java +@@ -203,6 +203,7 @@ public class CombatTracker { this.h = null; } @@ -26,11 +77,11 @@ index 0790d45e3c8ac68c280b9378d93061b48b045639..a8054a599e3eb502e7bbce903b568398 public void g() { int i = this.f ? 300 : 100; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 49c7b40744adcd36e5ae1eef026679e9b646feac..9b55635d97f8ad90f13fdf609471c1f73eb40aed 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1452,6 +1452,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 110b88a098de307ed02b7f72c02c333cd32ec531..4d7bb023092ee118d68ecce1918e220f541b33c1 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1537,6 +1537,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } // CraftBukkit end @@ -38,7 +89,7 @@ index 49c7b40744adcd36e5ae1eef026679e9b646feac..9b55635d97f8ad90f13fdf609471c1f7 public void a(Entity entity, int i, DamageSource damagesource) { if (entity instanceof EntityPlayer) { CriterionTriggers.c.a((EntityPlayer) entity, this, damagesource); -@@ -2351,6 +2352,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2436,6 +2437,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.fallDistance = 0.0F; } @@ -46,83 +97,11 @@ index 49c7b40744adcd36e5ae1eef026679e9b646feac..9b55635d97f8ad90f13fdf609471c1f7 public void a(WorldServer worldserver, EntityLiving entityliving) {} protected void l(double d0, double d1, double d2) { -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 5076dd7e874be76d81b13f53076bc4723dd2fddc..cd50fe3616d4b33c7ad76458fb75683541c33ae5 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -711,7 +711,8 @@ public class EntityArmorStand extends EntityLiving { - - @Override - public void killEntity() { -- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event -+ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable -+ if (event.isCancelled()) return; // Paper - make cancellable - this.die(); - } - -diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java -index a7bbf21e9736a0da38f95d93b013097b1e745306..56c119e8d11c5ffb1f90ac4249bce434b3e78884 100644 ---- a/src/main/java/net/minecraft/server/EntityFox.java -+++ b/src/main/java/net/minecraft/server/EntityFox.java -@@ -577,15 +577,25 @@ public class EntityFox extends EntityAnimal { - } - - @Override -- protected void d(DamageSource damagesource) { -- ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND); -+ protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper -+ ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND).cloneItemStack(); // Paper -+ -+ // Paper start - Cancellable death event -+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.d(damagesource); -+ -+ // Below is code to drop -+ -+ if (deathEvent == null || deathEvent.isCancelled()) { -+ return deathEvent; -+ } -+ // Paper end - - if (!itemstack.isEmpty()) { - this.a(itemstack); - this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); - } - -- super.d(damagesource); -+ return deathEvent; // Paper - } - - public static boolean a(EntityFox entityfox, EntityLiving entityliving) { -diff --git a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -index 09d076db37507b17797635df232a568752c97584..3bcebb89c9f9a5243d1d215a47d7d5e64d2529b2 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java -@@ -50,11 +50,19 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract { - this.a((IMaterial) Blocks.CHEST); - } - -- this.setCarryingChest(false); -+ //this.setCarryingChest(false); // Paper - moved to post death logic - } - - } - -+ // Paper start -+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { -+ if (this.isCarryingChest() && (event == null || !event.isCancelled())) { -+ this.setCarryingChest(false); -+ } -+ } -+ // Paper end -+ - @Override - public void saveData(NBTTagCompound nbttagcompound) { - super.saveData(nbttagcompound); -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93ee632a27 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -96,7 +96,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 9d8f92c313829bb32c17907bf2ef23d069517dc3..c189a7051240bb357acf5075c98206a258409b0c 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -189,7 +189,7 @@ public abstract class EntityLiving extends Entity { protected float aL; protected float aM; protected float aN; @@ -131,7 +110,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 public float lastDamage; protected boolean jumping; public float aR; -@@ -140,6 +140,7 @@ public abstract class EntityLiving extends Entity { +@@ -233,6 +233,7 @@ public abstract class EntityLiving extends Entity { public Set collidableExemptions = new HashSet<>(); public boolean canPickUpLoot; public org.bukkit.craftbukkit.entity.CraftLivingEntity getBukkitLivingEntity() { return (org.bukkit.craftbukkit.entity.CraftLivingEntity) super.getBukkitEntity(); } // Paper @@ -139,7 +118,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 @Override public float getBukkitYaw() { -@@ -1255,13 +1256,17 @@ public abstract class EntityLiving extends Entity { +@@ -1348,13 +1349,17 @@ public abstract class EntityLiving extends Entity { if (knockbackCancelled) this.world.broadcastEntityEffect(this, (byte) 2); // Paper - Disable explosion knockback if (this.dl()) { if (!this.f(damagesource)) { @@ -161,7 +140,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 } } else if (flag1) { this.c(damagesource); -@@ -1400,6 +1405,7 @@ public abstract class EntityLiving extends Entity { +@@ -1493,6 +1498,7 @@ public abstract class EntityLiving extends Entity { Entity entity = damagesource.getEntity(); EntityLiving entityliving = this.getKillingEntity(); @@ -169,7 +148,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 if (this.aO >= 0 && entityliving != null) { entityliving.a(this, this.aO, damagesource); } -@@ -1407,20 +1413,40 @@ public abstract class EntityLiving extends Entity { +@@ -1500,20 +1506,40 @@ public abstract class EntityLiving extends Entity { if (this.isSleeping()) { this.entityWakeup(); } @@ -213,7 +192,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 } } -@@ -1428,7 +1454,7 @@ public abstract class EntityLiving extends Entity { +@@ -1521,7 +1547,7 @@ public abstract class EntityLiving extends Entity { if (!this.world.isClientSide) { boolean flag = false; @@ -222,7 +201,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) { BlockPosition blockposition = this.getChunkCoordinates(); IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData(); -@@ -1456,7 +1482,8 @@ public abstract class EntityLiving extends Entity { +@@ -1549,7 +1575,8 @@ public abstract class EntityLiving extends Entity { } } @@ -232,7 +211,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 Entity entity = damagesource.getEntity(); int i; -@@ -1474,15 +1501,18 @@ public abstract class EntityLiving extends Entity { +@@ -1567,15 +1594,18 @@ public abstract class EntityLiving extends Entity { this.dropDeathLoot(damagesource, i, flag); } // CraftBukkit start - Call death event @@ -252,7 +231,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 // CraftBukkit start public int getExpReward() { -@@ -1567,6 +1597,7 @@ public abstract class EntityLiving extends Entity { +@@ -1660,6 +1690,7 @@ public abstract class EntityLiving extends Entity { return SoundEffects.ENTITY_GENERIC_HURT; } @@ -260,7 +239,7 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 @Nullable protected SoundEffect getSoundDeath() { return SoundEffects.ENTITY_GENERIC_DEATH; -@@ -2103,10 +2134,12 @@ public abstract class EntityLiving extends Entity { +@@ -2196,10 +2227,12 @@ public abstract class EntityLiving extends Entity { } @@ -273,59 +252,80 @@ index f41bfd776a64303104bc38a046a27d076dac5c86..1e65dc73607d5c530efd3ebd61f2bf93 protected float dH() { return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index c0b1643dfb4701f0d790bcfae75ede417d5a3522..03d062f9cdf19df32dcc57a247555e5fa21d38b9 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -86,6 +86,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public int ping; - public boolean viewingCredits; - private int containerUpdateDelay; // Paper -+ // Paper start - cancellable death event -+ public boolean queueHealthUpdatePacket = false; -+ public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -+ // Paper end +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java +index 459b7727e946679989477f4a7e99c5ca47ac0b30..a3b714a9d63c6bb33a2731fb9293c9d155754b17 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityFox.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityFox.java +@@ -647,15 +647,25 @@ public class EntityFox extends EntityAnimal { + } - // CraftBukkit start - public String displayName; -@@ -589,6 +593,15 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - IChatBaseComponent defaultMessage = this.getCombatTracker().getDeathMessage(); - - org.bukkit.event.entity.PlayerDeathEvent event = CraftEventFactory.callPlayerDeathEvent(this, loot, PaperAdventure.asAdventure(defaultMessage), defaultMessage.getString(), keepInventory); // Paper - Adventure -+ // Paper start - cancellable death event -+ if (event.isCancelled()) { -+ // make compatible with plugins that might have already set the health in an event listener -+ if (this.getHealth() <= 0) { -+ this.setHealth((float) event.getReviveHealth()); -+ } -+ return; + @Override +- protected void d(DamageSource damagesource) { +- ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND); ++ protected org.bukkit.event.entity.EntityDeathEvent d(DamageSource damagesource) { // Paper ++ ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND).cloneItemStack(); // Paper ++ ++ // Paper start - Cancellable death event ++ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.d(damagesource); ++ ++ // Below is code to drop ++ ++ if (deathEvent == null || deathEvent.isCancelled()) { ++ return deathEvent; + } + // Paper end - // SPIGOT-943 - only call if they have an inventory open - if (this.activeContainer != this.defaultContainer) { -@@ -735,8 +748,17 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } - } - } -- -- return super.damageEntity(damagesource, f); -+ // Paper start - cancellable death events -+ //return super.damageEntity(damagesource, f); -+ this.queueHealthUpdatePacket = true; -+ boolean damaged = super.damageEntity(damagesource, f); -+ this.queueHealthUpdatePacket = false; -+ if (this.queuedHealthUpdatePacket != null) { -+ this.playerConnection.sendPacket(this.queuedHealthUpdatePacket); -+ this.queuedHealthUpdatePacket = null; -+ } -+ return damaged; -+ // Paper end - } + if (!itemstack.isEmpty()) { + this.a(itemstack); + this.setSlot(EnumItemSlot.MAINHAND, ItemStack.b); } + +- super.d(damagesource); ++ return deathEvent; // Paper } + + public static boolean a(EntityFox entityfox, EntityLiving entityliving) { +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java +index aa12a0c9f30cd2b8a6de75ff9822843da808ae64..3daa1780a332128bd472fa80039112f3ca9bc4e9 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseChestedAbstract.java +@@ -68,11 +68,19 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract { + this.a((IMaterial) Blocks.CHEST); + } + +- this.setCarryingChest(false); ++ //this.setCarryingChest(false); // Paper - moved to post death logic + } + + } + ++ // Paper start ++ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { ++ if (this.isCarryingChest() && (event == null || !event.isCancelled())) { ++ this.setCarryingChest(false); ++ } ++ } ++ // Paper end ++ + @Override + public void saveData(NBTTagCompound nbttagcompound) { + super.saveData(nbttagcompound); +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index b2a661ddcf13f7d7758cc1cac1f4d2c3fa6c4635..b93d04cd23a3a3616d1594c69174ea1271a204fb 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -745,7 +745,8 @@ public class EntityArmorStand extends EntityLiving { + + @Override + public void killEntity() { +- org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event ++ org.bukkit.event.entity.EntityDeathEvent event = org.bukkit.craftbukkit.event.CraftEventFactory.callEntityDeathEvent(this, drops); // CraftBukkit - call event // Paper - make cancellable ++ if (event.isCancelled()) return; // Paper - make cancellable + this.die(); + } + diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 47e6986f1f3b1366cbabb76d16491bc4bba04b36..3d8b118421364f20f8d7e4ac6c547f62816b3c43 100644 +index c763f2bbd10ce6b62d703d3eabb894f24be91b11..5c3b83244e77c54d3de5cf56171a88c2952fcd13 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1836,7 +1836,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -346,7 +346,7 @@ index 47e6986f1f3b1366cbabb76d16491bc4bba04b36..3d8b118421364f20f8d7e4ac6c547f62 public void injectScaledMaxHealth(Collection collection, boolean force) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index c70d96f4800b42893ecf46aa820c201e5d9dd0f4..b0f6ae131082dcccaca13797eb07efc7bb9e738d 100644 +index ecd3b31216616b0ffe239785e3942cfb4bfebcf8..e408f30da80a4f1450d6ac659e25e511190b1c7b 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -784,9 +784,16 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0281-Allow-chests-to-be-placed-with-NBT-data.patch b/Spigot-Server-Patches/0281-Allow-chests-to-be-placed-with-NBT-data.patch index 327a82cc26..e2dd12b2fd 100644 --- a/Spigot-Server-Patches/0281-Allow-chests-to-be-placed-with-NBT-data.patch +++ b/Spigot-Server-Patches/0281-Allow-chests-to-be-placed-with-NBT-data.patch @@ -4,11 +4,11 @@ Date: Sat, 8 Sep 2018 18:43:31 -0500 Subject: [PATCH] Allow chests to be placed with NBT data -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 22568201a292edc8e25396e55cad1572d419b775..7ad595d5d7e090c523aa45a10d0f84b609ea86df 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -244,6 +244,7 @@ public final class ItemStack { +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index de171e18fbc6cc5ee06e75f4a3c60fd4c710d8bb..5da20483ed352ac6d9695287f840ed643a2bf302 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -298,6 +298,7 @@ public final class ItemStack { enuminteractionresult = EnumInteractionResult.FAIL; // cancel placement // PAIL: Remove this when MC-99075 fixed placeEvent.getPlayer().updateInventory(); @@ -16,11 +16,11 @@ index 22568201a292edc8e25396e55cad1572d419b775..7ad595d5d7e090c523aa45a10d0f84b6 // revert back all captured blocks for (BlockState blockstate : blocks) { blockstate.update(true, false); -diff --git a/src/main/java/net/minecraft/server/TileEntityChest.java b/src/main/java/net/minecraft/server/TileEntityChest.java -index 54cad33750efd80b104664723e1115d107c7a72d..28df29649a3e78708564b5ab9dc4d340835db9a3 100644 ---- a/src/main/java/net/minecraft/server/TileEntityChest.java -+++ b/src/main/java/net/minecraft/server/TileEntityChest.java -@@ -301,7 +301,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java +index aafd1f7c6c811f9eb2796d865e327f374be9b461..d4f019e98fbadfadee981ae8e7a5f121ba8fe1e8 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityChest.java +@@ -326,7 +326,7 @@ public class TileEntityChest extends TileEntityLootable { // Paper - Remove ITic // CraftBukkit start @Override public boolean isFilteredNBT() { diff --git a/Spigot-Server-Patches/0282-Mob-Pathfinding-API.patch b/Spigot-Server-Patches/0282-Mob-Pathfinding-API.patch index e20e0c19b2..ebfe5b3cf1 100644 --- a/Spigot-Server-Patches/0282-Mob-Pathfinding-API.patch +++ b/Spigot-Server-Patches/0282-Mob-Pathfinding-API.patch @@ -152,11 +152,11 @@ index 0000000000000000000000000000000000000000..af1bac9680028130e99c5e7130f258c1 + return new Location(entity.world.getWorld(), point.getX(), point.getY(), point.getZ()); + } +} -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index ee7b1f25ba8b6b4318e332b739359db6ddd58b62..64b991859f0f3ca7d932b8acc8aeed401e22a388 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -79,7 +79,7 @@ public abstract class NavigationAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +index 1664d47a61f1c502ece7f32aecdce759172c9f85..ab469f1698b4f0e36c0d077472f1adea36f95ce9 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +@@ -99,7 +99,7 @@ public abstract class NavigationAbstract { } @Nullable @@ -165,7 +165,7 @@ index ee7b1f25ba8b6b4318e332b739359db6ddd58b62..64b991859f0f3ca7d932b8acc8aeed40 return this.a(new BlockPosition(d0, d1, d2), i); } -@@ -104,7 +104,7 @@ public abstract class NavigationAbstract { +@@ -124,7 +124,7 @@ public abstract class NavigationAbstract { } @Nullable @@ -174,7 +174,7 @@ index ee7b1f25ba8b6b4318e332b739359db6ddd58b62..64b991859f0f3ca7d932b8acc8aeed40 return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper } -@@ -169,6 +169,7 @@ public abstract class NavigationAbstract { +@@ -189,6 +189,7 @@ public abstract class NavigationAbstract { return pathentity != null && this.a(pathentity, d0); } @@ -182,7 +182,7 @@ index ee7b1f25ba8b6b4318e332b739359db6ddd58b62..64b991859f0f3ca7d932b8acc8aeed40 public boolean a(@Nullable PathEntity pathentity, double d0) { if (pathentity == null) { this.c = null; -@@ -196,7 +197,7 @@ public abstract class NavigationAbstract { +@@ -216,7 +217,7 @@ public abstract class NavigationAbstract { } } @@ -191,7 +191,7 @@ index ee7b1f25ba8b6b4318e332b739359db6ddd58b62..64b991859f0f3ca7d932b8acc8aeed40 public PathEntity k() { return this.c; } -@@ -320,6 +321,7 @@ public abstract class NavigationAbstract { +@@ -340,6 +341,7 @@ public abstract class NavigationAbstract { return !this.m(); } @@ -199,11 +199,11 @@ index ee7b1f25ba8b6b4318e332b739359db6ddd58b62..64b991859f0f3ca7d932b8acc8aeed40 public void o() { this.c = null; } -diff --git a/src/main/java/net/minecraft/server/PathEntity.java b/src/main/java/net/minecraft/server/PathEntity.java -index bf9f9166f265e9f79c6c964a31a08c85cef95746..c81a5d50c480b064ab60ed6f25f9e2c0bedb6ece 100644 ---- a/src/main/java/net/minecraft/server/PathEntity.java -+++ b/src/main/java/net/minecraft/server/PathEntity.java -@@ -5,13 +5,14 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java b/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java +index 606027de777750f6d2ab0d7f1ef387ed4f0c6092..81c3cb9da3f901d2bcf384f7113bdc5c60f9962f 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathEntity.java +@@ -8,13 +8,14 @@ import net.minecraft.world.phys.Vec3D; public class PathEntity { @@ -220,7 +220,7 @@ index bf9f9166f265e9f79c6c964a31a08c85cef95746..c81a5d50c480b064ab60ed6f25f9e2c0 public PathEntity(List list, BlockPosition blockposition, boolean flag) { this.a = list; -@@ -33,7 +34,7 @@ public class PathEntity { +@@ -36,7 +37,7 @@ public class PathEntity { } @Nullable @@ -229,7 +229,7 @@ index bf9f9166f265e9f79c6c964a31a08c85cef95746..c81a5d50c480b064ab60ed6f25f9e2c0 return !this.a.isEmpty() ? (PathPoint) this.a.get(this.a.size() - 1) : null; } -@@ -81,7 +82,7 @@ public class PathEntity { +@@ -84,7 +85,7 @@ public class PathEntity { return this.a(entity, this.e); } @@ -238,11 +238,11 @@ index bf9f9166f265e9f79c6c964a31a08c85cef95746..c81a5d50c480b064ab60ed6f25f9e2c0 return ((PathPoint) this.a.get(this.e)).a(); } -diff --git a/src/main/java/net/minecraft/server/PathPoint.java b/src/main/java/net/minecraft/server/PathPoint.java -index b69d6bc433711e94e3fbfa2a89c091209c95484d..e9fb295bdf727cd4543cbe5a18447ceba3d41ee0 100644 ---- a/src/main/java/net/minecraft/server/PathPoint.java -+++ b/src/main/java/net/minecraft/server/PathPoint.java -@@ -2,9 +2,9 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java b/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java +index 43cc9430972a18cbf03a590d576ed200e3836017..c260b0ca70cb18811158761c574aee9c3166da28 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathPoint.java +@@ -5,9 +5,9 @@ import net.minecraft.util.MathHelper; public class PathPoint { @@ -255,11 +255,11 @@ index b69d6bc433711e94e3fbfa2a89c091209c95484d..e9fb295bdf727cd4543cbe5a18447ceb private final int m; public int d = -1; public float e; -diff --git a/src/main/java/net/minecraft/server/PathfinderAbstract.java b/src/main/java/net/minecraft/server/PathfinderAbstract.java -index fca9ed99d6c11badb85e0c06cd6872dca85d6f8d..5cfcac3bc29e3f3d139b10209f5082cba292a434 100644 ---- a/src/main/java/net/minecraft/server/PathfinderAbstract.java -+++ b/src/main/java/net/minecraft/server/PathfinderAbstract.java -@@ -11,9 +11,9 @@ public abstract class PathfinderAbstract { +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java +index f2080bd50db04af6eabec4b4b757d6dadfb1a2f5..88be03bd77656235322522c3782b9f9a878b86b1 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderAbstract.java +@@ -16,9 +16,9 @@ public abstract class PathfinderAbstract { protected int d; protected int e; protected int f; @@ -273,7 +273,7 @@ index fca9ed99d6c11badb85e0c06cd6872dca85d6f8d..5cfcac3bc29e3f3d139b10209f5082cb public PathfinderAbstract() {} diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index 90e63fbf292488732434ed9cf20645d8306eb21d..c89bc7024b650c3b6d2c551f0e4e156975570cca 100644 +index eb275ac45def34d5bb1ed696b4f6a4d53d282ab3..28a4e90130f51fd2fda7003fde5b4d0a410e1aef 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java @@ -12,8 +12,11 @@ import org.bukkit.loot.LootTable; diff --git a/Spigot-Server-Patches/0283-Prevent-chunk-loading-from-Fluid-Flowing.patch b/Spigot-Server-Patches/0283-Prevent-chunk-loading-from-Fluid-Flowing.patch index 6ff73a0450..3b7bb307af 100644 --- a/Spigot-Server-Patches/0283-Prevent-chunk-loading-from-Fluid-Flowing.patch +++ b/Spigot-Server-Patches/0283-Prevent-chunk-loading-from-Fluid-Flowing.patch @@ -4,11 +4,11 @@ Date: Mon, 10 Sep 2018 23:36:16 -0400 Subject: [PATCH] Prevent chunk loading from Fluid Flowing -diff --git a/src/main/java/net/minecraft/server/FluidTypeFlowing.java b/src/main/java/net/minecraft/server/FluidTypeFlowing.java -index 9f99503a7631497fd20edb935cd3bb8b5b3cbdf7..cf9d3faabe8732d27c436f4806c727592e475f81 100644 ---- a/src/main/java/net/minecraft/server/FluidTypeFlowing.java -+++ b/src/main/java/net/minecraft/server/FluidTypeFlowing.java -@@ -155,7 +155,8 @@ public abstract class FluidTypeFlowing extends FluidType { +diff --git a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java +index 2f0f8a44d808875d70123a63487ce1ebe02f53a9..6bb4ec00e40795ced73648fefcd1f5027e0113cd 100644 +--- a/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java ++++ b/src/main/java/net/minecraft/world/level/material/FluidTypeFlowing.java +@@ -176,7 +176,8 @@ public abstract class FluidTypeFlowing extends FluidType { EnumDirection enumdirection = (EnumDirection) entry.getKey(); Fluid fluid1 = (Fluid) entry.getValue(); BlockPosition blockposition1 = blockposition.shift(enumdirection); @@ -18,7 +18,7 @@ index 9f99503a7631497fd20edb935cd3bb8b5b3cbdf7..cf9d3faabe8732d27c436f4806c72759 if (this.a(generatoraccess, blockposition, iblockdata, enumdirection, blockposition1, iblockdata1, generatoraccess.getFluid(blockposition1), fluid1.getType())) { // CraftBukkit start -@@ -182,7 +183,8 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -203,7 +204,8 @@ public abstract class FluidTypeFlowing extends FluidType { while (iterator.hasNext()) { EnumDirection enumdirection = (EnumDirection) iterator.next(); BlockPosition blockposition1 = blockposition.shift(enumdirection); @@ -28,7 +28,7 @@ index 9f99503a7631497fd20edb935cd3bb8b5b3cbdf7..cf9d3faabe8732d27c436f4806c72759 Fluid fluid = iblockdata1.getFluid(); if (fluid.getType().a((FluidType) this) && this.a(enumdirection, (IBlockAccess) iworldreader, blockposition, iblockdata, blockposition1, iblockdata1)) { -@@ -299,11 +301,18 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -320,11 +322,18 @@ public abstract class FluidTypeFlowing extends FluidType { if (enumdirection1 != enumdirection) { BlockPosition blockposition2 = blockposition.shift(enumdirection1); short short0 = a(blockposition1, blockposition2); @@ -51,7 +51,7 @@ index 9f99503a7631497fd20edb935cd3bb8b5b3cbdf7..cf9d3faabe8732d27c436f4806c72759 IBlockData iblockdata1 = (IBlockData) pair.getFirst(); Fluid fluid = (Fluid) pair.getSecond(); -@@ -375,11 +384,16 @@ public abstract class FluidTypeFlowing extends FluidType { +@@ -396,11 +405,16 @@ public abstract class FluidTypeFlowing extends FluidType { EnumDirection enumdirection = (EnumDirection) iterator.next(); BlockPosition blockposition1 = blockposition.shift(enumdirection); short short0 = a(blockposition, blockposition1); diff --git a/Spigot-Server-Patches/0284-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch b/Spigot-Server-Patches/0284-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch index 9a6e6ce5c0..176f6da8eb 100644 --- a/Spigot-Server-Patches/0284-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch +++ b/Spigot-Server-Patches/0284-Implement-an-API-for-CanPlaceOn-and-CanDestroy-NBT-v.patch @@ -4,11 +4,11 @@ Date: Wed, 12 Sep 2018 18:53:55 +0300 Subject: [PATCH] Implement an API for CanPlaceOn and CanDestroy NBT values -diff --git a/src/main/java/net/minecraft/server/ArgumentBlock.java b/src/main/java/net/minecraft/server/ArgumentBlock.java -index dc7a320c83802159aab2440b4fca26543be2524a..892f99c8b9385e80381058ead72d4346b8a61fee 100644 ---- a/src/main/java/net/minecraft/server/ArgumentBlock.java -+++ b/src/main/java/net/minecraft/server/ArgumentBlock.java -@@ -45,7 +45,7 @@ public class ArgumentBlock { +diff --git a/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java b/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java +index 7e53d8b787c42f8592140f7de8974bc63e5149b2..d72b800e5f03422d0b2518980b1955ec7d2b08e8 100644 +--- a/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java ++++ b/src/main/java/net/minecraft/commands/arguments/blocks/ArgumentBlock.java +@@ -57,7 +57,7 @@ public class ArgumentBlock { private final boolean j; private final Map, Comparable> k = Maps.newLinkedHashMap(); // CraftBukkit - stable private final Map l = Maps.newHashMap(); @@ -17,7 +17,7 @@ index dc7a320c83802159aab2440b4fca26543be2524a..892f99c8b9385e80381058ead72d4346 private BlockStateList n; private IBlockData o; @Nullable -@@ -74,11 +74,13 @@ public class ArgumentBlock { +@@ -86,11 +86,13 @@ public class ArgumentBlock { return this.p; } @@ -32,7 +32,7 @@ index dc7a320c83802159aab2440b4fca26543be2524a..892f99c8b9385e80381058ead72d4346 this.s = this::l; if (this.i.canRead() && this.i.peek() == '#') { diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java -index 6408cfdd52754167deed3a31d0913eb2e7bc4500..d14e640167e1d00b91ea63038cb434b9c83ce887 100644 +index 7f790c484fec77e1d1f1dc6abe0daa19d009ae46..2b0c4c278c2d189e4040440763138068f5e3aca1 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaItem.java @@ -84,6 +84,12 @@ import org.bukkit.persistence.PersistentDataContainer; diff --git a/Spigot-Server-Patches/0285-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch b/Spigot-Server-Patches/0285-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch index 845ccbe42e..2c55a34158 100644 --- a/Spigot-Server-Patches/0285-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch +++ b/Spigot-Server-Patches/0285-Prevent-Mob-AI-Rules-from-Loading-Chunks.patch @@ -4,11 +4,11 @@ Date: Mon, 10 Sep 2018 23:56:36 -0400 Subject: [PATCH] Prevent Mob AI Rules from Loading Chunks -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java -index 127428c400f6de1cb65458346aac6a176b6c1896..6ea402c603b9b54705e79a2fdc61fe5a254479a3 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalRemoveBlock.java -@@ -13,11 +13,13 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java +index b5c7b39a49afae1089a293b9b06bdd94deed1f64..61a62c093b24c43064f116630d85096159e082d3 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalRemoveBlock.java +@@ -30,11 +30,13 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { private final Block g; private final EntityInsentient entity; private int i; @@ -22,7 +22,7 @@ index 127428c400f6de1cb65458346aac6a176b6c1896..6ea402c603b9b54705e79a2fdc61fe5a } @Override -@@ -115,7 +117,9 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { +@@ -132,7 +134,9 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { @Nullable private BlockPosition a(BlockPosition blockposition, IBlockAccess iblockaccess) { @@ -33,7 +33,7 @@ index 127428c400f6de1cb65458346aac6a176b6c1896..6ea402c603b9b54705e79a2fdc61fe5a return blockposition; } else { BlockPosition[] ablockposition = new BlockPosition[]{blockposition.down(), blockposition.west(), blockposition.east(), blockposition.north(), blockposition.south(), blockposition.down().down()}; -@@ -125,7 +129,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { +@@ -142,7 +146,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { for (int j = 0; j < i; ++j) { BlockPosition blockposition1 = ablockposition1[j]; @@ -42,7 +42,7 @@ index 127428c400f6de1cb65458346aac6a176b6c1896..6ea402c603b9b54705e79a2fdc61fe5a return blockposition1; } } -@@ -136,7 +140,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { +@@ -153,7 +157,7 @@ public class PathfinderGoalRemoveBlock extends PathfinderGoalGotoTarget { @Override protected boolean a(IWorldReader iworldreader, BlockPosition blockposition) { @@ -51,11 +51,11 @@ index 127428c400f6de1cb65458346aac6a176b6c1896..6ea402c603b9b54705e79a2fdc61fe5a return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a(this.g) && ichunkaccess.getType(blockposition.up()).isAir() && ichunkaccess.getType(blockposition.up(2)).isAir(); } -diff --git a/src/main/java/net/minecraft/server/RandomPositionGenerator.java b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -index 8dc028a4b1f5cf7bac0e3f1319bca5b5eb0e2482..aaa89a39bf697bd0f3354005b428d858f065f66b 100644 ---- a/src/main/java/net/minecraft/server/RandomPositionGenerator.java -+++ b/src/main/java/net/minecraft/server/RandomPositionGenerator.java -@@ -116,6 +116,7 @@ public class RandomPositionGenerator { +diff --git a/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java b/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java +index 129ea3857969ddb99e15ae817ee3eec67b4c3ccf..c389414e2bbef96ec2e5e887fd105028b72e586d 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java ++++ b/src/main/java/net/minecraft/world/entity/ai/util/RandomPositionGenerator.java +@@ -128,6 +128,7 @@ public class RandomPositionGenerator { } blockposition2 = new BlockPosition((double) k1 + entitycreature.locX(), (double) l1 + entitycreature.locY(), (double) i2 + entitycreature.locZ()); @@ -63,7 +63,7 @@ index 8dc028a4b1f5cf7bac0e3f1319bca5b5eb0e2482..aaa89a39bf697bd0f3354005b428d858 if (blockposition2.getY() >= 0 && blockposition2.getY() <= entitycreature.world.getBuildHeight() && (!flag3 || entitycreature.a(blockposition2)) && (!flag2 || navigationabstract.a(blockposition2))) { if (flag1) { blockposition2 = a(blockposition2, random.nextInt(l + 1) + i1, entitycreature.world.getBuildHeight(), (blockposition3) -> { -@@ -123,7 +124,8 @@ public class RandomPositionGenerator { +@@ -135,7 +136,8 @@ public class RandomPositionGenerator { }); } diff --git a/Spigot-Server-Patches/0286-Prevent-mob-spawning-from-loading-generating-chunks.patch b/Spigot-Server-Patches/0286-Prevent-mob-spawning-from-loading-generating-chunks.patch index b3883a3d56..a15c894497 100644 --- a/Spigot-Server-Patches/0286-Prevent-mob-spawning-from-loading-generating-chunks.patch +++ b/Spigot-Server-Patches/0286-Prevent-mob-spawning-from-loading-generating-chunks.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Prevent mob spawning from loading/generating chunks also prevents if out of world border bounds -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 0ecdfd45073235b7b01e84f4490f17088c4ee675..60f0301747ff2363007791432471c20471d79f01 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -143,9 +143,9 @@ public final class SpawnerCreature { +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +index 9a039ce12879baf8088c2ccaf0af61109efb7d74..28b3a74d139820f91775d3377d79675d308aff65 100644 +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +@@ -175,9 +175,9 @@ public final class SpawnerCreature { StructureManager structuremanager = worldserver.getStructureManager(); ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); int i = blockposition.getY(); @@ -21,7 +21,7 @@ index 0ecdfd45073235b7b01e84f4490f17088c4ee675..60f0301747ff2363007791432471c204 BlockPosition.MutableBlockPosition blockposition_mutableblockposition = new BlockPosition.MutableBlockPosition(); int j = 0; int k = 0; -@@ -174,7 +174,7 @@ public final class SpawnerCreature { +@@ -206,7 +206,7 @@ public final class SpawnerCreature { if (entityhuman != null) { double d2 = entityhuman.h(d0, (double) i, d1); diff --git a/Spigot-Server-Patches/0287-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch b/Spigot-Server-Patches/0287-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch index 27a0183193..681fbbbb31 100644 --- a/Spigot-Server-Patches/0287-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch +++ b/Spigot-Server-Patches/0287-Optimize-Biome-Mob-Lookups-for-Mob-Spawning.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize Biome Mob Lookups for Mob Spawning Uses an EnumMap as well as a Set paired List for O(1) contains calls. -diff --git a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java -index 558344a2fa7f755152d4674c698d7f47ba1beaa2..a18ca3f0001a771f21012bd39711f581efb2fef0 100644 ---- a/src/main/java/net/minecraft/server/BiomeSettingsMobs.java -+++ b/src/main/java/net/minecraft/server/BiomeSettingsMobs.java -@@ -24,18 +24,27 @@ public class BiomeSettingsMobs { +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java b/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java +index 5adaf5fdaaec25220878213df2c0839ccf025d63..233ae33b5cbf1aafc7d2632149ccb84c0b243162 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeSettingsMobs.java +@@ -30,18 +30,27 @@ public class BiomeSettingsMobs { }, (enumcreaturetype) -> { return ImmutableList.of(); })), ImmutableMap.of(), false); @@ -44,7 +44,7 @@ index 558344a2fa7f755152d4674c698d7f47ba1beaa2..a18ca3f0001a771f21012bd39711f581 return biomesettingsmobs.f; }), Codec.BOOL.fieldOf("player_spawn_friendly").orElse(false).forGetter(BiomeSettingsMobs::b)).apply(instance, BiomeSettingsMobs::new); }); -@@ -70,11 +79,43 @@ public class BiomeSettingsMobs { +@@ -76,11 +85,43 @@ public class BiomeSettingsMobs { public static class a { diff --git a/Spigot-Server-Patches/0288-Implement-furnace-cook-speed-multiplier-API.patch b/Spigot-Server-Patches/0288-Implement-furnace-cook-speed-multiplier-API.patch index e94a798a36..110e0093a4 100644 --- a/Spigot-Server-Patches/0288-Implement-furnace-cook-speed-multiplier-API.patch +++ b/Spigot-Server-Patches/0288-Implement-furnace-cook-speed-multiplier-API.patch @@ -10,19 +10,19 @@ to the nearest Integer when updating its current cook time. Modified by: Eric Su -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index af4db22cf87433fcd4f59be207257a8d7c255883..abc76807595611d35c86f500ef1ef51159e9406b 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -11,6 +11,7 @@ import java.util.Map; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +index deaa4c136c23dc6c258cc1ce68523b3c007c80f9..e630e8d3e115d2a0177849ad8258a2304b9d3e9d 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +@@ -40,6 +40,7 @@ import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.phys.Vec3D; // CraftBukkit start +import java.util.List; import org.bukkit.craftbukkit.block.CraftBlock; import org.bukkit.craftbukkit.entity.CraftHumanEntity; import org.bukkit.craftbukkit.inventory.CraftItemStack; -@@ -29,6 +30,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -58,6 +59,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I protected NonNullList items; public int burnTime; private int ticksForCurrentFuel; @@ -30,7 +30,7 @@ index af4db22cf87433fcd4f59be207257a8d7c255883..abc76807595611d35c86f500ef1ef511 public int cookTime; public int cookTimeTotal; protected final IContainerProperties b; -@@ -229,6 +231,11 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -258,6 +260,11 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I this.n.put(new MinecraftKey(s), nbttagcompound1.getInt(s)); } @@ -42,7 +42,7 @@ index af4db22cf87433fcd4f59be207257a8d7c255883..abc76807595611d35c86f500ef1ef511 } @Override -@@ -237,6 +244,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -266,6 +273,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I nbttagcompound.setShort("BurnTime", (short) this.burnTime); nbttagcompound.setShort("CookTime", (short) this.cookTime); nbttagcompound.setShort("CookTimeTotal", (short) this.cookTimeTotal); @@ -50,7 +50,7 @@ index af4db22cf87433fcd4f59be207257a8d7c255883..abc76807595611d35c86f500ef1ef511 ContainerUtil.a(nbttagcompound, this.items); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -@@ -297,7 +305,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -326,7 +334,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I if (this.isBurning() && this.canBurn(irecipe)) { ++this.cookTime; @@ -59,7 +59,7 @@ index af4db22cf87433fcd4f59be207257a8d7c255883..abc76807595611d35c86f500ef1ef511 this.cookTime = 0; this.cookTimeTotal = this.getRecipeCookingTime(); this.burn(irecipe); -@@ -397,9 +405,13 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -426,9 +434,13 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I } } @@ -76,7 +76,7 @@ index af4db22cf87433fcd4f59be207257a8d7c255883..abc76807595611d35c86f500ef1ef511 public static boolean isFuel(ItemStack itemstack) { return f().containsKey(itemstack.getItem()); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java -index 27c8cc130e7466c396b514dd77f1385f967bebdb..298e75d72b889396a15907e713c29430c168b915 100644 +index 760fe719f2f8836c41f6a49d8a795703b2474390..86ad5f78eecc01863897838cb1f311f5dd3d996d 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftFurnace.java @@ -63,4 +63,20 @@ public abstract class CraftFurnace extends CraftCon diff --git a/Spigot-Server-Patches/0289-PreSpawnerSpawnEvent.patch b/Spigot-Server-Patches/0289-PreSpawnerSpawnEvent.patch index 8bb560a403..1855ebe484 100644 --- a/Spigot-Server-Patches/0289-PreSpawnerSpawnEvent.patch +++ b/Spigot-Server-Patches/0289-PreSpawnerSpawnEvent.patch @@ -8,11 +8,11 @@ which contains the location of the spawner too similarly to how the SpawnerSpawnEvent gets called instead of the CreatureSpawnEvent for spawners. -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 2827026ba4bdd857f231028393726d6c95610072..1aecc84479b00a019a5b68f5e726d1c2965ae0f7 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -114,11 +114,11 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index 79339bcbe15e5b3a409148245c68bbff3a59f59f..0a23fc173cca32b9e910e6c8c638b0b51a94cac2 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -131,11 +131,11 @@ public abstract class MobSpawnerAbstract { org.bukkit.entity.EntityType type = org.bukkit.entity.EntityType.fromName(key); if (type != null) { diff --git a/Spigot-Server-Patches/0290-Catch-JsonParseException-in-Entity-and-TE-names.patch b/Spigot-Server-Patches/0290-Catch-JsonParseException-in-Entity-and-TE-names.patch index 505a6836e8..3a7b00d322 100644 --- a/Spigot-Server-Patches/0290-Catch-JsonParseException-in-Entity-and-TE-names.patch +++ b/Spigot-Server-Patches/0290-Catch-JsonParseException-in-Entity-and-TE-names.patch @@ -12,24 +12,11 @@ Shulkers) may need to be changed in order for it to re-save properly No more crashing though. -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index e16f975e1babd2f08262cbbb42d7f47740525e97..e78809278b9159728722b2b33ad5dfae77e860ed 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -59,7 +59,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - this.command = nbttagcompound.getString("Command"); - this.successCount = nbttagcompound.getInt("SuccessCount"); - if (nbttagcompound.hasKeyOfType("CustomName", 8)) { -- this.setName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"))); -+ this.setName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException - } - - if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) { diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 39174bca00b4535e92f6b325b3fd058ceae41f8b..816d55b17ea531bc2f25b92c003b127fe6e04112 100644 +index cd7dc7d90efddb8a1bb50cd964b43d18cf9c83d1..67806eaab081e938cd99a0d74225b1b7744ff2d7 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -507,4 +507,19 @@ public final class MCUtil { +@@ -514,4 +514,19 @@ public final class MCUtil { return null; } } @@ -49,11 +36,24 @@ index 39174bca00b4535e92f6b325b3fd058ceae41f8b..816d55b17ea531bc2f25b92c003b127f + return null; + } } -diff --git a/src/main/java/net/minecraft/server/TileEntityBanner.java b/src/main/java/net/minecraft/server/TileEntityBanner.java -index 4f886c4145325d8fd8217ae3f681632f0396689f..5397d8a69a0326cf73fe0ee1175d1871cac3769d 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBanner.java -+++ b/src/main/java/net/minecraft/server/TileEntityBanner.java -@@ -60,7 +60,7 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity { +diff --git a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java +index 94adf4d3b3a367e2a7fa383f1da6fb3b02b35c85..0f966c5defdda58fd7d31072b625f16928cddeb7 100644 +--- a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java +@@ -72,7 +72,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { + this.command = nbttagcompound.getString("Command"); + this.successCount = nbttagcompound.getInt("SuccessCount"); + if (nbttagcompound.hasKeyOfType("CustomName", 8)) { +- this.setName(IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName"))); ++ this.setName(MCUtil.getBaseComponentFromNbt("CustomName", nbttagcompound)); // Paper - Catch ParseException + } + + if (nbttagcompound.hasKeyOfType("TrackOutput", 1)) { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java +index fd8d39d04f39ea8aa389deb66ca0ddaa3e282c40..e2d3ade6565b10ebed3c001f4a1c5bbb3a7f0b12 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBanner.java +@@ -70,7 +70,7 @@ public class TileEntityBanner extends TileEntity implements INamableTileEntity { public void load(IBlockData iblockdata, NBTTagCompound nbttagcompound) { super.load(iblockdata, nbttagcompound); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { @@ -62,11 +62,11 @@ index 4f886c4145325d8fd8217ae3f681632f0396689f..5397d8a69a0326cf73fe0ee1175d1871 } if (this.hasWorld()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityContainer.java b/src/main/java/net/minecraft/server/TileEntityContainer.java -index 8f94b9c52c3842b9c32280499aee1b551dc16095..74390aebd353c969353a6efc0904bafe30774d65 100644 ---- a/src/main/java/net/minecraft/server/TileEntityContainer.java -+++ b/src/main/java/net/minecraft/server/TileEntityContainer.java -@@ -17,7 +17,7 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java +index 19739ad1fb01c767288da2667a48909e4c1c36cc..5841422beb972f28fb9e9d10bcf711b2c20a4bb0 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityContainer.java +@@ -30,7 +30,7 @@ public abstract class TileEntityContainer extends TileEntity implements IInvento super.load(iblockdata, nbttagcompound); this.chestLock = ChestLock.b(nbttagcompound); if (nbttagcompound.hasKeyOfType("CustomName", 8)) { diff --git a/Spigot-Server-Patches/0291-Honor-EntityAgeable.ageLock.patch b/Spigot-Server-Patches/0291-Honor-EntityAgeable.ageLock.patch index 415fcfeec3..e69ce43f71 100644 --- a/Spigot-Server-Patches/0291-Honor-EntityAgeable.ageLock.patch +++ b/Spigot-Server-Patches/0291-Honor-EntityAgeable.ageLock.patch @@ -4,11 +4,11 @@ Date: Sun, 23 Sep 2018 20:59:53 -0500 Subject: [PATCH] Honor EntityAgeable.ageLock -diff --git a/src/main/java/net/minecraft/server/EntityAgeable.java b/src/main/java/net/minecraft/server/EntityAgeable.java -index e56aabd8a59c29406ac0f8dfc2207526f6fa99aa..de48dc7cd1996f1a62ef1d0047b1182d7889bd38 100644 ---- a/src/main/java/net/minecraft/server/EntityAgeable.java -+++ b/src/main/java/net/minecraft/server/EntityAgeable.java -@@ -73,6 +73,7 @@ public abstract class EntityAgeable extends EntityCreature { +diff --git a/src/main/java/net/minecraft/world/entity/EntityAgeable.java b/src/main/java/net/minecraft/world/entity/EntityAgeable.java +index ea356ff0f91083195899cc2bb84b2fde504163b4..850135582c41893823c43a78a016c7791755b8b5 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityAgeable.java ++++ b/src/main/java/net/minecraft/world/entity/EntityAgeable.java +@@ -82,6 +82,7 @@ public abstract class EntityAgeable extends EntityCreature { } public void setAge(int i, boolean flag) { diff --git a/Spigot-Server-Patches/0292-Configurable-connection-throttle-kick-message.patch b/Spigot-Server-Patches/0292-Configurable-connection-throttle-kick-message.patch index 67237db036..cd58fc6eac 100644 --- a/Spigot-Server-Patches/0292-Configurable-connection-throttle-kick-message.patch +++ b/Spigot-Server-Patches/0292-Configurable-connection-throttle-kick-message.patch @@ -20,11 +20,11 @@ index 62621562137cba4804f0465c58d25ca2786328e5..7178b37f7978c7e9031a22726005c509 private static void savePlayerData() { Object val = config.get("settings.save-player-data"); if (val instanceof Boolean) { -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index 6d9080abb63a6d13d1184ff6949ba86a470ea390..471826ee4b32fe73d3c39755005e3287f9673c3c 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -35,7 +35,7 @@ public class HandshakeListener implements PacketHandshakingInListener { +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java +index 965dd2a4a446ca31597b9e91bd405e4f01ad8348..6d001843d8f899e91f19c384ddf57e6987bfb79e 100644 +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java +@@ -46,7 +46,7 @@ public class HandshakeListener implements PacketHandshakingInListener { synchronized (throttleTracker) { if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { throttleTracker.put(address, currentTime); diff --git a/Spigot-Server-Patches/0294-Allow-setting-the-vex-s-summoner.patch b/Spigot-Server-Patches/0294-Allow-setting-the-vex-s-summoner.patch index 577d83d8b9..d97a31a735 100644 --- a/Spigot-Server-Patches/0294-Allow-setting-the-vex-s-summoner.patch +++ b/Spigot-Server-Patches/0294-Allow-setting-the-vex-s-summoner.patch @@ -4,11 +4,11 @@ Date: Sat, 6 Oct 2018 21:47:44 -0500 Subject: [PATCH] Allow setting the vex's summoner -diff --git a/src/main/java/net/minecraft/server/EntityVex.java b/src/main/java/net/minecraft/server/EntityVex.java -index 00568a19d7a25189d599fc84afb6ca6d642e2855..9a33866e7529e1636c228bab01205737bc678b47 100644 ---- a/src/main/java/net/minecraft/server/EntityVex.java -+++ b/src/main/java/net/minecraft/server/EntityVex.java -@@ -129,6 +129,7 @@ public class EntityVex extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java +index 3b74ade60b3b0ae0e908866cb4ac11acd75620ff..9645d052069957311478a1ceca42ad52f7a9aa0b 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVex.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVex.java +@@ -165,6 +165,7 @@ public class EntityVex extends EntityMonster { this.a(1, flag); } @@ -17,15 +17,15 @@ index 00568a19d7a25189d599fc84afb6ca6d642e2855..9a33866e7529e1636c228bab01205737 this.c = entityinsentient; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java -index 169c951ec30fc5b78eb4ba29352ba009b7fa5efd..2f7df3074f8fd66fe2ea1cced08db910078e1848 100644 +index 962d6017f6acc47ebe4b754ccd9b97a1fc97cc58..30e2c169388b09b94d801be7543e75ea0bd56fcd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVex.java -@@ -23,6 +23,10 @@ public class CraftVex extends CraftMonster implements Vex { - EntityInsentient owner = getHandle().getOwner(); - return owner != null ? (Mob) owner.getBukkitEntity() : null; +@@ -21,6 +21,10 @@ public class CraftVex extends CraftMonster implements Vex { + net.minecraft.world.entity.EntityInsentient owner = getHandle().getOwner(); + return owner != null ? (org.bukkit.entity.Mob) owner.getBukkitEntity() : null; } + -+ public void setSummoner(Mob summoner) { ++ public void setSummoner(org.bukkit.entity.Mob summoner) { + getHandle().setOwner(summoner == null ? null : ((CraftMob) summoner).getHandle()); + } // Paper end diff --git a/Spigot-Server-Patches/0295-Add-sun-related-API.patch b/Spigot-Server-Patches/0295-Add-sun-related-API.patch index 76f335caaa..15d066ee58 100644 --- a/Spigot-Server-Patches/0295-Add-sun-related-API.patch +++ b/Spigot-Server-Patches/0295-Add-sun-related-API.patch @@ -4,11 +4,11 @@ Date: Sun, 7 Oct 2018 00:54:21 -0500 Subject: [PATCH] Add sun related API -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index fbecc8ccab47b428c43530ad344e325538cf242d..800a8dd2543f0b83eec67e780510427467649d5d 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -1529,6 +1529,7 @@ public abstract class EntityInsentient extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 486f4727dbcb7955103f854baed9b571fb3b9f3e..a0857de5a14db5580bc047c401a006c9466c49b2 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -1594,6 +1594,7 @@ public abstract class EntityInsentient extends EntityLiving { } @@ -17,7 +17,7 @@ index fbecc8ccab47b428c43530ad344e325538cf242d..800a8dd2543f0b83eec67e7805104274 if (this.world.isDay() && !this.world.isClientSide) { float f = this.aR(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index bf7b572e455dfc9dfdacce9d2b93266ec5eac0b4..523f094b5d4572a04da36d68502fa0a22f239e61 100644 +index 806b7559a5230010ebd8cca7808417ee035533f1..317d08c49b980f8785d0d098c993e2ac03200e14 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -872,6 +872,13 @@ public class CraftWorld implements World { @@ -35,7 +35,7 @@ index bf7b572e455dfc9dfdacce9d2b93266ec5eac0b4..523f094b5d4572a04da36d68502fa0a2 public long getGameTime() { return world.worldData.getTime(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java -index c89bc7024b650c3b6d2c551f0e4e156975570cca..eaad222fd38a4db4074db04c931bcff7a9ca5e24 100644 +index 28a4e90130f51fd2fda7003fde5b4d0a410e1aef..06cbe63ef04e0de824ac0b9d545b6da1f53701b3 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMob.java @@ -78,4 +78,11 @@ public abstract class CraftMob extends CraftLivingEntity implements Mob { diff --git a/Spigot-Server-Patches/0296-Turtle-API.patch b/Spigot-Server-Patches/0296-Turtle-API.patch index e614210f58..1c6586b485 100644 --- a/Spigot-Server-Patches/0296-Turtle-API.patch +++ b/Spigot-Server-Patches/0296-Turtle-API.patch @@ -4,11 +4,24 @@ Date: Sat, 29 Sep 2018 16:08:23 -0500 Subject: [PATCH] Turtle API -diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index 19c92bea21ddcc3917eb011dcfe41006299356ef..fa8eab20bb839c53bf7989d02d2274f835002609 100644 ---- a/src/main/java/net/minecraft/server/EntityTurtle.java -+++ b/src/main/java/net/minecraft/server/EntityTurtle.java -@@ -31,7 +31,7 @@ public class EntityTurtle extends EntityAnimal { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +index 62276550627bfe453794a2b3101426fe05a585ff..6a156a488bc073b3b60f4d1081e3f2ab65ba9e96 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +@@ -14,7 +14,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + protected int c; + protected int d; + private int g; +- protected BlockPosition e; ++ protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER + private boolean h; + private final int i; + private final int j; +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +index bf224c97854daa379c61affff6a0ac9524c2c35d..38588e59f26dd1f3a43fc229195e4fb8484e3705 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +@@ -93,7 +93,7 @@ public class EntityTurtle extends EntityAnimal { this.datawatcher.set(EntityTurtle.bp, blockposition); } @@ -17,7 +30,7 @@ index 19c92bea21ddcc3917eb011dcfe41006299356ef..fa8eab20bb839c53bf7989d02d2274f8 return (BlockPosition) this.datawatcher.get(EntityTurtle.bp); } -@@ -47,31 +47,37 @@ public class EntityTurtle extends EntityAnimal { +@@ -109,31 +109,37 @@ public class EntityTurtle extends EntityAnimal { return (Boolean) this.datawatcher.get(EntityTurtle.bq); } @@ -56,7 +69,7 @@ index 19c92bea21ddcc3917eb011dcfe41006299356ef..fa8eab20bb839c53bf7989d02d2274f8 private void w(boolean flag) { this.datawatcher.set(EntityTurtle.bu, flag); } -@@ -438,14 +444,17 @@ public class EntityTurtle extends EntityAnimal { +@@ -500,14 +506,17 @@ public class EntityTurtle extends EntityAnimal { if (!this.g.isInWater() && this.l()) { if (this.g.bv < 1) { @@ -77,7 +90,7 @@ index 19c92bea21ddcc3917eb011dcfe41006299356ef..fa8eab20bb839c53bf7989d02d2274f8 } // CraftBukkit end this.g.setHasEgg(false); -@@ -574,7 +583,7 @@ public class EntityTurtle extends EntityAnimal { +@@ -636,7 +645,7 @@ public class EntityTurtle extends EntityAnimal { @Override public boolean a() { @@ -86,46 +99,24 @@ index 19c92bea21ddcc3917eb011dcfe41006299356ef..fa8eab20bb839c53bf7989d02d2274f8 } @Override -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -index 1295cb02ab9e39519d73e2c260a50b64d44929a1..9b0511e996a5e3952c6f975e7c93299c532a8ea1 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -@@ -9,7 +9,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - protected int c; - protected int d; - private int g; -- protected BlockPosition e; -+ protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER - private boolean h; - private final int i; - private final int j; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java -index 123a2c75cad410d079cfb23223ab509e4b4c63f7..f2b09a1e66dfbcd943612b5170d20bb284fbcc68 100644 +index b46bb75926c14ab54ea309a400eb57405b11ce27..31f1a6b2b9a432cdd25826ced884424eeb50df97 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTurtle.java -@@ -1,6 +1,8 @@ - package org.bukkit.craftbukkit.entity; - - import net.minecraft.server.EntityTurtle; -+import net.minecraft.server.MCUtil; -+import org.bukkit.Location; - import org.bukkit.craftbukkit.CraftServer; - import org.bukkit.entity.EntityType; - import org.bukkit.entity.Turtle; -@@ -25,4 +27,36 @@ public class CraftTurtle extends CraftAnimals implements Turtle { +@@ -25,4 +25,36 @@ public class CraftTurtle extends CraftAnimals implements Turtle { public EntityType getType() { return EntityType.TURTLE; } + + // Paper start + @Override -+ public Location getHome() { -+ return MCUtil.toLocation(getHandle().world, getHandle().getHomePos()); ++ public org.bukkit.Location getHome() { ++ return net.minecraft.server.MCUtil.toLocation(getHandle().world, getHandle().getHomePos()); + } + + @Override -+ public void setHome(Location location) { -+ getHandle().setHomePos(MCUtil.toBlockPosition(location)); ++ public void setHome(org.bukkit.Location location) { ++ getHandle().setHomePos(net.minecraft.server.MCUtil.toBlockPosition(location)); + } + + @Override diff --git a/Spigot-Server-Patches/0297-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch b/Spigot-Server-Patches/0297-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch index f37963a65c..1460c05dd9 100644 --- a/Spigot-Server-Patches/0297-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch +++ b/Spigot-Server-Patches/0297-MC-50319-Check-other-worlds-for-shooter-of-projectil.patch @@ -10,11 +10,11 @@ because the entity is in another world. If the projectile fails to find the shooter in the current world, check other worlds. -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java -index 97aed437adb98bc468ec757df8b6d375b5101834..8d26521bc414b3d34f496e966f0c918b023f4833 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java -@@ -29,7 +29,18 @@ public abstract class IProjectile extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +index 8967cf1e0238941370412109eff2ccf19f86b727..1ff55a1b6c1faae95a83cd8fc12a2045ad479145 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +@@ -40,7 +40,18 @@ public abstract class IProjectile extends Entity { @Nullable public Entity getShooter() { diff --git a/Spigot-Server-Patches/0298-Call-player-spectator-target-events-and-improve-impl.patch b/Spigot-Server-Patches/0298-Call-player-spectator-target-events-and-improve-impl.patch index c5cf590ff1..a8f9fe1464 100644 --- a/Spigot-Server-Patches/0298-Call-player-spectator-target-events-and-improve-impl.patch +++ b/Spigot-Server-Patches/0298-Call-player-spectator-target-events-and-improve-impl.patch @@ -18,11 +18,11 @@ spectate the target entity. Co-authored-by: Spottedleaf -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 03d062f9cdf19df32dcc57a247555e5fa21d38b9..86e254601498d03e516d7a00da0749d4458b4820 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1683,15 +1683,59 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index b1e45c326b27d640337fc69bd0e107f5db3eb4cf..b63a8ac9bae50494fd8e093ff163df961d779c2d 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -1810,15 +1810,59 @@ public class EntityPlayer extends EntityHuman implements ICrafting { return (Entity) (this.spectatedEntity == null ? this : this.spectatedEntity); } @@ -87,11 +87,11 @@ index 03d062f9cdf19df32dcc57a247555e5fa21d38b9..86e254601498d03e516d7a00da0749d4 } @Override -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 370bf14e04a5989ed306f94e669bd789e3ebd61b..3321be2ba2d1c565d8f41945f09cf12f38fb88b6 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1208,6 +1208,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index e24997fd0d43ff8293537e8fdefe66f1f3dadcdb..933ccc459bba527739666d33b6399187f49d43c7 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1353,6 +1353,7 @@ public class PlayerConnection implements PacketListenerPlayIn { } // CraftBukkit start - Delegate to teleport(Location) diff --git a/Spigot-Server-Patches/0299-Add-Velocity-IP-Forwarding-Support.patch b/Spigot-Server-Patches/0299-Add-Velocity-IP-Forwarding-Support.patch index c7febf919a..735c2f2a77 100644 --- a/Spigot-Server-Patches/0299-Add-Velocity-IP-Forwarding-Support.patch +++ b/Spigot-Server-Patches/0299-Add-Velocity-IP-Forwarding-Support.patch @@ -66,7 +66,7 @@ index 0000000000000000000000000000000000000000..fdd8708f974700c7cde6e436c2f189d9 +import com.mojang.authlib.GameProfile; +import com.mojang.authlib.properties.Property; +import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.PacketDataSerializer; ++import net.minecraft.network.protocol.game.PacketDataSerializer; + +import java.net.InetAddress; +import java.security.InvalidKeyException; @@ -126,11 +126,73 @@ index 0000000000000000000000000000000000000000..fdd8708f974700c7cde6e436c2f189d9 + } + } +} -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index 066b0dbdbc101a8235fb872c2d1e9d427dfd6bb8..ddad076c7eb6d30f2e0f187e004c9e198f7ff777 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -27,6 +27,7 @@ import org.bukkit.craftbukkit.util.Waitable; +diff --git a/src/main/java/net/minecraft/network/PacketDataSerializer.java b/src/main/java/net/minecraft/network/PacketDataSerializer.java +index 4fc06bc5ef630b07fc8462cf835e6f92b151e6c6..eb00eb2b7bee2b9f85efef0ee5ed1605f4cabef8 100644 +--- a/src/main/java/net/minecraft/network/PacketDataSerializer.java ++++ b/src/main/java/net/minecraft/network/PacketDataSerializer.java +@@ -191,6 +191,7 @@ public class PacketDataSerializer extends ByteBuf { + return this.d(oenum.ordinal()); + } + ++ public int readVarInt() { return i(); } // Paper - OBFHELPER + public int i() { + int i = 0; + int j = 0; +@@ -231,6 +232,7 @@ public class PacketDataSerializer extends ByteBuf { + return this; + } + ++ public UUID readUUID() { return k(); } // Paper - OBFHELPER + public UUID k() { + return new UUID(this.readLong(), this.readLong()); + } +@@ -358,6 +360,7 @@ public class PacketDataSerializer extends ByteBuf { + } + } + ++ public String readUTF(int maxLength) { return this.e(maxLength); } // Paper - OBFHELPER + public String e(int i) { + int j = this.i(); + +diff --git a/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java b/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java +index c1bac2d07e5107c1346f246f5d5d929c73912bfd..c47c2d774a1990ad5007bbdc7bd3a81b3f3817e3 100644 +--- a/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java ++++ b/src/main/java/net/minecraft/network/protocol/login/PacketLoginInCustomPayload.java +@@ -6,8 +6,8 @@ import net.minecraft.network.protocol.Packet; + + public class PacketLoginInCustomPayload implements Packet { + +- private int a; +- private PacketDataSerializer b; ++ private int a; public int getId() { return a; } // Paper - OBFHELPER ++ private PacketDataSerializer b; public PacketDataSerializer getBuf() { return b; } // Paper - OBFHELPER + + public PacketLoginInCustomPayload() {} + +diff --git a/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java b/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java +index eb970c1e954cb0aa83aa12e83c471778809e69b2..2d8c917509f10a96fc82404908b452cb385c7c60 100644 +--- a/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java ++++ b/src/main/java/net/minecraft/network/protocol/login/PacketLoginOutCustomPayload.java +@@ -13,6 +13,14 @@ public class PacketLoginOutCustomPayload implements Packet { - -- private int a; -- private PacketDataSerializer b; -+ private int a; public int getId() { return a; } // Paper - OBFHELPER -+ private PacketDataSerializer b; public PacketDataSerializer getBuf() { return b; } // Paper - OBFHELPER - - public PacketLoginInCustomPayload() {} - -diff --git a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -index b52e8b72eaee87e227b7cc2fd66101550262cb7e..990cfea6c2339cd3cf688e4645de76dcee1d351a 100644 ---- a/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -+++ b/src/main/java/net/minecraft/server/PacketLoginOutCustomPayload.java -@@ -10,6 +10,14 @@ public class PacketLoginOutCustomPayload implements Packet bp = DataWatcher.a(EntityWitch.class, DataWatcherRegistry.i); @@ -29,7 +29,7 @@ index 0703124e5137ff0a5ae4d025488eb343d2813067..ca3c5150bcfe2a92b49ad5a27c23dd37 private PathfinderGoalNearestHealableRaider br; private PathfinderGoalNearestAttackableTargetWitch bs; -@@ -56,10 +62,12 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -95,10 +101,12 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { return SoundEffects.ENTITY_WITCH_DEATH; } @@ -42,7 +42,7 @@ index 0703124e5137ff0a5ae4d025488eb343d2813067..ca3c5150bcfe2a92b49ad5a27c23dd37 public boolean m() { return (Boolean) this.getDataWatcher().get(EntityWitch.bp); } -@@ -118,21 +126,24 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -157,21 +165,24 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { } if (potionregistry != null) { @@ -79,7 +79,7 @@ index 0703124e5137ff0a5ae4d025488eb343d2813067..ca3c5150bcfe2a92b49ad5a27c23dd37 } } -@@ -144,6 +155,24 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { +@@ -183,6 +194,24 @@ public class EntityWitch extends EntityRaider implements IRangedEntity { super.movementTick(); } @@ -105,14 +105,10 @@ index 0703124e5137ff0a5ae4d025488eb343d2813067..ca3c5150bcfe2a92b49ad5a27c23dd37 public SoundEffect eL() { return SoundEffects.ENTITY_WITCH_CELEBRATE; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -index bae107e76e4c8df446d4a7be8dda291d820074d7..c3138a6d24df1e71910791e67284983d8cd500f2 100644 +index 9cc34cdb43596eff34625045f884b93da3f27ab6..72428396a8c91d5d848b3019aaaa03bc3283574b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWitch.java -@@ -1,10 +1,16 @@ - package org.bukkit.craftbukkit.entity; - --import com.destroystokyo.paper.entity.CraftRangedEntity; // Paper - import net.minecraft.server.EntityWitch; +@@ -4,6 +4,13 @@ import net.minecraft.world.entity.monster.EntityWitch; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.entity.EntityType; import org.bukkit.entity.Witch; @@ -124,9 +120,9 @@ index bae107e76e4c8df446d4a7be8dda291d820074d7..c3138a6d24df1e71910791e67284983d +import org.bukkit.inventory.ItemStack; +// Paper end - public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity { // Paper + public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo.paper.entity.CraftRangedEntity { // Paper public CraftWitch(CraftServer server, EntityWitch entity) { -@@ -25,4 +31,23 @@ public class CraftWitch extends CraftRaider implements Witch, CraftRangedEntity< +@@ -24,4 +31,23 @@ public class CraftWitch extends CraftRaider implements Witch, com.destroystokyo. public EntityType getType() { return EntityType.WITCH; } diff --git a/Spigot-Server-Patches/0301-Check-Drowned-for-Villager-Aggression-Config.patch b/Spigot-Server-Patches/0301-Check-Drowned-for-Villager-Aggression-Config.patch index 04ed06de59..efb266e1a5 100644 --- a/Spigot-Server-Patches/0301-Check-Drowned-for-Villager-Aggression-Config.patch +++ b/Spigot-Server-Patches/0301-Check-Drowned-for-Villager-Aggression-Config.patch @@ -4,11 +4,11 @@ Date: Wed, 10 Oct 2018 21:22:44 -0500 Subject: [PATCH] Check Drowned for Villager Aggression Config -diff --git a/src/main/java/net/minecraft/server/EntityDrowned.java b/src/main/java/net/minecraft/server/EntityDrowned.java -index 9c507cb0810029e3c5d7cb1055da170469315596..9ae0897bfd6a4577901d9189d0dba22f3ec2110c 100644 ---- a/src/main/java/net/minecraft/server/EntityDrowned.java -+++ b/src/main/java/net/minecraft/server/EntityDrowned.java -@@ -31,7 +31,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java b/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java +index c3457fc7c0f72af79b12dc50c270ca24b7590c22..e4794760fc918cccbdc3f8d10ab21dd9b6f29e8e 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityDrowned.java +@@ -82,7 +82,7 @@ public class EntityDrowned extends EntityZombie implements IRangedEntity { this.goalSelector.a(7, new PathfinderGoalRandomStroll(this, 1.0D)); this.targetSelector.a(1, (new PathfinderGoalHurtByTarget(this, new Class[]{EntityDrowned.class})).a(EntityPigZombie.class)); this.targetSelector.a(2, new PathfinderGoalNearestAttackableTarget<>(this, EntityHuman.class, 10, true, false, this::i)); diff --git a/Spigot-Server-Patches/0302-Here-s-Johnny.patch b/Spigot-Server-Patches/0302-Here-s-Johnny.patch index 08e83e4082..b9a50189c2 100644 --- a/Spigot-Server-Patches/0302-Here-s-Johnny.patch +++ b/Spigot-Server-Patches/0302-Here-s-Johnny.patch @@ -4,11 +4,11 @@ Date: Fri, 12 Oct 2018 01:37:22 -0500 Subject: [PATCH] Here's Johnny! -diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index b358070215477bcd33dcd440472db4489017135a..c0d26aa9dcd02c44d744b10e18609857ada95889 100644 ---- a/src/main/java/net/minecraft/server/EntityVindicator.java -+++ b/src/main/java/net/minecraft/server/EntityVindicator.java -@@ -11,7 +11,7 @@ public class EntityVindicator extends EntityIllagerAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +index c181d5f5e6108ade54fc97c665897d1db5e90719..c45dcb56af95f3e87e292b92b697a336461f01bc 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +@@ -51,7 +51,7 @@ public class EntityVindicator extends EntityIllagerAbstract { private static final Predicate b = (enumdifficulty) -> { return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD; }; @@ -18,7 +18,7 @@ index b358070215477bcd33dcd440472db4489017135a..c0d26aa9dcd02c44d744b10e18609857 public EntityVindicator(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java -index 951d47929893fce38183b81cf4ec6a7d4204acd1..5ff957ced7a86f4fa3a0751b4eed5a6fdc525da4 100644 +index e793820e1ede4bd4d31e6fe12ca8189707674ffe..b128e8291f2d7652a98f1271d763e33afa5de9f7 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVindicator.java @@ -25,4 +25,14 @@ public class CraftVindicator extends CraftIllager implements Vindicator { diff --git a/Spigot-Server-Patches/0303-Add-option-to-prevent-players-from-moving-into-unloa.patch b/Spigot-Server-Patches/0303-Add-option-to-prevent-players-from-moving-into-unloa.patch index d876e66a0d..ca79513910 100644 --- a/Spigot-Server-Patches/0303-Add-option-to-prevent-players-from-moving-into-unloa.patch +++ b/Spigot-Server-Patches/0303-Add-option-to-prevent-players-from-moving-into-unloa.patch @@ -19,11 +19,11 @@ index f280dbff4a09bc611a9ca565c6d697d08801f53b..fbf3ccfb347a5ba6e895339e9576629d + preventMovingIntoUnloadedChunks = getBoolean("prevent-moving-into-unloaded-chunks", false); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 3321be2ba2d1c565d8f41945f09cf12f38fb88b6..fa74b0266172bf83339f85a4e739bbf2256e4ccf 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -396,6 +396,13 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 933ccc459bba527739666d33b6399187f49d43c7..0cdfc38c3f07b28e1db0ee28952494c1950a698d 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -541,6 +541,13 @@ public class PlayerConnection implements PacketListenerPlayIn { } speed *= 2f; // TODO: Get the speed of the vehicle instead of the player @@ -37,7 +37,7 @@ index 3321be2ba2d1c565d8f41945f09cf12f38fb88b6..fa74b0266172bf83339f85a4e739bbf2 if (d10 - d9 > Math.max(100.0D, Math.pow((double) (org.spigotmc.SpigotConfig.movedTooQuicklyMultiplier * (float) i * speed), 2)) && !this.isExemptPlayer()) { // CraftBukkit end PlayerConnection.LOGGER.warn("{} (vehicle of {}) moved too quickly! {},{},{}", entity.getDisplayName().getString(), this.player.getDisplayName().getString(), d6, d7, d8); -@@ -994,9 +1001,9 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1139,9 +1146,9 @@ public class PlayerConnection implements PacketListenerPlayIn { double d1 = this.player.locY(); double d2 = this.player.locZ(); double d3 = this.player.locY(); @@ -49,7 +49,7 @@ index 3321be2ba2d1c565d8f41945f09cf12f38fb88b6..fa74b0266172bf83339f85a4e739bbf2 float f = packetplayinflying.a(this.player.yaw); float f1 = packetplayinflying.b(this.player.pitch); double d7 = d4 - this.l; -@@ -1035,6 +1042,12 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -1180,6 +1187,12 @@ public class PlayerConnection implements PacketListenerPlayIn { } else { speed = player.abilities.walkSpeed * 10f; } diff --git a/Spigot-Server-Patches/0304-Reset-players-airTicks-on-respawn.patch b/Spigot-Server-Patches/0304-Reset-players-airTicks-on-respawn.patch index 42ee52deb6..0bd12596ce 100644 --- a/Spigot-Server-Patches/0304-Reset-players-airTicks-on-respawn.patch +++ b/Spigot-Server-Patches/0304-Reset-players-airTicks-on-respawn.patch @@ -4,23 +4,11 @@ Date: Sat, 20 Oct 2018 22:34:02 -0400 Subject: [PATCH] Reset players airTicks on respawn -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index c9f4dab524e8f2a80b9e3ee178c36b2e394b5f84..9b8d17aa68bad1a4916681b9eed121011bf3380c 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2264,6 +2264,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - - } - -+ public final int getMaxAirTicks() { return bH(); } // Paper - OBFHELPER - public int bH() { - return 300; - } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index d92cb1aca385ea15c181ba0dc8f19f317c995163..79a451fb8b19ff35fa935d40d97a53075e6b6e54 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -2025,6 +2025,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index b63a8ac9bae50494fd8e093ff163df961d779c2d..f05f24f2a5c4ba8dbb8572d113afc404259e73ed 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -2152,6 +2152,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } this.setHealth(this.getMaxHealth()); @@ -28,3 +16,15 @@ index d92cb1aca385ea15c181ba0dc8f19f317c995163..79a451fb8b19ff35fa935d40d97a5307 this.fireTicks = 0; this.fallDistance = 0; this.foodData = new FoodMetaData(this); +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 4d7bb023092ee118d68ecce1918e220f541b33c1..1f5ab7d43315fa3a67297eabea3bda257ed24a44 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2349,6 +2349,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + + } + ++ public final int getMaxAirTicks() { return bH(); } // Paper - OBFHELPER + public int bH() { + return 300; + } diff --git a/Spigot-Server-Patches/0306-Improve-Server-Thread-Pool-and-Thread-Priorities.patch b/Spigot-Server-Patches/0306-Improve-Server-Thread-Pool-and-Thread-Priorities.patch index 0d6ce237e9..b3d8dbb5a6 100644 --- a/Spigot-Server-Patches/0306-Improve-Server-Thread-Pool-and-Thread-Priorities.patch +++ b/Spigot-Server-Patches/0306-Improve-Server-Thread-Pool-and-Thread-Priorities.patch @@ -11,42 +11,11 @@ server threads Allow usage of a single thread executor by not using ForkJoin so single core CPU's. -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c24397d2ded7d3ea6f7440035ed64d29602900a6..518e15e6a4b7750e90a958686bcd930c351f5e1c 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -177,6 +177,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { -diff --git a/src/main/java/net/minecraft/server/BlockSponge.java b/src/main/java/net/minecraft/server/BlockSponge.java -index 4666e3aedc3d614eb38a08bd34f402b24bd1d0b6..7a2130d74e787f82b771d4efa8d3f15804f05940 100644 ---- a/src/main/java/net/minecraft/server/BlockSponge.java -+++ b/src/main/java/net/minecraft/server/BlockSponge.java -@@ -116,8 +116,11 @@ public class BlockSponge extends Block { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockSponge.java b/src/main/java/net/minecraft/world/level/block/BlockSponge.java +index ef48ad0ab68e2e050bc8aca484d850297990b78e..d80eee47390ab202eea0368571421bbc94655ab1 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockSponge.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockSponge.java +@@ -129,8 +129,11 @@ public class BlockSponge extends Block { // NOP } else if (material == Material.WATER_PLANT || material == Material.REPLACEABLE_WATER_PLANT) { TileEntity tileentity = iblockdata.getBlock().isTileEntity() ? world.getTileEntity(blockposition2) : null; diff --git a/Spigot-Server-Patches/0311-Don-t-allow-digging-into-unloaded-chunks.patch b/Spigot-Server-Patches/0311-Don-t-allow-digging-into-unloaded-chunks.patch index 25a8cf2267..2f622b81df 100644 --- a/Spigot-Server-Patches/0311-Don-t-allow-digging-into-unloaded-chunks.patch +++ b/Spigot-Server-Patches/0311-Don-t-allow-digging-into-unloaded-chunks.patch @@ -4,27 +4,11 @@ Date: Sun, 11 Nov 2018 21:01:09 +0000 Subject: [PATCH] Don't allow digging into unloaded chunks -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index fa74b0266172bf83339f85a4e739bbf2256e4ccf..a448773cc46889df37d563beb227beaa433d726e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1372,6 +1372,11 @@ public class PlayerConnection implements PacketListenerPlayIn { - case START_DESTROY_BLOCK: - case ABORT_DESTROY_BLOCK: - case STOP_DESTROY_BLOCK: -+ // Paper start - Don't allow digging in unloaded chunks -+ if (this.player.world.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { -+ return; -+ } -+ // Paper end - Don't allow digging in unloaded chunks - this.player.playerInteractManager.a(blockposition, packetplayinblockdig_enumplayerdigtype, packetplayinblockdig.c(), this.minecraftServer.getMaxBuildHeight()); - return; - default: -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index daeaae8072a12b1d5f0718ba9e5bdd4f9c0e2169..21acea46a288348cbc2d4fa312035d6679987399 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -81,8 +81,8 @@ public class PlayerInteractManager { +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 13e02b8d73164bc36e8d29edf8b0b2cb51fe3080..0d32d7e9fc6bf6a05f3975fe225022a9e176e47b 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -111,8 +111,8 @@ public class PlayerInteractManager { IBlockData iblockdata; if (this.j) { @@ -35,7 +19,7 @@ index daeaae8072a12b1d5f0718ba9e5bdd4f9c0e2169..21acea46a288348cbc2d4fa312035d66 this.j = false; } else { float f = this.a(iblockdata, this.k, this.l); -@@ -93,7 +93,13 @@ public class PlayerInteractManager { +@@ -123,7 +123,13 @@ public class PlayerInteractManager { } } } else if (this.f) { @@ -50,7 +34,7 @@ index daeaae8072a12b1d5f0718ba9e5bdd4f9c0e2169..21acea46a288348cbc2d4fa312035d66 if (iblockdata.isAir()) { this.world.a(this.player.getId(), this.h, -1); this.m = -1; -@@ -257,10 +263,12 @@ public class PlayerInteractManager { +@@ -287,10 +293,12 @@ public class PlayerInteractManager { this.player.playerConnection.sendPacket(new PacketPlayOutBlockBreak(blockposition, this.world.getType(blockposition), packetplayinblockdig_enumplayerdigtype, true, "stopped destroying")); } else if (packetplayinblockdig_enumplayerdigtype == PacketPlayInBlockDig.EnumPlayerDigType.ABORT_DESTROY_BLOCK) { this.f = false; @@ -66,3 +50,19 @@ index daeaae8072a12b1d5f0718ba9e5bdd4f9c0e2169..21acea46a288348cbc2d4fa312035d66 } this.world.a(this.player.getId(), blockposition, -1); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0cdfc38c3f07b28e1db0ee28952494c1950a698d..76bba793ea2afb52919bcf1cb430b9412fceb319 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1517,6 +1517,11 @@ public class PlayerConnection implements PacketListenerPlayIn { + case START_DESTROY_BLOCK: + case ABORT_DESTROY_BLOCK: + case STOP_DESTROY_BLOCK: ++ // Paper start - Don't allow digging in unloaded chunks ++ if (this.player.world.getChunkIfLoadedImmediately(blockposition.getX() >> 4, blockposition.getZ() >> 4) == null) { ++ return; ++ } ++ // Paper end - Don't allow digging in unloaded chunks + this.player.playerInteractManager.a(blockposition, packetplayinblockdig_enumplayerdigtype, packetplayinblockdig.c(), this.minecraftServer.getMaxBuildHeight()); + return; + default: diff --git a/Spigot-Server-Patches/0312-Book-Size-Limits.patch b/Spigot-Server-Patches/0312-Book-Size-Limits.patch index fce35a7b6c..a0085f4e5a 100644 --- a/Spigot-Server-Patches/0312-Book-Size-Limits.patch +++ b/Spigot-Server-Patches/0312-Book-Size-Limits.patch @@ -21,19 +21,11 @@ index 3139c194f9b1bc3510d51a81f13ae43d00a3dc29..13edb435b3fa65b4980bd7472aa5a519 + maxBookTotalSizeMultiplier = getDouble("settings.book-size.total-multiplier", maxBookTotalSizeMultiplier); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index a448773cc46889df37d563beb227beaa433d726e..188af7af384ca35f2e659dfb1f7518dd06803be3 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -20,6 +20,7 @@ import java.util.function.Consumer; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; -+import org.apache.commons.lang3.StringEscapeUtils; - import org.apache.commons.lang3.StringUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -854,6 +855,52 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 76bba793ea2afb52919bcf1cb430b9412fceb319..a2413a4e1d16b856df9f74e42eb141f72b0893c6 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -999,6 +999,52 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInBEdit packetplayinbedit) { diff --git a/Spigot-Server-Patches/0314-Prevent-rayTrace-from-loading-chunks.patch b/Spigot-Server-Patches/0314-Prevent-rayTrace-from-loading-chunks.patch index d817761f84..b490087b7b 100644 --- a/Spigot-Server-Patches/0314-Prevent-rayTrace-from-loading-chunks.patch +++ b/Spigot-Server-Patches/0314-Prevent-rayTrace-from-loading-chunks.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Prevent rayTrace from loading chunks ray tracing into an unloaded chunk should be treated as a miss this saves a ton of lag for when AI tries to raytrace near unloaded chunks. -diff --git a/src/main/java/net/minecraft/server/IBlockAccess.java b/src/main/java/net/minecraft/server/IBlockAccess.java -index 93946d15c08fa71c63273f6b4e096bb8b4448394..c4a83448ed4513f6e4ab179d1d43e5bb0cb13641 100644 ---- a/src/main/java/net/minecraft/server/IBlockAccess.java -+++ b/src/main/java/net/minecraft/server/IBlockAccess.java -@@ -46,7 +46,15 @@ public interface IBlockAccess { +diff --git a/src/main/java/net/minecraft/world/level/IBlockAccess.java b/src/main/java/net/minecraft/world/level/IBlockAccess.java +index f0b74dce1e0a3ca150251008247a14b380cde03d..b9b2764090134cba5fc3b9edca4e71f1ce772448 100644 +--- a/src/main/java/net/minecraft/world/level/IBlockAccess.java ++++ b/src/main/java/net/minecraft/world/level/IBlockAccess.java +@@ -56,7 +56,15 @@ public interface IBlockAccess { // CraftBukkit start - moved block handling into separate method for use by Block#rayTrace default MovingObjectPositionBlock rayTraceBlock(RayTrace raytrace1, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0315-Handle-Large-Packets-disconnecting-client.patch b/Spigot-Server-Patches/0315-Handle-Large-Packets-disconnecting-client.patch index 3dbddbe99f..40a6c15b04 100644 --- a/Spigot-Server-Patches/0315-Handle-Large-Packets-disconnecting-client.patch +++ b/Spigot-Server-Patches/0315-Handle-Large-Packets-disconnecting-client.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Handle Large Packets disconnecting client If a players inventory is too big to send in a single packet, split the inventory set into multiple packets instead. -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 3351389dc122b66c198fb21ff02976491e9b46d9..c90c616860b5157956250e4fe21e1764dd04881c 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index 297820baef99e97e1216a64c527219e9ccc3e320..dc788d75a6a34fbbae990609bfbbd13ca6cdee5a 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java @@ -12,6 +12,7 @@ import io.netty.channel.epoll.EpollEventLoopGroup; import io.netty.channel.local.LocalChannel; import io.netty.channel.local.LocalServerChannel; @@ -18,7 +18,7 @@ index 3351389dc122b66c198fb21ff02976491e9b46d9..c90c616860b5157956250e4fe21e1764 import io.netty.handler.timeout.TimeoutException; import io.netty.util.AttributeKey; import io.netty.util.concurrent.Future; -@@ -97,6 +98,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -107,6 +108,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } public void exceptionCaught(ChannelHandlerContext channelhandlercontext, Throwable throwable) { @@ -34,28 +34,11 @@ index 3351389dc122b66c198fb21ff02976491e9b46d9..c90c616860b5157956250e4fe21e1764 if (throwable instanceof SkipEncodeException) { NetworkManager.LOGGER.debug("Skipping packet due to errors", throwable.getCause()); } else { -diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java -index 601d4d0fa2a0b3e90f81aed55a2d3473c66c7875..2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5 100644 ---- a/src/main/java/net/minecraft/server/Packet.java -+++ b/src/main/java/net/minecraft/server/Packet.java -@@ -10,6 +10,12 @@ public interface Packet { - - void a(T t0); - -+ // Paper start -+ default boolean packetTooLarge(NetworkManager manager) { -+ return false; -+ } -+ // Paper end -+ - default boolean a() { - return false; - } -diff --git a/src/main/java/net/minecraft/server/PacketEncoder.java b/src/main/java/net/minecraft/server/PacketEncoder.java -index d3c6bdbefb89b3e668477e0d771015e9b25c24a8..dbf85f49703f9599f6d6b441db566dd8f6d3cd4b 100644 ---- a/src/main/java/net/minecraft/server/PacketEncoder.java -+++ b/src/main/java/net/minecraft/server/PacketEncoder.java -@@ -51,7 +51,31 @@ public class PacketEncoder extends MessageToByteEncoder> { +diff --git a/src/main/java/net/minecraft/network/PacketEncoder.java b/src/main/java/net/minecraft/network/PacketEncoder.java +index 2f6da89d6b25ba5144ec15b1bf0e8ed13278e85e..037d989522d24a55eced1c462d40a6dc2a7ecfce 100644 +--- a/src/main/java/net/minecraft/network/PacketEncoder.java ++++ b/src/main/java/net/minecraft/network/PacketEncoder.java +@@ -53,7 +53,31 @@ public class PacketEncoder extends MessageToByteEncoder> { throw throwable; } } @@ -87,11 +70,28 @@ index d3c6bdbefb89b3e668477e0d771015e9b25c24a8..dbf85f49703f9599f6d6b441db566dd8 + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 0ef4fbb19fc816f578ad741c4406790f4185093d..34e92e544f37167317d58af4242acde49e588673 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -79,7 +79,7 @@ public class PacketPlayOutMapChunk implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java +index cd4493a023748264748d4e892815f14d8a7bd7f6..0783b0777c8d7788bbf6780b464b709bf6dc2191 100644 +--- a/src/main/java/net/minecraft/network/protocol/Packet.java ++++ b/src/main/java/net/minecraft/network/protocol/Packet.java +@@ -12,6 +12,12 @@ public interface Packet { + + void a(T t0); + ++ // Paper start ++ default boolean packetTooLarge(NetworkManager manager) { ++ return false; ++ } ++ // Paper end ++ + default boolean a() { + return false; + } +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index 7b47d4f1cbf9f8646e0b1af9277cf341ea28a2b3..1119ee4f69a153852219b4e985e97a6b3175a8be 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -90,7 +90,7 @@ public class PacketPlayOutMapChunk implements Packet { int i = packetdataserializer.i(); @@ -100,11 +100,11 @@ index 0ef4fbb19fc816f578ad741c4406790f4185093d..34e92e544f37167317d58af4242acde4 throw new RuntimeException("Chunk Packet trying to allocate too much memory on read."); } else { this.f = new byte[i]; -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -index e32db2baf84dcb192800e6048cadf3511da28181..6fb3168fd6de0074b1b378e992e4706c50ae15ab 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutWindowItems.java -@@ -9,6 +9,15 @@ public class PacketPlayOutWindowItems implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java +index b90e35a0099a2482f8fc2998bd079fc2fe6439e6..c8c03532982c4d69ea1b070692bbc459f2b83b89 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutWindowItems.java +@@ -13,6 +13,15 @@ public class PacketPlayOutWindowItems implements Packet { private int a; private List b; diff --git a/Spigot-Server-Patches/0316-force-entity-dismount-during-teleportation.patch b/Spigot-Server-Patches/0316-force-entity-dismount-during-teleportation.patch index e873382931..d8bcf358b4 100644 --- a/Spigot-Server-Patches/0316-force-entity-dismount-during-teleportation.patch +++ b/Spigot-Server-Patches/0316-force-entity-dismount-during-teleportation.patch @@ -19,11 +19,32 @@ this is going to be the best soultion all around. Improvements/suggestions welcome! -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 00d783a7fd27fb46f5bbca4055be1530efd71534..1db2c51f0c1de27504d3f44070042e5e0dacf9cd 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1954,12 +1954,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index f05f24f2a5c4ba8dbb8572d113afc404259e73ed..cf63703f5f38b1531912d413b0ac16c23627ca34 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -1252,11 +1252,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + } + } + +- @Override +- public void stopRiding() { ++ // Paper start ++ @Override public void stopRiding() { stopRiding(false); } ++ @Override public void stopRiding(boolean suppressCancellation) { ++ // paper end + Entity entity = this.getVehicle(); + +- super.stopRiding(); ++ super.stopRiding(suppressCancellation); // Paper + Entity entity1 = this.getVehicle(); + + if (entity1 != entity && this.playerConnection != null) { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 1f5ab7d43315fa3a67297eabea3bda257ed24a44..dca0bab93b5a1460c4741b0517b41490eb62703e 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2039,12 +2039,15 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } @@ -41,7 +62,7 @@ index 00d783a7fd27fb46f5bbca4055be1530efd71534..1db2c51f0c1de27504d3f44070042e5e } } -@@ -2014,7 +2017,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2099,7 +2102,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return true; // CraftBukkit } @@ -53,7 +74,7 @@ index 00d783a7fd27fb46f5bbca4055be1530efd71534..1db2c51f0c1de27504d3f44070042e5e if (entity.getVehicle() == this) { throw new IllegalStateException("Use x.stopRiding(y), not y.removePassenger(x)"); } else { -@@ -2024,7 +2030,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2109,7 +2115,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (getBukkitEntity() instanceof Vehicle && entity.getBukkitEntity() instanceof LivingEntity) { VehicleExitEvent event = new VehicleExitEvent( (Vehicle) getBukkitEntity(), @@ -62,7 +83,7 @@ index 00d783a7fd27fb46f5bbca4055be1530efd71534..1db2c51f0c1de27504d3f44070042e5e ); // Suppress during worldgen if (this.valid) { -@@ -2038,7 +2044,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2123,7 +2129,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } // CraftBukkit end // Spigot start @@ -71,30 +92,11 @@ index 00d783a7fd27fb46f5bbca4055be1530efd71534..1db2c51f0c1de27504d3f44070042e5e // Suppress during worldgen if (this.valid) { Bukkit.getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index d9eaa6ed3408d377218d64d75e97c2ed00ab0b08..eecf72651a1981288eddadfe9ff802cfe2b2e4b6 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -942,9 +942,11 @@ public abstract class EntityHuman extends EntityLiving { - return -0.35D; - } - -- @Override -- public void bf() { -- super.bf(); -+ // Paper start -+ @Override public void bf() { stopRiding(false); } -+ @Override public void stopRiding(boolean suppressCancellation) { -+ // Paper end -+ super.stopRiding(suppressCancellation); // Paper - suppress - this.j = 0; - } - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 1e65dc73607d5c530efd3ebd61f2bf93ee632a27..c6ef3a0614d85da8b9940e8a8ede7bb49bb4ca9d 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2922,11 +2922,13 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index c189a7051240bb357acf5075c98206a258409b0c..58270f45de665b5c1cfd9fc548eadb263ad230e9 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3015,11 +3015,13 @@ public abstract class EntityLiving extends Entity { return ((Byte) this.datawatcher.get(EntityLiving.ag) & 4) != 0; } @@ -111,24 +113,22 @@ index 1e65dc73607d5c530efd3ebd61f2bf93ee632a27..c6ef3a0614d85da8b9940e8a8ede7bb4 if (entity != null && entity != this.getVehicle() && !this.world.isClientSide) { this.a(entity); } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 65c3746b894c94ee58773e0e9d4ab2b7daf01424..27923a54b3ef297ca52707da1c38bebf6d9ab703 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1125,11 +1125,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - } +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index bed54f9732bbfe9edab81744276643da482785d3..6dc1d03e755cd4c268de71ebba7e771a640938c2 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -1036,9 +1036,11 @@ public abstract class EntityHuman extends EntityLiving { + return -0.35D; } - @Override -- public void stopRiding() { +- public void bf() { +- super.bf(); + // Paper start -+ @Override public void stopRiding() { stopRiding(false); } ++ @Override public void bf() { stopRiding(false); } + @Override public void stopRiding(boolean suppressCancellation) { -+ // paper end - Entity entity = this.getVehicle(); ++ // Paper end ++ super.stopRiding(suppressCancellation); // Paper - suppress + this.j = 0; + } -- super.stopRiding(); -+ super.stopRiding(suppressCancellation); // Paper - Entity entity1 = this.getVehicle(); - - if (entity1 != entity && this.playerConnection != null) { diff --git a/Spigot-Server-Patches/0317-Add-more-Zombie-API.patch b/Spigot-Server-Patches/0317-Add-more-Zombie-API.patch index cc335c5366..c620328b1a 100644 --- a/Spigot-Server-Patches/0317-Add-more-Zombie-API.patch +++ b/Spigot-Server-Patches/0317-Add-more-Zombie-API.patch @@ -4,11 +4,11 @@ Date: Sun, 7 Oct 2018 04:29:59 -0500 Subject: [PATCH] Add more Zombie API -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index f8b969b203cec7341382abf884a084cb4adbd7f9..f2776a9f78745f1bdd270d40b00a3123628c7c9b 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -32,6 +32,7 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index 219e3b1626d68ede57b08a706d24bb6bc4b13fac..79d34b0296f88e5b4fe0351fe2483fc0128deabc 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -94,6 +94,7 @@ public class EntityZombie extends EntityMonster { private int bt; public int drownedConversionTime; private int lastTick = MinecraftServer.currentTick; // CraftBukkit - add field @@ -16,7 +16,7 @@ index f8b969b203cec7341382abf884a084cb4adbd7f9..f2776a9f78745f1bdd270d40b00a3123 public EntityZombie(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -200,6 +201,12 @@ public class EntityZombie extends EntityMonster { +@@ -262,6 +263,12 @@ public class EntityZombie extends EntityMonster { super.movementTick(); } @@ -29,7 +29,7 @@ index f8b969b203cec7341382abf884a084cb4adbd7f9..f2776a9f78745f1bdd270d40b00a3123 public void startDrownedConversion(int i) { this.lastTick = MinecraftServer.currentTick; // CraftBukkit this.drownedConversionTime = i; -@@ -228,9 +235,16 @@ public class EntityZombie extends EntityMonster { +@@ -290,9 +297,16 @@ public class EntityZombie extends EntityMonster { } @@ -47,7 +47,7 @@ index f8b969b203cec7341382abf884a084cb4adbd7f9..f2776a9f78745f1bdd270d40b00a3123 @Override public boolean damageEntity(DamageSource damagesource, float f) { -@@ -351,6 +365,7 @@ public class EntityZombie extends EntityMonster { +@@ -413,6 +427,7 @@ public class EntityZombie extends EntityMonster { nbttagcompound.setBoolean("CanBreakDoors", this.eU()); nbttagcompound.setInt("InWaterTime", this.isInWater() ? this.bt : -1); nbttagcompound.setInt("DrownedConversionTime", this.isDrownConverting() ? this.drownedConversionTime : -1); @@ -55,7 +55,7 @@ index f8b969b203cec7341382abf884a084cb4adbd7f9..f2776a9f78745f1bdd270d40b00a3123 } @Override -@@ -362,7 +377,11 @@ public class EntityZombie extends EntityMonster { +@@ -424,7 +439,11 @@ public class EntityZombie extends EntityMonster { if (nbttagcompound.hasKeyOfType("DrownedConversionTime", 99) && nbttagcompound.getInt("DrownedConversionTime") > -1) { this.startDrownedConversion(nbttagcompound.getInt("DrownedConversionTime")); } @@ -69,7 +69,7 @@ index f8b969b203cec7341382abf884a084cb4adbd7f9..f2776a9f78745f1bdd270d40b00a3123 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java -index 2387f17acb0de1d1c297fd85217f514e7b4577f3..d334e656ea0f442a14864a05d4701df162487851 100644 +index 8ba92b7edacc088d610a9ed46eb7f61ebd8101a8..42d98d798bb8fe2d3c7cc2bfcf2ec38d97d99bd2 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -94,6 +94,42 @@ public class CraftZombie extends CraftMonster implements Zombie { diff --git a/Spigot-Server-Patches/0318-Add-PlayerConnectionCloseEvent.patch b/Spigot-Server-Patches/0318-Add-PlayerConnectionCloseEvent.patch index 8a986fcb5a..baf4dc17cb 100644 --- a/Spigot-Server-Patches/0318-Add-PlayerConnectionCloseEvent.patch +++ b/Spigot-Server-Patches/0318-Add-PlayerConnectionCloseEvent.patch @@ -33,27 +33,11 @@ API spec for this event. Plugins should not be using that event, and how PlayerPreLoginEvent interacts with PlayerConnectionCloseEvent is undefined. -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index ddad076c7eb6d30f2e0f187e004c9e198f7ff777..e5790c2aeaa380a3acc26434f5de78ac746c6d57 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -37,9 +37,9 @@ public class LoginListener implements PacketLoginInListener { - private final byte[] e = new byte[4]; - private final MinecraftServer server; - public final NetworkManager networkManager; -- private LoginListener.EnumProtocolState g; -+ private LoginListener.EnumProtocolState g; public final LoginListener.EnumProtocolState getLoginState() { return this.g; }; // Paper - OBFHELPER - private int h; -- private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } private GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER -+ private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } public GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER - private final String j; - private SecretKey loginKey; - private EntityPlayer l; -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index c90c616860b5157956250e4fe21e1764dd04881c..511a480aa962fd2659e929bb274297db6baf437e 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -340,6 +340,26 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index dc788d75a6a34fbbae990609bfbbd13ca6cdee5a..2eefa21531c991ae76bf026087eb07280fbc939e 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -350,6 +350,26 @@ public class NetworkManager extends SimpleChannelInboundHandler> { this.j().a(new ChatMessage("multiplayer.disconnect.generic")); } this.packetQueue.clear(); // Free up packet queue. @@ -80,3 +64,19 @@ index c90c616860b5157956250e4fe21e1764dd04881c..511a480aa962fd2659e929bb274297db } } +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 240fac47dedb726d86f5dd68cad35b91b8117be4..98ae77269b5aaad951b0e26da61e6f5eb7ec2818 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -55,9 +55,9 @@ public class LoginListener implements PacketLoginInListener { + private final byte[] e = new byte[4]; + private final MinecraftServer server; + public final NetworkManager networkManager; +- private LoginListener.EnumProtocolState g; ++ private LoginListener.EnumProtocolState g; public final LoginListener.EnumProtocolState getLoginState() { return this.g; }; // Paper - OBFHELPER + private int h; +- private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } private GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER ++ private GameProfile i; private void setGameProfile(final GameProfile profile) { this.i = profile; } public GameProfile getGameProfile() { return this.i; } // Paper - OBFHELPER + private final String j; + private SecretKey loginKey; + private EntityPlayer l; diff --git a/Spigot-Server-Patches/0319-Prevent-Enderman-from-loading-chunks.patch b/Spigot-Server-Patches/0319-Prevent-Enderman-from-loading-chunks.patch index fd61be70e1..86be24f3d4 100644 --- a/Spigot-Server-Patches/0319-Prevent-Enderman-from-loading-chunks.patch +++ b/Spigot-Server-Patches/0319-Prevent-Enderman-from-loading-chunks.patch @@ -4,11 +4,11 @@ Date: Tue, 18 Dec 2018 02:15:08 +0000 Subject: [PATCH] Prevent Enderman from loading chunks -diff --git a/src/main/java/net/minecraft/server/EntityEnderman.java b/src/main/java/net/minecraft/server/EntityEnderman.java -index f4b823882e1e842c897c7946f7d1a46ce5366de0..f53525eb32a6096ae24fd23756b2169d5d39e9d4 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderman.java -+++ b/src/main/java/net/minecraft/server/EntityEnderman.java -@@ -380,7 +380,8 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +index aa6cb15637144c9d8db1b1861e58f3f02d68357a..e993b1849beb60515c51ee4f37617faab63ca223 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEnderman.java +@@ -434,7 +434,8 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { int j = MathHelper.floor(this.enderman.locY() + random.nextDouble() * 3.0D); int k = MathHelper.floor(this.enderman.locZ() - 2.0D + random.nextDouble() * 4.0D); BlockPosition blockposition = new BlockPosition(i, j, k); @@ -18,7 +18,7 @@ index f4b823882e1e842c897c7946f7d1a46ce5366de0..f53525eb32a6096ae24fd23756b2169d Block block = iblockdata.getBlock(); Vec3D vec3d = new Vec3D((double) MathHelper.floor(this.enderman.locX()) + 0.5D, (double) j + 0.5D, (double) MathHelper.floor(this.enderman.locZ()) + 0.5D); Vec3D vec3d1 = new Vec3D((double) i + 0.5D, (double) j + 0.5D, (double) k + 0.5D); -@@ -420,7 +421,8 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { +@@ -474,7 +475,8 @@ public class EntityEnderman extends EntityMonster implements IEntityAngerable { int j = MathHelper.floor(this.a.locY() + random.nextDouble() * 2.0D); int k = MathHelper.floor(this.a.locZ() - 1.0D + random.nextDouble() * 2.0D); BlockPosition blockposition = new BlockPosition(i, j, k); diff --git a/Spigot-Server-Patches/0320-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch b/Spigot-Server-Patches/0320-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch index f3eda01737..5e5f5d5a68 100644 --- a/Spigot-Server-Patches/0320-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch +++ b/Spigot-Server-Patches/0320-Add-APIs-to-replace-OfflinePlayer-getLastPlayed.patch @@ -15,23 +15,23 @@ current defacto implementation, I've elected to deprecate (with no intent to remove) and replace it with two new methods, clearly named and documented as to their purpose. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 27923a54b3ef297ca52707da1c38bebf6d9ab703..e33c751c259fe74d433991a4ac75f1e17c6655c2 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -86,6 +86,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index cf63703f5f38b1531912d413b0ac16c23627ca34..66749184ec24d15af3aaa71e79475d2a3f51c843 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -213,6 +213,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public int ping; public boolean viewingCredits; private int containerUpdateDelay; // Paper + public long loginTime; // Paper // Paper start - cancellable death event public boolean queueHealthUpdatePacket = false; - public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 79f6984a8e5bb73daeae1725a11840556c398de2..9271ac8f0f5272f1eef751443dd0e9238b55f54e 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -94,6 +94,7 @@ public abstract class PlayerList { + public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 1dfa84dfb7b62c50081ad32b012d108a0b77b83c..e4be75fd348357de05cf3710e5643d74cd1d8123 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -167,6 +167,7 @@ public abstract class PlayerList { } public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { @@ -40,7 +40,7 @@ index 79f6984a8e5bb73daeae1725a11840556c398de2..9271ac8f0f5272f1eef751443dd0e923 UserCache usercache = this.server.getUserCache(); GameProfile gameprofile1 = usercache.getProfile(gameprofile.getId()); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java -index 00333548b470435aa89fb0f4b29047eb1461e992..5770d4183c1b9ab6119a25930283c0235250ed6e 100644 +index 9b8d7b176e288fa715177196e7aff92900d8567a..1e741158bbcc0991259436bec549b32df61f0c54 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftOfflinePlayer.java @@ -244,6 +244,61 @@ public class CraftOfflinePlayer implements OfflinePlayer, ConfigurationSerializa @@ -106,7 +106,7 @@ index 00333548b470435aa89fb0f4b29047eb1461e992..5770d4183c1b9ab6119a25930283c023 public Location getBedSpawnLocation() { NBTTagCompound data = getData(); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 24f53c01d596dac2d41fd23406ebcf455a0661df..42aa3e9c00a7a536a1576841660592e3497d2c49 100644 +index 5c3b83244e77c54d3de5cf56171a88c2952fcd13..515bd5a7512774d52d1e89afb7306a1f834b537a 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -142,6 +142,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0321-Workaround-for-vehicle-tracking-issue-on-disconnect.patch b/Spigot-Server-Patches/0321-Workaround-for-vehicle-tracking-issue-on-disconnect.patch index 0a0bec7057..f6fc4fc6f1 100644 --- a/Spigot-Server-Patches/0321-Workaround-for-vehicle-tracking-issue-on-disconnect.patch +++ b/Spigot-Server-Patches/0321-Workaround-for-vehicle-tracking-issue-on-disconnect.patch @@ -4,11 +4,11 @@ Date: Mon, 7 Jan 2019 14:43:48 -0600 Subject: [PATCH] Workaround for vehicle tracking issue on disconnect -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 0c494b9c463789cd35d906afbdba5bcfffdbb28d..b1835179de7789ee98da8daa1d96c2feefab7ff6 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -1391,6 +1391,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 66749184ec24d15af3aaa71e79475d2a3f51c843..920e0d7a3339197ad10747266af737753b025ba4 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -1518,6 +1518,13 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void p() { this.ch = true; this.ejectPassengers(); diff --git a/Spigot-Server-Patches/0322-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch b/Spigot-Server-Patches/0322-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch index 968b9a8862..79adf82b5f 100644 --- a/Spigot-Server-Patches/0322-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch +++ b/Spigot-Server-Patches/0322-Fire-BlockPistonRetractEvent-for-all-empty-pistons.patch @@ -23,11 +23,11 @@ to WHY that was ever intended to be the case. Instead we opt to remove the check entirely so that the event fires for all piston types. -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index 9f56471cdd180950d279883b8da71700604a9e31..417d1a6c3dbd23905672a847939d92a953bbc91c 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -112,7 +112,7 @@ public class BlockPiston extends BlockDirectional { +diff --git a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java +index 869aaae93bc83b8271644147bb569c868ab13fb8..7de86d6232eb84642fb6423a1b0a9f30d9df9f2b 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java +@@ -141,7 +141,7 @@ public class BlockPiston extends BlockDirectional { } // CraftBukkit start @@ -36,7 +36,7 @@ index 9f56471cdd180950d279883b8da71700604a9e31..417d1a6c3dbd23905672a847939d92a9 org.bukkit.block.Block block = world.getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ()); BlockPistonRetractEvent event = new BlockPistonRetractEvent(block, ImmutableList.of(), CraftBlock.notchToBlockFace(enumdirection)); world.getServer().getPluginManager().callEvent(event); -@@ -120,7 +120,7 @@ public class BlockPiston extends BlockDirectional { +@@ -149,7 +149,7 @@ public class BlockPiston extends BlockDirectional { if (event.isCancelled()) { return; } diff --git a/Spigot-Server-Patches/0324-BlockDestroyEvent.patch b/Spigot-Server-Patches/0324-BlockDestroyEvent.patch index 29e57dba91..219cca9805 100644 --- a/Spigot-Server-Patches/0324-BlockDestroyEvent.patch +++ b/Spigot-Server-Patches/0324-BlockDestroyEvent.patch @@ -10,11 +10,11 @@ floating in the air. This can replace many uses of BlockPhysicsEvent -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index ec77151d0dde422024ae5226ad7e3fb18c08f7c0..89bb995909882a4b35e2d07e5a47739c1d4f46f2 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -500,8 +500,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index b0044d97afca1f658c193278eed542a743f20668..a8899f2ff7c71e62cdbd8eefdca0c3a9905cdc98 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -552,8 +552,20 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return false; } else { Fluid fluid = this.getFluid(blockposition); diff --git a/Spigot-Server-Patches/0325-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch b/Spigot-Server-Patches/0325-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch index 5c62ccb9a2..e98607e7c3 100644 --- a/Spigot-Server-Patches/0325-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch +++ b/Spigot-Server-Patches/0325-Fix-Custom-Shapeless-Custom-Crafting-Recipes.patch @@ -9,11 +9,11 @@ This made the Bukkit RecipeChoice API not work for Shapeless. This reimplements vanilla logic using the same test logic as Shaped -diff --git a/src/main/java/net/minecraft/server/ShapelessRecipes.java b/src/main/java/net/minecraft/server/ShapelessRecipes.java -index 821e4862429c2cef4144cdad2d7853881f383956..ecd63281912ae0ed93c5eb5ccb4249833cb23ab1 100644 ---- a/src/main/java/net/minecraft/server/ShapelessRecipes.java -+++ b/src/main/java/net/minecraft/server/ShapelessRecipes.java -@@ -64,16 +64,49 @@ public class ShapelessRecipes implements RecipeCrafting { +diff --git a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java +index 9226602691ccbf39835f2dd071f171c2375b0a16..e112d149fc3a7af7f0c9a5280c94c9b03b2aba2d 100644 +--- a/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java ++++ b/src/main/java/net/minecraft/world/item/crafting/ShapelessRecipes.java +@@ -72,16 +72,49 @@ public class ShapelessRecipes implements RecipeCrafting { AutoRecipeStackManager autorecipestackmanager = new AutoRecipeStackManager(); int i = 0; diff --git a/Spigot-Server-Patches/0326-Fix-sign-edit-memory-leak.patch b/Spigot-Server-Patches/0326-Fix-sign-edit-memory-leak.patch index 98293a2ceb..f63a89d598 100644 --- a/Spigot-Server-Patches/0326-Fix-sign-edit-memory-leak.patch +++ b/Spigot-Server-Patches/0326-Fix-sign-edit-memory-leak.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix sign edit memory leak when a player edits a sign, a reference to their Entity is never cleand up. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 188af7af384ca35f2e659dfb1f7518dd06803be3..081077c3e00d424baa8f6a293c3a911da447cb69 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2694,7 +2694,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index a2413a4e1d16b856df9f74e42eb141f72b0893c6..593609ff38b01ae35e17dd65bf101e38d080dc3a 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2838,7 +2838,7 @@ public class PlayerConnection implements PacketListenerPlayIn { TileEntitySign tileentitysign = (TileEntitySign) tileentity; @@ -18,11 +18,11 @@ index 188af7af384ca35f2e659dfb1f7518dd06803be3..081077c3e00d424baa8f6a293c3a911d PlayerConnection.LOGGER.warn("Player {} just tried to change non-editable sign", this.player.getDisplayName().getString()); this.sendPacket(tileentity.getUpdatePacket()); // CraftBukkit return; -diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 5d0c5d856a66ce6c0594b618e8f6e892585ce665..144975889a5a8dd9121b821695f6f35604bcbdb2 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -10,6 +10,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java +index ec550aaa4e7943af4ecdd2275f1f32c21edf770a..6d0fe58d7e574ce5189e1f7a8485060d60b466d9 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java +@@ -30,6 +30,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // private EntityHuman c; private final FormattedString[] g; private EnumColor color; @@ -30,7 +30,7 @@ index 5d0c5d856a66ce6c0594b618e8f6e892585ce665..144975889a5a8dd9121b821695f6f356 public TileEntitySign() { super(TileEntityTypes.SIGN); -@@ -111,7 +112,10 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +@@ -131,7 +132,10 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } public void a(EntityHuman entityhuman) { diff --git a/Spigot-Server-Patches/0327-Limit-Client-Sign-length-more.patch b/Spigot-Server-Patches/0327-Limit-Client-Sign-length-more.patch index 7917fc2617..3b6d5c751c 100644 --- a/Spigot-Server-Patches/0327-Limit-Client-Sign-length-more.patch +++ b/Spigot-Server-Patches/0327-Limit-Client-Sign-length-more.patch @@ -21,11 +21,11 @@ it only impacts data sent from the client. Set -DPaper.maxSignLength=XX to change limit or -1 to disable -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 081077c3e00d424baa8f6a293c3a911da447cb69..86572dd0d7f415a9a141785518452bf1b051e10d 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -110,6 +110,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 593609ff38b01ae35e17dd65bf101e38d080dc3a..8f442eae6519c3d0658e6ed77ecfa7aa8161a0f2 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -254,6 +254,7 @@ public class PlayerConnection implements PacketListenerPlayIn { private int E; private int receivedMovePackets; private int processedMovePackets; @@ -33,7 +33,7 @@ index 081077c3e00d424baa8f6a293c3a911da447cb69..86572dd0d7f415a9a141785518452bf1 private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit public PlayerConnection(MinecraftServer minecraftserver, NetworkManager networkmanager, EntityPlayer entityplayer) { -@@ -2704,7 +2705,17 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2848,7 +2849,17 @@ public class PlayerConnection implements PacketListenerPlayIn { List lines = new java.util.ArrayList<>(); for (int i = 0; i < list.size(); ++i) { diff --git a/Spigot-Server-Patches/0328-Don-t-check-ConvertSigns-boolean-every-sign-save.patch b/Spigot-Server-Patches/0328-Don-t-check-ConvertSigns-boolean-every-sign-save.patch index 1b28ddb851..033181274d 100644 --- a/Spigot-Server-Patches/0328-Don-t-check-ConvertSigns-boolean-every-sign-save.patch +++ b/Spigot-Server-Patches/0328-Don-t-check-ConvertSigns-boolean-every-sign-save.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Don't check ConvertSigns boolean every sign save property lookups arent super cheap. they synchronize, validate and check security managers. -diff --git a/src/main/java/net/minecraft/server/TileEntitySign.java b/src/main/java/net/minecraft/server/TileEntitySign.java -index 144975889a5a8dd9121b821695f6f35604bcbdb2..3c7847b1156a486e253a0e9f74a857e841d90619 100644 ---- a/src/main/java/net/minecraft/server/TileEntitySign.java -+++ b/src/main/java/net/minecraft/server/TileEntitySign.java -@@ -11,6 +11,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java +index 6d0fe58d7e574ce5189e1f7a8485060d60b466d9..7f78f388584899b13ff983f0dc37c679bfb1507e 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntitySign.java +@@ -31,6 +31,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // private final FormattedString[] g; private EnumColor color; public java.util.UUID signEditor; // Paper @@ -18,7 +18,7 @@ index 144975889a5a8dd9121b821695f6f35604bcbdb2..3c7847b1156a486e253a0e9f74a857e8 public TileEntitySign() { super(TileEntityTypes.SIGN); -@@ -31,7 +32,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // +@@ -51,7 +52,7 @@ public class TileEntitySign extends TileEntity implements ICommandListener { // } // CraftBukkit start diff --git a/Spigot-Server-Patches/0329-Optimize-Network-Manager-and-add-advanced-packet-sup.patch b/Spigot-Server-Patches/0329-Optimize-Network-Manager-and-add-advanced-packet-sup.patch index 7dce94fba1..8baec664a3 100644 --- a/Spigot-Server-Patches/0329-Optimize-Network-Manager-and-add-advanced-packet-sup.patch +++ b/Spigot-Server-Patches/0329-Optimize-Network-Manager-and-add-advanced-packet-sup.patch @@ -27,11 +27,11 @@ and then catch exceptions and close if they fire. Part of this commit was authored by: Spottedleaf -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a45411343affc81 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -65,6 +65,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index 2eefa21531c991ae76bf026087eb07280fbc939e..54a90c51f3090d0d2d6ea72b152829bc11d3ffbc 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -75,6 +75,10 @@ public class NetworkManager extends SimpleChannelInboundHandler> { public int protocolVersion; public java.net.InetSocketAddress virtualHost; private static boolean enableExplicitFlush = Boolean.getBoolean("paper.explicit-flush"); @@ -42,7 +42,7 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 // Paper end public NetworkManager(EnumProtocolDirection enumprotocoldirection) { -@@ -88,6 +92,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -98,6 +102,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } public void setProtocol(EnumProtocol enumprotocol) { @@ -50,7 +50,7 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 this.channel.attr(NetworkManager.c).set(enumprotocol); this.channel.config().setAutoRead(true); NetworkManager.LOGGER.debug("Enabled auto read"); -@@ -158,19 +163,84 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -168,19 +173,84 @@ public class NetworkManager extends SimpleChannelInboundHandler> { Validate.notNull(packetlistener, "packetListener", new Object[0]); this.packetListener = packetlistener; } @@ -140,7 +140,7 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 } private void dispatchPacket(Packet packet, @Nullable GenericFutureListener> genericFutureListener) { this.b(packet, genericFutureListener); } // Paper - OBFHELPER -@@ -184,51 +254,116 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -194,51 +264,116 @@ public class NetworkManager extends SimpleChannelInboundHandler> { this.channel.config().setAutoRead(false); } @@ -267,7 +267,7 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 public void a() { this.p(); -@@ -261,9 +396,21 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -271,9 +406,21 @@ public class NetworkManager extends SimpleChannelInboundHandler> { return this.socketAddress; } @@ -289,7 +289,7 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 // Spigot End if (this.channel.isOpen()) { this.channel.close(); // We can't wait as this may be called from an event loop. -@@ -331,7 +478,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -341,7 +488,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { public void handleDisconnection() { if (this.channel != null && !this.channel.isOpen()) { if (this.o) { @@ -298,7 +298,7 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 } else { this.o = true; if (this.k() != null) { -@@ -339,7 +486,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +@@ -349,7 +496,7 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } else if (this.j() != null) { this.j().a(new ChatMessage("multiplayer.disconnect.generic")); } @@ -307,18 +307,18 @@ index 511a480aa962fd2659e929bb274297db6baf437e..06d8ad7f57aa629c3c6060545a454113 // Paper start - Add PlayerConnectionCloseEvent final PacketListener packetListener = this.j(); if (packetListener instanceof PlayerConnection) { -diff --git a/src/main/java/net/minecraft/server/Packet.java b/src/main/java/net/minecraft/server/Packet.java -index 2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5..545dbe6ddcce1d172f465b4a7ab85654ee5fdbb4 100644 ---- a/src/main/java/net/minecraft/server/Packet.java -+++ b/src/main/java/net/minecraft/server/Packet.java +diff --git a/src/main/java/net/minecraft/network/protocol/Packet.java b/src/main/java/net/minecraft/network/protocol/Packet.java +index 0783b0777c8d7788bbf6780b464b709bf6dc2191..b644c91cecd8a347319dfe8c8923fd05919a9795 100644 +--- a/src/main/java/net/minecraft/network/protocol/Packet.java ++++ b/src/main/java/net/minecraft/network/protocol/Packet.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.network.protocol; +import io.netty.channel.ChannelFuture; // Paper import java.io.IOException; - - public interface Packet { -@@ -11,6 +12,20 @@ public interface Packet { + import net.minecraft.network.PacketDataSerializer; + import net.minecraft.network.PacketListener; +@@ -13,6 +14,20 @@ public interface Packet { void a(T t0); // Paper start @@ -339,10 +339,10 @@ index 2d8e6a2f4a0c3c5d74a647d7164b0028781d3bf5..545dbe6ddcce1d172f465b4a7ab85654 default boolean packetTooLarge(NetworkManager manager) { return false; } -diff --git a/src/main/java/net/minecraft/server/ServerConnection.java b/src/main/java/net/minecraft/server/ServerConnection.java -index 8fcd8f4056620713d0c02fdd9b829053ba95e851..5f4dacf9c93c2495a07df2647fe0411f796da6af 100644 ---- a/src/main/java/net/minecraft/server/ServerConnection.java -+++ b/src/main/java/net/minecraft/server/ServerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/ServerConnection.java b/src/main/java/net/minecraft/server/network/ServerConnection.java +index d992cb5cd827e0fe655809e1088939cdad9c2301..dc362724ea0cc1b2f9d9ceffff483217b4356c40 100644 +--- a/src/main/java/net/minecraft/server/network/ServerConnection.java ++++ b/src/main/java/net/minecraft/server/network/ServerConnection.java @@ -16,6 +16,7 @@ import io.netty.channel.epoll.EpollServerSocketChannel; import io.netty.channel.nio.NioEventLoopGroup; import io.netty.channel.socket.ServerSocketChannel; @@ -351,7 +351,7 @@ index 8fcd8f4056620713d0c02fdd9b829053ba95e851..5f4dacf9c93c2495a07df2647fe0411f import io.netty.handler.timeout.ReadTimeoutHandler; import java.io.IOException; import java.net.InetAddress; -@@ -41,10 +42,12 @@ public class ServerConnection { +@@ -54,10 +55,12 @@ public class ServerConnection { private final List connectedChannels = Collections.synchronizedList(Lists.newArrayList()); // Paper start - prevent blocking on adding a new network manager while the server is ticking private final java.util.Queue pending = new java.util.concurrent.ConcurrentLinkedQueue<>(); @@ -364,7 +364,7 @@ index 8fcd8f4056620713d0c02fdd9b829053ba95e851..5f4dacf9c93c2495a07df2647fe0411f } } // Paper end -@@ -79,6 +82,7 @@ public class ServerConnection { +@@ -92,6 +95,7 @@ public class ServerConnection { ; } diff --git a/Spigot-Server-Patches/0330-Handle-Oversized-Tile-Entities-in-chunks.patch b/Spigot-Server-Patches/0330-Handle-Oversized-Tile-Entities-in-chunks.patch index f30ce86df4..a4bc530fb5 100644 --- a/Spigot-Server-Patches/0330-Handle-Oversized-Tile-Entities-in-chunks.patch +++ b/Spigot-Server-Patches/0330-Handle-Oversized-Tile-Entities-in-chunks.patch @@ -8,11 +8,11 @@ creating too large of a packet to sed. Co authored by Spottedleaf -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 34e92e544f37167317d58af4242acde49e588673..5fae0ec8933cef2b87d2f465c8019af0af2e130d 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -22,7 +22,15 @@ public class PacketPlayOutMapChunk implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index 1119ee4f69a153852219b4e985e97a6b3175a8be..31a6f687a8a75b055a32a686c870d3898aae54c3 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -33,7 +33,15 @@ public class PacketPlayOutMapChunk implements Packet { private boolean h; public PacketPlayOutMapChunk() {} @@ -28,7 +28,7 @@ index 34e92e544f37167317d58af4242acde49e588673..5fae0ec8933cef2b87d2f465c8019af0 public PacketPlayOutMapChunk(Chunk chunk, int i) { ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); -@@ -49,6 +57,7 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -60,6 +68,7 @@ public class PacketPlayOutMapChunk implements Packet { this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); this.g = Lists.newArrayList(); iterator = chunk.getTileEntities().entrySet().iterator(); @@ -36,7 +36,7 @@ index 34e92e544f37167317d58af4242acde49e588673..5fae0ec8933cef2b87d2f465c8019af0 while (iterator.hasNext()) { entry = (Entry) iterator.next(); -@@ -57,6 +66,15 @@ public class PacketPlayOutMapChunk implements Packet { +@@ -68,6 +77,15 @@ public class PacketPlayOutMapChunk implements Packet { int j = blockposition.getY() >> 4; if (this.f() || (i & 1 << j) != 0) { diff --git a/Spigot-Server-Patches/0331-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch b/Spigot-Server-Patches/0331-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch index 4bc50fdc18..ebca24b23b 100644 --- a/Spigot-Server-Patches/0331-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch +++ b/Spigot-Server-Patches/0331-MC-145260-Fix-Whitelist-On-Off-inconsistency.patch @@ -10,11 +10,11 @@ everything to the Whitelist object. https://github.com/PaperMC/Paper/issues/1880 -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 9271ac8f0f5272f1eef751443dd0e9238b55f54e..5be6a3d2ed8f51cb7490183ebb14ffe41cb0728d 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -940,9 +940,9 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index e4be75fd348357de05cf3710e5643d74cd1d8123..1bbb846e2671fce67c79357f82a7fc42cc619c8a 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1015,9 +1015,9 @@ public abstract class PlayerList { } public boolean isWhitelisted(GameProfile gameprofile, org.bukkit.event.player.PlayerLoginEvent loginEvent) { boolean isOp = this.operators.d(gameprofile); diff --git a/Spigot-Server-Patches/0332-Set-Zombie-last-tick-at-start-of-drowning-process.patch b/Spigot-Server-Patches/0332-Set-Zombie-last-tick-at-start-of-drowning-process.patch index 6f199cdc9a..30e7bd3924 100644 --- a/Spigot-Server-Patches/0332-Set-Zombie-last-tick-at-start-of-drowning-process.patch +++ b/Spigot-Server-Patches/0332-Set-Zombie-last-tick-at-start-of-drowning-process.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Set Zombie last tick at start of drowning process Fixes GH-1887 -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index f2776a9f78745f1bdd270d40b00a3123628c7c9b..ab678bfa024ac3e963d5ca85a01c6df91dd6bc42 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -161,6 +161,7 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index 79d34b0296f88e5b4fe0351fe2483fc0128deabc..f406826945dd752e6528743a0c8cad3cfdfc4a95 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -223,6 +223,7 @@ public class EntityZombie extends EntityMonster { ++this.bt; if (this.bt >= 600) { this.startDrownedConversion(300); diff --git a/Spigot-Server-Patches/0333-Allow-Saving-of-Oversized-Chunks.patch b/Spigot-Server-Patches/0333-Allow-Saving-of-Oversized-Chunks.patch index 9bbd55e097..0acf5c492f 100644 --- a/Spigot-Server-Patches/0333-Allow-Saving-of-Oversized-Chunks.patch +++ b/Spigot-Server-Patches/0333-Allow-Saving-of-Oversized-Chunks.patch @@ -30,11 +30,11 @@ This fix also maintains compatability if someone switches server jars to one wit this fix, as the data will remain in the oversized file. Once the server returns to a jar with this fix, the data will be restored. -diff --git a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -index f9738fb0df2704251af0a45b56e34cc005c6ec37..6e6cabc03bc3822ee973bdafef8f4adb61b6c263 100644 ---- a/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -+++ b/src/main/java/net/minecraft/server/NBTCompressedStreamTools.java -@@ -128,6 +128,7 @@ public class NBTCompressedStreamTools { +diff --git a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java +index f792ac1639e16522695082caed754b1c2cb333b9..9da608c9dde183ad813fa5b7643314ce05c85aa5 100644 +--- a/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java ++++ b/src/main/java/net/minecraft/nbt/NBTCompressedStreamTools.java +@@ -131,6 +131,7 @@ public class NBTCompressedStreamTools { } @@ -42,7 +42,7 @@ index f9738fb0df2704251af0a45b56e34cc005c6ec37..6e6cabc03bc3822ee973bdafef8f4adb public static NBTTagCompound a(DataInput datainput) throws IOException { return a(datainput, NBTReadLimiter.a); } -@@ -148,6 +149,7 @@ public class NBTCompressedStreamTools { +@@ -151,6 +152,7 @@ public class NBTCompressedStreamTools { } } @@ -50,20 +50,20 @@ index f9738fb0df2704251af0a45b56e34cc005c6ec37..6e6cabc03bc3822ee973bdafef8f4adb public static void a(NBTTagCompound nbttagcompound, DataOutput dataoutput) throws IOException { a((NBTBase) nbttagcompound, dataoutput); } -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index be7165098fcb814d7b301a1670c33c78461d8d95..2fb4131e5972d3b554a763098709470e8a725280 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -18,6 +18,8 @@ import java.nio.file.Files; - import java.nio.file.LinkOption; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 6efbb8a3502f86e105d4dfb9cef114a790966e95..7491c09b3d8fdd27fa83d850ff097e44e1bb0eee 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -19,6 +19,8 @@ import java.nio.file.LinkOption; + import java.nio.file.Path; import java.nio.file.StandardCopyOption; import java.nio.file.StandardOpenOption; +import java.util.zip.InflaterInputStream; // Paper + import javax.annotation.Nullable; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -34,6 +36,7 @@ public class RegionFile implements AutoCloseable { + import net.minecraft.SystemUtils; + import net.minecraft.world.level.ChunkCoordIntPair; +@@ -37,6 +39,7 @@ public class RegionFile implements AutoCloseable { private final IntBuffer i; @VisibleForTesting protected final RegionFileBitSet freeSectors; @@ -71,16 +71,16 @@ index be7165098fcb814d7b301a1670c33c78461d8d95..2fb4131e5972d3b554a763098709470e public RegionFile(File file, File file1, boolean flag) throws IOException { this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag); -@@ -41,6 +44,8 @@ public class RegionFile implements AutoCloseable { +@@ -44,6 +47,8 @@ public class RegionFile implements AutoCloseable { - public RegionFile(java.nio.file.Path java_nio_file_path, java.nio.file.Path java_nio_file_path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException { + public RegionFile(Path path, Path path1, RegionFileCompression regionfilecompression, boolean flag) throws IOException { this.g = ByteBuffer.allocateDirect(8192); + this.file = java_nio_file_path.toFile(); // Paper + initOversizedState(); // Paper this.freeSectors = new RegionFileBitSet(); this.f = regionfilecompression; - if (!Files.isDirectory(java_nio_file_path1, new LinkOption[0])) { -@@ -404,6 +409,74 @@ public class RegionFile implements AutoCloseable { + if (!Files.isDirectory(path1, new LinkOption[0])) { +@@ -407,6 +412,74 @@ public class RegionFile implements AutoCloseable { void run() throws IOException; } @@ -155,11 +155,11 @@ index be7165098fcb814d7b301a1670c33c78461d8d95..2fb4131e5972d3b554a763098709470e class ChunkBuffer extends ByteArrayOutputStream { private final ChunkCoordIntPair b; -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 6be04e230fe96c1f2345a00de4f648d9eb712a82..de926992e20da3ec433f9c7b4bc73805fd9d36ab 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -45,6 +45,74 @@ public final class RegionFileCache implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +index 13d0d6e7e03322f20ef5666d5299d26d51d1714c..571b34cd30bb76dcfac928e29a1cafd5824d4772 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +@@ -49,6 +49,74 @@ public final class RegionFileCache implements AutoCloseable { } } @@ -234,7 +234,7 @@ index 6be04e230fe96c1f2345a00de4f648d9eb712a82..de926992e20da3ec433f9c7b4bc73805 @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing -@@ -54,6 +122,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -58,6 +126,12 @@ public final class RegionFileCache implements AutoCloseable { } // CraftBukkit end DataInputStream datainputstream = regionfile.a(chunkcoordintpair); @@ -247,7 +247,7 @@ index 6be04e230fe96c1f2345a00de4f648d9eb712a82..de926992e20da3ec433f9c7b4bc73805 Throwable throwable = null; NBTTagCompound nbttagcompound; -@@ -94,6 +168,7 @@ public final class RegionFileCache implements AutoCloseable { +@@ -98,6 +172,7 @@ public final class RegionFileCache implements AutoCloseable { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); diff --git a/Spigot-Server-Patches/0334-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/Spigot-Server-Patches/0334-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 2b40e01dcd..e10e865a33 100644 --- a/Spigot-Server-Patches/0334-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/Spigot-Server-Patches/0334-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -4,11 +4,11 @@ Date: Wed, 13 Mar 2019 20:08:09 +0200 Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 5be6a3d2ed8f51cb7490183ebb14ffe41cb0728d..fbb2ba9c9f3c63a9dfd242a4ae72ec609cbe9609 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1058,6 +1058,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 1bbb846e2671fce67c79357f82a7fc42cc619c8a..587fb2246b1ede6d292afe42b826e32423ca3a56 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1133,6 +1133,7 @@ public abstract class PlayerList { } public void setHasWhitelist(boolean flag) { diff --git a/Spigot-Server-Patches/0335-Add-LivingEntity-getTargetEntity.patch b/Spigot-Server-Patches/0335-Add-LivingEntity-getTargetEntity.patch index 8075d015c6..485ac99ccb 100644 --- a/Spigot-Server-Patches/0335-Add-LivingEntity-getTargetEntity.patch +++ b/Spigot-Server-Patches/0335-Add-LivingEntity-getTargetEntity.patch @@ -4,52 +4,11 @@ Date: Sat, 22 Sep 2018 00:33:08 -0500 Subject: [PATCH] Add LivingEntity#getTargetEntity -diff --git a/src/main/java/net/minecraft/server/AxisAlignedBB.java b/src/main/java/net/minecraft/server/AxisAlignedBB.java -index 02c09f39848399a86d46bd17569b4f01a7b5ab1f..ed9b2f9adfecdc6d1b9925579ec510657adde11f 100644 ---- a/src/main/java/net/minecraft/server/AxisAlignedBB.java -+++ b/src/main/java/net/minecraft/server/AxisAlignedBB.java -@@ -112,6 +112,7 @@ public class AxisAlignedBB { - return this.b(vec3d.x, vec3d.y, vec3d.z); - } - -+ public final AxisAlignedBB expand(double x, double y, double z) { return b(x, y, z); } // Paper - OBFHELPER - public AxisAlignedBB b(double d0, double d1, double d2) { - double d3 = this.minX; - double d4 = this.minY; -@@ -141,6 +142,12 @@ public class AxisAlignedBB { - return new AxisAlignedBB(d3, d4, d5, d6, d7, d8); - } - -+ // Paper start -+ public AxisAlignedBB grow(double d0) { -+ return grow(d0, d0, d0); -+ } -+ // Paper end -+ - public AxisAlignedBB grow(double d0, double d1, double d2) { - double d3 = this.minX - d0; - double d4 = this.minY - d1; -@@ -200,6 +207,7 @@ public class AxisAlignedBB { - return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; - } - -+ public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER - public boolean d(Vec3D vec3d) { - return this.e(vec3d.x, vec3d.y, vec3d.z); - } -@@ -233,6 +241,7 @@ public class AxisAlignedBB { - return this.g(-d0); - } - -+ public final Optional calculateIntercept(Vec3D vec3d, Vec3D vec3d1) { return b(vec3d, vec3d1); } // Paper - OBFHELPER - public Optional b(Vec3D vec3d, Vec3D vec3d1) { - double[] adouble = new double[]{1.0D}; - double d0 = vec3d1.x - vec3d.x; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 031dcd2092800118d4cb12c8bb92b51ccf1bbd27..8827ccfc77284020496046e755b3639de75c5903 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1418,6 +1418,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index dca0bab93b5a1460c4741b0517b41490eb62703e..6f4dd6226a23323c1af95380a8d38ee6d19caf60 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1503,6 +1503,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.c(f - 90.0F, f1); } @@ -57,7 +16,7 @@ index 031dcd2092800118d4cb12c8bb92b51ccf1bbd27..8827ccfc77284020496046e755b3639d public final Vec3D j(float f) { if (f == 1.0F) { return new Vec3D(this.locX(), this.getHeadY(), this.locZ()); -@@ -2063,6 +2064,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2148,6 +2149,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.getPassengers().size() < 1; } @@ -65,11 +24,11 @@ index 031dcd2092800118d4cb12c8bb92b51ccf1bbd27..8827ccfc77284020496046e755b3639d public float bg() { return 0.0F; } -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index cade819fe5f7b23b2f4ada721b33ae74516ef8fc..870aa56735bae3344d7d01d252b943225cc056c4 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3544,6 +3544,37 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 58270f45de665b5c1cfd9fc548eadb263ad230e9..8a0d125bc1cf3a75141a286f0c9fb553827e556f 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3637,6 +3637,37 @@ public abstract class EntityLiving extends Entity { return world.rayTrace(raytrace); } @@ -107,11 +66,11 @@ index cade819fe5f7b23b2f4ada721b33ae74516ef8fc..870aa56735bae3344d7d01d252b94322 public int shieldBlockingDelay = world.paperConfig.shieldBlockingDelay; public int getShieldBlockingDelay() { -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 863f4464c688912b3e0ce61cbbbf263e38a3af4b..3d54b7a4bf102dfc568e782706f67e4b5269eaf1 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -17,6 +17,7 @@ public final class IEntitySelector { +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +index 4776a47566aac487dc77fd6b4b9b42b95974e31a..cb5cda5e6497edeb801ef712f9bd8823cb055750 100644 +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -22,6 +22,7 @@ public final class IEntitySelector { public static final Predicate e = (entity) -> { return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative(); }; @@ -119,8 +78,49 @@ index 863f4464c688912b3e0ce61cbbbf263e38a3af4b..3d54b7a4bf102dfc568e782706f67e4b public static final Predicate f = (entity) -> { return !(entity instanceof EntityHuman) || !entity.isSpectator() && !((EntityHuman) entity).isCreative() && entity.world.getDifficulty() != EnumDifficulty.PEACEFUL; }; +diff --git a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +index 3941dd33da4b5c09d0087143f1d8a2d76fc18792..62513c812b497bb9d8dafe1d9c2f574059aebf15 100644 +--- a/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java ++++ b/src/main/java/net/minecraft/world/phys/AxisAlignedBB.java +@@ -116,6 +116,7 @@ public class AxisAlignedBB { + return this.b(vec3d.x, vec3d.y, vec3d.z); + } + ++ public final AxisAlignedBB expand(double x, double y, double z) { return b(x, y, z); } // Paper - OBFHELPER + public AxisAlignedBB b(double d0, double d1, double d2) { + double d3 = this.minX; + double d4 = this.minY; +@@ -145,6 +146,12 @@ public class AxisAlignedBB { + return new AxisAlignedBB(d3, d4, d5, d6, d7, d8); + } + ++ // Paper start ++ public AxisAlignedBB grow(double d0) { ++ return grow(d0, d0, d0); ++ } ++ // Paper end ++ + public AxisAlignedBB grow(double d0, double d1, double d2) { + double d3 = this.minX - d0; + double d4 = this.minY - d1; +@@ -204,6 +211,7 @@ public class AxisAlignedBB { + return this.minX < d3 && this.maxX > d0 && this.minY < d4 && this.maxY > d1 && this.minZ < d5 && this.maxZ > d2; + } + ++ public final boolean contains(Vec3D vec3d) { return d(vec3d); } // Paper - OBFHELPER + public boolean d(Vec3D vec3d) { + return this.e(vec3d.x, vec3d.y, vec3d.z); + } +@@ -237,6 +245,7 @@ public class AxisAlignedBB { + return this.g(-d0); + } + ++ public final Optional calculateIntercept(Vec3D vec3d, Vec3D vec3d1) { return b(vec3d, vec3d1); } // Paper - OBFHELPER + public Optional b(Vec3D vec3d, Vec3D vec3d1) { + double[] adouble = new double[]{1.0D}; + double d0 = vec3d1.x - vec3d.x; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 3ec331f51bb305a82d2a12423c28d1f2e8ab8365..2fccc6a8a3dcf96e8ec714c2f7fa2f62af60cb76 100644 +index a60a12a7705be29b6f318c587e1c6149b89d86c3..aa08ca83a105627b7e257ac664c29d899b557e9e 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -221,6 +221,33 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0336-Use-proper-max-length-when-serialising-BungeeCord-te.patch b/Spigot-Server-Patches/0336-Use-proper-max-length-when-serialising-BungeeCord-te.patch index ccd312c668..b46ce70f11 100644 --- a/Spigot-Server-Patches/0336-Use-proper-max-length-when-serialising-BungeeCord-te.patch +++ b/Spigot-Server-Patches/0336-Use-proper-max-length-when-serialising-BungeeCord-te.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Use proper max length when serialising BungeeCord text component -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutChat.java b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -index b9cb21c5eb6f4a0318c3c63ec66f88b1750782ac..18528c792ae12bd8753e8529f4b73b76407e67dc 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutChat.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutChat.java -@@ -4,7 +4,7 @@ import java.io.IOException; - import java.util.UUID; +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +index c47427fd2eed173726cb856aae62c02a2b46bbf0..d4cf5536883192c49636177cb782a9a2f514cd87 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +@@ -8,7 +8,7 @@ import net.minecraft.network.chat.IChatBaseComponent; + import net.minecraft.network.protocol.Packet; public class PacketPlayOutChat implements Packet { - @@ -18,7 +18,7 @@ index b9cb21c5eb6f4a0318c3c63ec66f88b1750782ac..18528c792ae12bd8753e8529f4b73b76 private IChatBaseComponent a; public net.kyori.adventure.text.Component adventure$message; // Paper public net.md_5.bungee.api.chat.BaseComponent[] components; // Spigot -@@ -38,9 +38,9 @@ public class PacketPlayOutChat implements Packet { +@@ -42,9 +42,9 @@ public class PacketPlayOutChat implements Packet { //packetdataserializer.a(net.md_5.bungee.chat.ComponentSerializer.toString(components)); // Paper - comment, replaced with below // Paper start - don't nest if we don't need to so that we can preserve formatting if (this.components.length == 1) { diff --git a/Spigot-Server-Patches/0337-Entity-getEntitySpawnReason.patch b/Spigot-Server-Patches/0337-Entity-getEntitySpawnReason.patch index 9f2cce1fbf..a90b4332a8 100644 --- a/Spigot-Server-Patches/0337-Entity-getEntitySpawnReason.patch +++ b/Spigot-Server-Patches/0337-Entity-getEntitySpawnReason.patch @@ -9,11 +9,36 @@ Pre existing entities will return NATURAL if it was a non persistenting Living Entity, SPAWNER for spawners, or DEFAULT since data was not stored. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 00c57501f80fd0988573b36cd7e75a343c7e8e6e..1dbeda9fb385be29b3bb20c33a0487334c6e7c16 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -72,6 +72,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 690e40aeed96a8d83e86c9aff0e910f6aa97c1c9..2a510940525fda83707e2a587e18ce34e5822af1 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1039,6 +1039,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 ++ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper + // Paper start + if (entity.valid) { + MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 587fb2246b1ede6d292afe42b826e32423ca3a56..59155d9b39ed6b27dd46ea586ab07360840db5e7 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -333,7 +333,7 @@ public abstract class PlayerList { + // CraftBukkit start + WorldServer finalWorldServer = worldserver1; + Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { +- return !finalWorldServer.addEntitySerialized(entity1) ? null : entity1; ++ return !finalWorldServer.addEntitySerialized(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper + // CraftBukkit end + }); + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 6f4dd6226a23323c1af95380a8d38ee6d19caf60..f024db3fe2a9fb9af536fe144b9e871712ae327a 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -157,6 +157,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } }; List entitySlice = null; @@ -21,7 +46,7 @@ index 00c57501f80fd0988573b36cd7e75a343c7e8e6e..1dbeda9fb385be29b3bb20c33a048733 // Paper end public com.destroystokyo.paper.loottable.PaperLootableInventoryData lootableData; // Paper -@@ -1587,6 +1588,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1672,6 +1673,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (this.origin != null) { nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ())); } @@ -31,7 +56,7 @@ index 00c57501f80fd0988573b36cd7e75a343c7e8e6e..1dbeda9fb385be29b3bb20c33a048733 // Save entity's from mob spawner status if (spawnedViaMobSpawner) { nbttagcompound.setBoolean("Paper.FromMobSpawner", true); -@@ -1721,6 +1725,26 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1806,6 +1810,26 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -58,11 +83,11 @@ index 00c57501f80fd0988573b36cd7e75a343c7e8e6e..1dbeda9fb385be29b3bb20c33a048733 // Paper end } catch (Throwable throwable) { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index 1aecc84479b00a019a5b68f5e726d1c2965ae0f7..c3a5db97fd85b31c6b4bce93527b9d0e16a79a45 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -165,6 +165,7 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index 0a23fc173cca32b9e910e6c8c638b0b51a94cac2..ca753267a06643b6f7224140950aa7f47cea64ad 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -182,6 +182,7 @@ public abstract class MobSpawnerAbstract { // Spigot End } entity.spawnedViaMobSpawner = true; // Paper @@ -70,36 +95,11 @@ index 1aecc84479b00a019a5b68f5e726d1c2965ae0f7..c3a5db97fd85b31c6b4bce93527b9d0e flag = true; // Paper // Spigot Start if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index fbb2ba9c9f3c63a9dfd242a4ae72ec609cbe9609..4d8c2ea8e067b81348d59a6d5c4c6c9ec3fbf929 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -258,7 +258,7 @@ public abstract class PlayerList { - // CraftBukkit start - WorldServer finalWorldServer = worldserver1; - Entity entity = EntityTypes.a(nbttagcompound1.getCompound("Entity"), finalWorldServer, (entity1) -> { -- return !finalWorldServer.addEntitySerialized(entity1) ? null : entity1; -+ return !finalWorldServer.addEntitySerialized(entity1, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.MOUNT) ? null : entity1; // Paper - // CraftBukkit end - }); - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f9d2228fb0543c60d2e0848afb4f927b6a7bce51..47229f73ede76176f884deb9ec623a684d6e81cd 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -930,6 +930,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 -+ if (entity.spawnReason == null) entity.spawnReason = spawnReason; // Paper - // Paper start - if (entity.valid) { - MinecraftServer.LOGGER.error("Attempted Double World add on " + entity, new Throwable()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 91b9d82ec83876438d5c8c199313027bf942e89f..d3d0f432da363414f8bbe5c62ac4ecadaf2ad0e4 100644 +index 3642b17cafffd2818ee7a18d26bc25645f596115..93bbf63e9d38f32d5528c7693633d4b65655bb9d 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1107,5 +1107,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1106,5 +1106,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public boolean fromMobSpawner() { return getHandle().spawnedViaMobSpawner; } diff --git a/Spigot-Server-Patches/0338-Update-entity-Metadata-for-all-tracked-players.patch b/Spigot-Server-Patches/0338-Update-entity-Metadata-for-all-tracked-players.patch index 900d65c368..47706b2104 100644 --- a/Spigot-Server-Patches/0338-Update-entity-Metadata-for-all-tracked-players.patch +++ b/Spigot-Server-Patches/0338-Update-entity-Metadata-for-all-tracked-players.patch @@ -4,11 +4,11 @@ Date: Fri, 22 Mar 2019 22:24:03 -0700 Subject: [PATCH] Update entity Metadata for all tracked players -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index c346ca8ba30da401ea1a421e8ce6ed1d5b6e4c13..d89d53e9990918fb9863a7eed3111ef026c95386 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -393,6 +393,12 @@ public class EntityTrackerEntry { +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index 44b79c97d5cc7570683e1b7f025b4f3ad65beb81..bcc1103e21cc10d5b405a2b89f3dfe78eda271bd 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -422,6 +422,12 @@ public class EntityTrackerEntry { return PacketPlayOutEntity.a(this.xLoc, this.yLoc, this.zLoc); } @@ -21,15 +21,15 @@ index c346ca8ba30da401ea1a421e8ce6ed1d5b6e4c13..d89d53e9990918fb9863a7eed3111ef0 private void broadcastIncludingSelf(Packet packet) { this.f.accept(packet); if (this.tracker instanceof EntityPlayer) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index fb98cfecbcf4c7773cd9fde37a6614ced107e07a..95c5f956055d43ee0aeb291ad8f66cadf7a6d507 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2141,7 +2141,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 8f442eae6519c3d0658e6ed77ecfa7aa8161a0f2..b207f4056a274d4115e96d88def3eea7fdf6c0d4 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2285,7 +2285,14 @@ public class PlayerConnection implements PacketListenerPlayIn { if (event.isCancelled() || this.player.inventory.getItemInHand() == null || this.player.inventory.getItemInHand().getItem() != origItem) { // Refresh the current entity metadata -- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true)); +- this.sendPacket(new PacketPlayOutEntityMetadata(entity.getId(), entity.getDataWatcher(), true)); + // Paper start - update entity for all players + PacketPlayOutEntityMetadata packet = new PacketPlayOutEntityMetadata(entity.getId(), entity.datawatcher, true); + if (entity.tracker != null) { diff --git a/Spigot-Server-Patches/0339-Implement-PlayerPostRespawnEvent.patch b/Spigot-Server-Patches/0339-Implement-PlayerPostRespawnEvent.patch index a4d7c7b7ed..c8912abcdd 100644 --- a/Spigot-Server-Patches/0339-Implement-PlayerPostRespawnEvent.patch +++ b/Spigot-Server-Patches/0339-Implement-PlayerPostRespawnEvent.patch @@ -4,11 +4,11 @@ Date: Fri, 26 Oct 2018 21:31:00 -0700 Subject: [PATCH] Implement PlayerPostRespawnEvent -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 4d8c2ea8e067b81348d59a6d5c4c6c9ec3fbf929..10d03c4d2c31b47d2964bd9c6af7ce8e5aa74393 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -664,9 +664,14 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 59155d9b39ed6b27dd46ea586ab07360840db5e7..85bb7fc6d4b65ffb2923d5a6776ebe7a89605024 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -739,9 +739,14 @@ public abstract class PlayerList { // this.a(entityplayer1, entityplayer, worldserver1); // CraftBukkit - removed boolean flag2 = false; @@ -24,7 +24,7 @@ index 4d8c2ea8e067b81348d59a6d5c4c6c9ec3fbf929..10d03c4d2c31b47d2964bd9c6af7ce8e WorldServer worldserver1 = this.server.getWorldServer(entityplayer.getSpawnDimension()); if (worldserver1 != null) { Optional optional; -@@ -717,6 +722,7 @@ public abstract class PlayerList { +@@ -792,6 +797,7 @@ public abstract class PlayerList { location = respawnEvent.getRespawnLocation(); if (!flag) entityplayer.reset(); // SPIGOT-4785 @@ -32,7 +32,7 @@ index 4d8c2ea8e067b81348d59a6d5c4c6c9ec3fbf929..10d03c4d2c31b47d2964bd9c6af7ce8e } else { location.setWorld(worldserver.getWorld()); } -@@ -774,6 +780,13 @@ public abstract class PlayerList { +@@ -849,6 +855,13 @@ public abstract class PlayerList { if (entityplayer.playerConnection.isDisconnected()) { this.savePlayerFile(entityplayer); } diff --git a/Spigot-Server-Patches/0340-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch b/Spigot-Server-Patches/0340-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch index 9361bc9644..f77a4f7db2 100644 --- a/Spigot-Server-Patches/0340-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch +++ b/Spigot-Server-Patches/0340-don-t-go-below-0-for-pickupDelay-breaks-picking-up-i.patch @@ -5,11 +5,11 @@ Subject: [PATCH] don't go below 0 for pickupDelay, breaks picking up items vanilla checks for == 0 -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 3ba7bd0461d1c58c235cf0cda8d4eecf36b57407..001ddbe669c8c1a534a4e023386c00085ee1af95 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -61,6 +61,7 @@ public class EntityItem extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 4cfe3475fa913cd46116f13ea8ed9caf5372a41a..02e4d6891adc902f73ed349f15dae3a429bd283a 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -87,6 +87,7 @@ public class EntityItem extends Entity { // CraftBukkit start - Use wall time for pickup and despawn timers int elapsedTicks = MinecraftServer.currentTick - this.lastTick; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; @@ -17,7 +17,7 @@ index 3ba7bd0461d1c58c235cf0cda8d4eecf36b57407..001ddbe669c8c1a534a4e023386c0008 if (this.age != -32768) this.age += elapsedTicks; this.lastTick = MinecraftServer.currentTick; // CraftBukkit end -@@ -153,6 +154,7 @@ public class EntityItem extends Entity { +@@ -179,6 +180,7 @@ public class EntityItem extends Entity { // CraftBukkit start - Use wall time for pickup and despawn timers int elapsedTicks = MinecraftServer.currentTick - this.lastTick; if (this.pickupDelay != 32767) this.pickupDelay -= elapsedTicks; diff --git a/Spigot-Server-Patches/0341-Server-Tick-Events.patch b/Spigot-Server-Patches/0341-Server-Tick-Events.patch index d2daf0fdd8..64b1af2884 100644 --- a/Spigot-Server-Patches/0341-Server-Tick-Events.patch +++ b/Spigot-Server-Patches/0341-Server-Tick-Events.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Server Tick Events Fires event at start and end of a server tick diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index cf950c123151cea0f63fbc46c0c1b339c59c02b1..57f05599e64cb819e03c68e764934c9c306dabfb 100644 +index 3ce1204184656d7500509f8600cec0a4b6089a3f..c864749646d26199e4c938f1fa6bbee4a3b942dd 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1120,6 +1120,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= -30000000 && j >= -30000000 && i < 30000000 && j < 30000000) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 523f094b5d4572a04da36d68502fa0a22f239e61..3757ab5a2a0c6282d822c22415cc2861eba2f236 100644 +index 317d08c49b980f8785d0d098c993e2ac03200e14..ed5f6ec979a2f1124c2fbb37c3be1d42994dc4da 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -343,6 +343,29 @@ public class CraftWorld implements World { diff --git a/Spigot-Server-Patches/0345-Mob-Spawner-API-Enhancements.patch b/Spigot-Server-Patches/0345-Mob-Spawner-API-Enhancements.patch index 28e3ade1d8..ff42c8619f 100644 --- a/Spigot-Server-Patches/0345-Mob-Spawner-API-Enhancements.patch +++ b/Spigot-Server-Patches/0345-Mob-Spawner-API-Enhancements.patch @@ -4,11 +4,11 @@ Date: Fri, 19 Apr 2019 12:41:13 -0500 Subject: [PATCH] Mob Spawner API Enhancements -diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -index c3a5db97fd85b31c6b4bce93527b9d0e16a79a45..c2e830db7aa2944a477624e149a3ba66d112b68a 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java -@@ -47,6 +47,7 @@ public abstract class MobSpawnerAbstract { +diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +index ca753267a06643b6f7224140950aa7f47cea64ad..bd4c7dbfad80b65c1350e93bb8303bf145dc99c1 100644 +--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java +@@ -64,6 +64,7 @@ public abstract class MobSpawnerAbstract { this.mobs.clear(); // CraftBukkit - SPIGOT-3496, MC-92282 } @@ -16,7 +16,7 @@ index c3a5db97fd85b31c6b4bce93527b9d0e16a79a45..c2e830db7aa2944a477624e149a3ba66 private boolean h() { BlockPosition blockposition = this.b(); -@@ -203,6 +204,7 @@ public abstract class MobSpawnerAbstract { +@@ -220,6 +221,7 @@ public abstract class MobSpawnerAbstract { } } @@ -24,7 +24,7 @@ index c3a5db97fd85b31c6b4bce93527b9d0e16a79a45..c2e830db7aa2944a477624e149a3ba66 private void i() { if (this.maxSpawnDelay <= this.minSpawnDelay) { this.spawnDelay = this.minSpawnDelay; -@@ -220,7 +222,13 @@ public abstract class MobSpawnerAbstract { +@@ -237,7 +239,13 @@ public abstract class MobSpawnerAbstract { } public void a(NBTTagCompound nbttagcompound) { @@ -38,7 +38,7 @@ index c3a5db97fd85b31c6b4bce93527b9d0e16a79a45..c2e830db7aa2944a477624e149a3ba66 this.mobs.clear(); if (nbttagcompound.hasKeyOfType("SpawnPotentials", 9)) { NBTTagList nbttaglist = nbttagcompound.getList("SpawnPotentials", 10); -@@ -235,10 +243,15 @@ public abstract class MobSpawnerAbstract { +@@ -252,10 +260,15 @@ public abstract class MobSpawnerAbstract { } else if (!this.mobs.isEmpty()) { this.setSpawnData((MobSpawnerData) WeightedRandom.a(this.a().random, this.mobs)); } @@ -57,7 +57,7 @@ index c3a5db97fd85b31c6b4bce93527b9d0e16a79a45..c2e830db7aa2944a477624e149a3ba66 this.spawnCount = nbttagcompound.getShort("SpawnCount"); } -@@ -263,9 +276,20 @@ public abstract class MobSpawnerAbstract { +@@ -280,9 +293,20 @@ public abstract class MobSpawnerAbstract { if (minecraftkey == null) { return nbttagcompound; } else { @@ -82,7 +82,7 @@ index c3a5db97fd85b31c6b4bce93527b9d0e16a79a45..c2e830db7aa2944a477624e149a3ba66 nbttagcompound.setShort("MaxNearbyEntities", (short) this.maxNearbyEntities); nbttagcompound.setShort("RequiredPlayerRange", (short) this.requiredPlayerRange); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java -index 5c4c3c70c7450a3e556d664a1bf6bcaf8e3a571c..0bf61322031734039115a93ead841d089ad134b9 100644 +index 28295ebd338806a35cbef164cb014abfe7dae769..e1a6048899e82184ac1a2d3480b65e6d0df163ad 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftCreatureSpawner.java @@ -8,6 +8,14 @@ import org.bukkit.Material; diff --git a/Spigot-Server-Patches/0346-Per-Player-View-Distance-API-placeholders.patch b/Spigot-Server-Patches/0346-Per-Player-View-Distance-API-placeholders.patch index aa7584e5f9..b09ce7ebb4 100644 --- a/Spigot-Server-Patches/0346-Per-Player-View-Distance-API-placeholders.patch +++ b/Spigot-Server-Patches/0346-Per-Player-View-Distance-API-placeholders.patch @@ -6,28 +6,28 @@ Subject: [PATCH] Per-Player View Distance API placeholders I hope to look at this more in-depth soon. It appears doable. However this should not block the update. -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 90a3d3711f71209b7db89d2515377ed1818c3c83..a545a620486c7ffd9a15d903270a5091e1cacb97 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -576,9 +576,10 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +index 51993191e01f55e16667c25b8b57d6a6ddaf493b..5168a40eb53565bb3028efe559601acf72bddae5 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -625,9 +625,10 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (this.deathAnimationTicks == 1 && !this.isSilent()) { // CraftBukkit start - Use relative location for far away sounds // this.world.b(1028, this.getChunkCoordinates(), 0); - //int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API + int viewDistance = ((WorldServer) this.world).getServer().getViewDistance() * 16; // Paper - updated to use worlds actual view distance incase we have to uncomment this due to removal of player view distance API - for (EntityPlayer player : (List) ((WorldServer)world).getPlayers()) { + for (net.minecraft.server.level.EntityPlayer player : (List) ((WorldServer)world).getPlayers()) { - final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + // final int viewDistance = player.getViewDistance(); // TODO apply view distance api patch + // Paper end double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index ad5a7cbe83fb61b79203369895e82edca2ffcb72..06cf8ca80c314b7c236984c7f6236533ae7bb4a2 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -208,9 +208,9 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +index 145767e8b0fc4105a0afa47af17dcdbb75e952bc..174eb12722872182b2d9b54841e5bb57893695a1 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +@@ -258,9 +258,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); @@ -40,7 +40,7 @@ index ad5a7cbe83fb61b79203369895e82edca2ffcb72..06cf8ca80c314b7c236984c7f6236533 double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index fffe522058144da31149e59a06263914865983ec..24cdf63dfdc222edb9677dbf62f1761a138b2a83 100644 +index 0b01a688617a198f510738e783546f1c72240151..3b7be01513f9851b50585fca2e7e2f21e03ca253 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2235,6 +2235,16 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0347-Fix-CB-call-to-changed-postToMainThread-method.patch b/Spigot-Server-Patches/0347-Fix-CB-call-to-changed-postToMainThread-method.patch index 7c88ec6aa5..870846c942 100644 --- a/Spigot-Server-Patches/0347-Fix-CB-call-to-changed-postToMainThread-method.patch +++ b/Spigot-Server-Patches/0347-Fix-CB-call-to-changed-postToMainThread-method.patch @@ -4,11 +4,11 @@ Date: Fri, 10 May 2019 18:38:19 +0100 Subject: [PATCH] Fix CB call to changed postToMainThread method -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 33a99669e5f9d85e150a7a3841a5e7da24142184..9886ccda757a150d00c914a017ddd7a43167a6bd 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -299,7 +299,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index b207f4056a274d4115e96d88def3eea7fdf6c0d4..1cfa8a4066baaf86f10e3f709d9b1d60aba4dec5 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -443,7 +443,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.networkManager.getClass(); // CraftBukkit - Don't wait diff --git a/Spigot-Server-Patches/0348-Fix-sounds-when-item-frames-are-modified-MC-123450.patch b/Spigot-Server-Patches/0348-Fix-sounds-when-item-frames-are-modified-MC-123450.patch index 21ccf4d848..f14e3f7905 100644 --- a/Spigot-Server-Patches/0348-Fix-sounds-when-item-frames-are-modified-MC-123450.patch +++ b/Spigot-Server-Patches/0348-Fix-sounds-when-item-frames-are-modified-MC-123450.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix sounds when item frames are modified (MC-123450) This also fixes the adding sound playing when the item frame direction is changed. -diff --git a/src/main/java/net/minecraft/server/EntityItemFrame.java b/src/main/java/net/minecraft/server/EntityItemFrame.java -index 2b42906388f8c5b9bb2efeff5ec4d02d19d01f09..8a95e698d5caa3730954ce1135b0ec37a389dd70 100644 ---- a/src/main/java/net/minecraft/server/EntityItemFrame.java -+++ b/src/main/java/net/minecraft/server/EntityItemFrame.java -@@ -247,7 +247,7 @@ public class EntityItemFrame extends EntityHanging { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java b/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java +index 584f64946821092afab57b9409bc249403bc16e7..43152a6c70c9433d627a58051101530ddd693307 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityItemFrame.java +@@ -277,7 +277,7 @@ public class EntityItemFrame extends EntityHanging { } this.getDataWatcher().set(EntityItemFrame.ITEM, itemstack); @@ -19,7 +19,7 @@ index 2b42906388f8c5b9bb2efeff5ec4d02d19d01f09..8a95e698d5caa3730954ce1135b0ec37 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java -index 4452204684bc510d84834a7a0e5bbde51d3d262e..65f087828d00404b11211895c6fcb0297d45c1ba 100644 +index 86bb26cd1d327056a64926ed6fc53142ad3756c2..cbdbb89ec28f9b6c3a0eb31be94c440254c6e266 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftItemFrame.java @@ -50,7 +50,7 @@ public class CraftItemFrame extends CraftHanging implements ItemFrame { diff --git a/Spigot-Server-Patches/0349-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch b/Spigot-Server-Patches/0349-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch index 0c45122cef..1fc9de6cb1 100644 --- a/Spigot-Server-Patches/0349-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch +++ b/Spigot-Server-Patches/0349-Fix-CraftServer-isPrimaryThread-and-MinecraftServer-.patch @@ -16,10 +16,10 @@ handling that should have been handled synchronously will be handled synchronously when the server gets shut down. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 57f05599e64cb819e03c68e764934c9c306dabfb..6d87fa38c5a84d5befcadf536413b1212bd1b604 100644 +index c864749646d26199e4c938f1fa6bbee4a3b942dd..00dbb5382aa6efec0038a45049716cd44c1f4c79 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2073,7 +2073,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> a(PlayerChunk playerchunk) { ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); CompletableFuture, PlayerChunk.Failure>> completablefuture = this.a(chunkcoordintpair, 1, (i) -> { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 676d160fe5132177a7d91cbf514a386607826964..628d1a5555ec70571c0467900c884cc419cbab37 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index b8f0ea863b89bf9ddeef8104d09fe7f00b91f711..a6f3f773a2fbbf98f9ef1eb03a6b392fb9082d25 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java @@ -4,6 +4,8 @@ import com.google.common.annotations.VisibleForTesting; import com.google.common.collect.Iterables; import co.aikar.timings.TimingHistory; // Paper @@ -209,7 +185,7 @@ index 676d160fe5132177a7d91cbf514a386607826964..628d1a5555ec70571c0467900c884cc4 import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Queues; -@@ -997,7 +999,22 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1106,7 +1108,22 @@ public class WorldServer extends World implements GeneratorAccessSeed { if (entity1 == null) { return false; } else { @@ -232,3 +208,27 @@ index 676d160fe5132177a7d91cbf514a386607826964..628d1a5555ec70571c0467900c884cc4 return true; } } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index f024db3fe2a9fb9af536fe144b9e871712ae327a..abfda88ab1d0353bbb14ae99dea212941ab2e899 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2796,6 +2796,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + }); + } + ++ public final void setUUID(UUID uuid) { a_(uuid); } // Paper - OBFHELPER + public void a_(UUID uuid) { + this.uniqueID = uuid; + this.ae = this.uniqueID.toString(); +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 246a4b69e1b4ee6affa9564d50f261fac2f269d0..5539ee8552c4bcfa718a63dbd4c25bd232048bff 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -538,6 +538,7 @@ public class Chunk implements IChunkAccess { + if (i != this.loc.x || j != this.loc.z) { + Chunk.LOGGER.warn("Wrong location! ({}, {}) should be ({}, {}), {}", i, j, this.loc.x, this.loc.z, entity); + entity.dead = true; ++ return; // Paper + } + + int k = MathHelper.floor(entity.locY() / 16.0D); diff --git a/Spigot-Server-Patches/0353-Configurable-Keep-Spawn-Loaded-range-per-world.patch b/Spigot-Server-Patches/0353-Configurable-Keep-Spawn-Loaded-range-per-world.patch index 92a5b7f43f..8ca3b63056 100644 --- a/Spigot-Server-Patches/0353-Configurable-Keep-Spawn-Loaded-range-per-world.patch +++ b/Spigot-Server-Patches/0353-Configurable-Keep-Spawn-Loaded-range-per-world.patch @@ -21,10 +21,10 @@ index 38d25a12c6a52d8a83214e2a0f43a218cf15ceac..ffe9b1a63d78925e1d77b9e730aef42f + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6d87fa38c5a84d5befcadf536413b1212bd1b604..ac512c5a1bd10b119a07c11dc6f8569005348ac8 100644 +index 00dbb5382aa6efec0038a45049716cd44c1f4c79..e4b7bd30117e0a3af50ec28aada604df837ebb02 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -599,35 +599,36 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant> j; private final Mailbox k; -@@ -94,26 +103,14 @@ public abstract class ChunkMapDistance { +@@ -100,26 +109,14 @@ public abstract class ChunkMapDistance { ; } @@ -60,7 +60,7 @@ index 3d359b6dcea28135105cf0b9c06c65797cf537bf..706ef10959df897a4b1889c2e2e7ff41 return true; } else { if (!this.l.isEmpty()) { -@@ -367,7 +364,7 @@ public abstract class ChunkMapDistance { +@@ -373,7 +370,7 @@ public abstract class ChunkMapDistance { ObjectIterator objectiterator = this.a.long2ByteEntrySet().iterator(); while (objectiterator.hasNext()) { @@ -69,11 +69,11 @@ index 3d359b6dcea28135105cf0b9c06c65797cf537bf..706ef10959df897a4b1889c2e2e7ff41 byte b0 = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getByteValue(); long j = it_unimi_dsi_fastutil_longs_long2bytemap_entry.getLongKey(); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 985fc002fa5afc71ecd242aa8101684b2c751b30..eefd94ef237657625f2e7b19099d802e7680b50a 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -20,6 +20,7 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 7dea5e783ce2a1f8ddd2b3ab7a19e03a56c36ba1..2c3d9a5d118cc4f3b5e78daf943911bb7386488a 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -45,6 +45,7 @@ public class PlayerChunk { private static final CompletableFuture> UNLOADED_CHUNK_FUTURE = CompletableFuture.completedFuture(PlayerChunk.UNLOADED_CHUNK); private static final List CHUNK_STATUSES = ChunkStatus.a(); private static final PlayerChunk.State[] CHUNK_STATES = PlayerChunk.State.values(); diff --git a/Spigot-Server-Patches/0356-Implement-CraftBlockSoundGroup.patch b/Spigot-Server-Patches/0356-Implement-CraftBlockSoundGroup.patch index 092db9526e..11f039c371 100644 --- a/Spigot-Server-Patches/0356-Implement-CraftBlockSoundGroup.patch +++ b/Spigot-Server-Patches/0356-Implement-CraftBlockSoundGroup.patch @@ -6,13 +6,13 @@ Subject: [PATCH] Implement CraftBlockSoundGroup diff --git a/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java new file mode 100644 -index 0000000000000000000000000000000000000000..8183c94ff4883e1af02e82098f1f80cffdb793aa +index 0000000000000000000000000000000000000000..34b3b858f616c4a1f877e6e58d315de2d8ff0720 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/block/CraftBlockSoundGroup.java @@ -0,0 +1,38 @@ +package com.destroystokyo.paper.block; + -+import net.minecraft.server.SoundEffectType; ++import net.minecraft.world.level.block.SoundEffectType; +import org.bukkit.Sound; +import org.bukkit.craftbukkit.CraftSound; + @@ -48,11 +48,11 @@ index 0000000000000000000000000000000000000000..8183c94ff4883e1af02e82098f1f80cf + return CraftSound.getBukkit(soundEffectType.getFallSound()); + } +} -diff --git a/src/main/java/net/minecraft/server/SoundEffectType.java b/src/main/java/net/minecraft/server/SoundEffectType.java -index 49093a5294d5e64ac149e6922e884e72f9f56c03..5f5153ec781c73d76bbf0b5b14b45bf4b74faefd 100644 ---- a/src/main/java/net/minecraft/server/SoundEffectType.java -+++ b/src/main/java/net/minecraft/server/SoundEffectType.java -@@ -51,10 +51,10 @@ public class SoundEffectType { +diff --git a/src/main/java/net/minecraft/world/level/block/SoundEffectType.java b/src/main/java/net/minecraft/world/level/block/SoundEffectType.java +index 0987b25ac586d5d7b7954256c740fdf736498dae..b2a52c6bad5a83f34188b8f3db18c61ff9f52869 100644 +--- a/src/main/java/net/minecraft/world/level/block/SoundEffectType.java ++++ b/src/main/java/net/minecraft/world/level/block/SoundEffectType.java +@@ -54,10 +54,10 @@ public class SoundEffectType { public static final SoundEffectType U = new SoundEffectType(1.0F, 1.0F, SoundEffects.BLOCK_GILDED_BLACKSTONE_BREAK, SoundEffects.BLOCK_GILDED_BLACKSTONE_STEP, SoundEffects.BLOCK_GILDED_BLACKSTONE_PLACE, SoundEffects.BLOCK_GILDED_BLACKSTONE_HIT, SoundEffects.BLOCK_GILDED_BLACKSTONE_FALL); public final float volume; public final float pitch; @@ -66,7 +66,7 @@ index 49093a5294d5e64ac149e6922e884e72f9f56c03..5f5153ec781c73d76bbf0b5b14b45bf4 public SoundEffectType(float f, float f1, SoundEffect soundeffect, SoundEffect soundeffect1, SoundEffect soundeffect2, SoundEffect soundeffect3, SoundEffect soundeffect4) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 661bb54c27966c8050644b293d99dfe86e3c04ce..41bd71a55626b933c948e5c7e7b8af534eb896c4 100644 +index e4fe55bb830cd43680de9d61652448b1ea879063..38122a0ae08667e69cf2eb78d36208bb19441554 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -738,4 +738,11 @@ public class CraftBlock implements Block { diff --git a/Spigot-Server-Patches/0357-Chunk-debug-command.patch b/Spigot-Server-Patches/0357-Chunk-debug-command.patch index 9945c3505e..5094f6fa9f 100644 --- a/Spigot-Server-Patches/0357-Chunk-debug-command.patch +++ b/Spigot-Server-Patches/0357-Chunk-debug-command.patch @@ -32,20 +32,22 @@ https://bugs.mojang.com/browse/MC-141484?focusedCommentId=528273&page=com.atlass https://bugs.mojang.com/browse/MC-141484?focusedCommentId=528577&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-528577 diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index aa606e66c874d5147074b85cc9a5ceef71175740..7dfed07e54f1f0be0c01ee161f56dc421b91baaa 100644 +index b67bd98cca4a06bc0ebaed577195dffc3b3251ec..a7a02072e5c7ce62cbecbb638fcc74abf2fb57ee 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -10,8 +10,10 @@ import net.minecraft.server.ChunkCoordIntPair; - import net.minecraft.server.ChunkProviderServer; - import net.minecraft.server.Entity; - import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; +@@ -9,10 +9,12 @@ import com.google.common.collect.Maps; + import net.minecraft.resources.MinecraftKey; import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.PlayerChunk; - import net.minecraft.server.WorldServer; + import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.server.level.PlayerChunk; + import net.minecraft.server.level.WorldServer; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityTypes; + import net.minecraft.world.level.ChunkCoordIntPair; ++import net.minecraft.server.MCUtil; import org.apache.commons.lang3.tuple.MutablePair; import org.apache.commons.lang3.tuple.Pair; + import org.bukkit.Bukkit; @@ -41,7 +43,7 @@ import java.util.stream.Collectors; public class PaperCommand extends Command { @@ -205,26 +207,13 @@ index aa606e66c874d5147074b85cc9a5ceef71175740..7dfed07e54f1f0be0c01ee161f56dc42 /* * Ported from MinecraftForge - author: LexManos - License: LGPLv2.1 */ -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 8017953af1df6c046a47ebe655e5d1afa68d50f8..af597b8b3157ac76456f8575a8f85a48fb0f45cd 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -24,7 +24,7 @@ import org.apache.logging.log4j.Logger; - - public class ChunkProviderServer extends IChunkProvider { - -- private static final List b = ChunkStatus.a(); -+ private static final List b = ChunkStatus.a(); static final List getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER - private final ChunkMapDistance chunkMapDistance; - public final ChunkGenerator chunkGenerator; - private final WorldServer world; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 816d55b17ea531bc2f25b92c003b127fe6e04112..2507bdf7bfa65f1bc728a46322d2a570e566e32c 100644 +index 67806eaab081e938cd99a0d74225b1b7744ff2d7..5f8b8b5fac14983fbeb64ce3f09bf9a885179e8c 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -6,7 +6,13 @@ import com.destroystokyo.paper.profile.PlayerProfile; - import com.google.common.util.concurrent.ThreadFactoryBuilder; - import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; +@@ -13,7 +13,13 @@ import net.minecraft.world.level.ChunkCoordIntPair; + import net.minecraft.world.level.RayTrace; + import net.minecraft.world.level.World; import org.apache.commons.lang.exception.ExceptionUtils; +import com.google.gson.JsonArray; +import com.google.gson.JsonObject; @@ -236,7 +225,7 @@ index 816d55b17ea531bc2f25b92c003b127fe6e04112..2507bdf7bfa65f1bc728a46322d2a570 import org.bukkit.Location; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.CraftWorld; -@@ -15,8 +21,11 @@ import org.spigotmc.AsyncCatcher; +@@ -22,8 +28,11 @@ import org.spigotmc.AsyncCatcher; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -248,7 +237,7 @@ index 816d55b17ea531bc2f25b92c003b127fe6e04112..2507bdf7bfa65f1bc728a46322d2a570 import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.LinkedBlockingQueue; -@@ -522,4 +531,170 @@ public final class MCUtil { +@@ -529,4 +538,170 @@ public final class MCUtil { return null; } @@ -419,11 +408,24 @@ index 816d55b17ea531bc2f25b92c003b127fe6e04112..2507bdf7bfa65f1bc728a46322d2a570 + } + } } -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index eefd94ef237657625f2e7b19099d802e7680b50a..b7af53dbf3139d7d51069e11388b945785cb47f6 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -29,7 +29,7 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index eb576566708d50c002e73aa746d2bc58b9b04c2b..0b2973a7272890ebee205bd74e7d75c174ceeb9a 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -46,7 +46,7 @@ import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper + + public class ChunkProviderServer extends IChunkProvider { + +- private static final List b = ChunkStatus.a(); ++ private static final List b = ChunkStatus.a(); static final List getPossibleChunkStatuses() { return ChunkProviderServer.b; } // Paper - OBFHELPER + private final ChunkMapDistance chunkMapDistance; + public final ChunkGenerator chunkGenerator; + private final WorldServer world; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 2c3d9a5d118cc4f3b5e78daf943911bb7386488a..9891cf98f8c740f84f9135ee8176e67abb648b3a 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -54,7 +54,7 @@ public class PlayerChunk { public int oldTicketLevel; private int ticketLevel; private int n; @@ -432,11 +434,11 @@ index eefd94ef237657625f2e7b19099d802e7680b50a..b7af53dbf3139d7d51069e11388b9457 private boolean p; private final ShortSet[] dirtyBlocks; private int r; -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 8370bb32f9ca5c88cea52b90a6f361ad5333bbb2..21c261e3cb4d82e358a8e5c1151f59e68b483fd5 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -60,7 +60,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 90a3ca4e92fefc1f20b2878686030e9123238384..bdcc4542eb5da0a80f00a1d41d4773bb3be3996a 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -104,7 +104,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final Long2ObjectLinkedOpenHashMap updatingChunks = new Long2ObjectLinkedOpenHashMap(); public volatile Long2ObjectLinkedOpenHashMap visibleChunks; private final Long2ObjectLinkedOpenHashMap pendingUnload; @@ -445,10 +447,10 @@ index 8370bb32f9ca5c88cea52b90a6f361ad5333bbb2..21c261e3cb4d82e358a8e5c1151f59e6 public final WorldServer world; private final LightEngineThreaded lightEngine; private final IAsyncTaskHandler executor; -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 77bb6b092a0763ff27f90f0401a8a81b15aebb8c..7a8397815a5b7f79f3e3a0348aeedf63fe879f8f 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java +index 51ef4adf66c1e21093e63ab46fa47e66c2425fdb..e06fe77f6ea05a93e95fce223bcfd0d16394f96f 100644 +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -6,8 +6,8 @@ public final class Ticket implements Comparable> { private final TicketType a; diff --git a/Spigot-Server-Patches/0358-Catch-exceptions-from-dispenser-entity-spawns.patch b/Spigot-Server-Patches/0358-Catch-exceptions-from-dispenser-entity-spawns.patch index beaf6dd426..eb386f8345 100644 --- a/Spigot-Server-Patches/0358-Catch-exceptions-from-dispenser-entity-spawns.patch +++ b/Spigot-Server-Patches/0358-Catch-exceptions-from-dispenser-entity-spawns.patch @@ -4,11 +4,11 @@ Date: Mon, 10 Jun 2019 09:36:40 +0100 Subject: [PATCH] Catch exceptions from dispenser entity spawns -diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java -index e41d64a9cdf6e8c58a6909b672df43e6738e3c31..ce7ab95c95eba7f1c49096a88d9a1b2110ae473b 100644 ---- a/src/main/java/net/minecraft/server/IDispenseBehavior.java -+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java -@@ -163,7 +163,14 @@ public interface IDispenseBehavior { +diff --git a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java +index ffce5baaca6fd5b5e73ed898d12a4fee02c24515..d8a8a57c2228376347d46de8821ae0e8321861e3 100644 +--- a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java +@@ -236,7 +236,14 @@ public interface IDispenseBehavior { } } diff --git a/Spigot-Server-Patches/0359-Fix-World-isChunkGenerated-calls.patch b/Spigot-Server-Patches/0359-Fix-World-isChunkGenerated-calls.patch index 3bb6e592df..b921c3b65e 100644 --- a/Spigot-Server-Patches/0359-Fix-World-isChunkGenerated-calls.patch +++ b/Spigot-Server-Patches/0359-Fix-World-isChunkGenerated-calls.patch @@ -7,11 +7,11 @@ Optimize World#loadChunk() too This patch also adds a chunk status cache on region files (note that its only purpose is to cache the status on DISK) -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index af597b8b3157ac76456f8575a8f85a48fb0f45cd..d340990000144d9500069824e7e6609400a54ece 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -30,7 +30,7 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0b2973a7272890ebee205bd74e7d75c174ceeb9a..24b7b76e11cf2b389c6f40fb4046294f356164c5 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -52,7 +52,7 @@ public class ChunkProviderServer extends IChunkProvider { private final WorldServer world; public final Thread serverThread; // Paper - private -> public private final LightEngineThreaded lightEngine; @@ -20,7 +20,7 @@ index af597b8b3157ac76456f8575a8f85a48fb0f45cd..d340990000144d9500069824e7e66094 public final PlayerChunkMap playerChunkMap; private final WorldPersistentData worldPersistentData; private long lastTickTime; -@@ -295,6 +295,21 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -317,6 +317,21 @@ public class ChunkProviderServer extends IChunkProvider { return ret; } @@ -42,76 +42,11 @@ index af597b8b3157ac76456f8575a8f85a48fb0f45cd..d340990000144d9500069824e7e66094 // Paper end @Nullable -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 3a292bccb2295bf7ae46fc3d7e5c9c63a72f403d..23664a8e7c6e642e601fd83c875e5be56826be74 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -419,6 +419,17 @@ public class ChunkRegionLoader { - } - // Paper end - -+ // Paper start -+ public static ChunkStatus getStatus(NBTTagCompound compound) { -+ if (compound == null) { -+ return null; -+ } -+ -+ // Note: Copied from below -+ return ChunkStatus.getStatus(compound.getCompound("Level").getString("Status")); -+ } -+ // Paper end -+ - public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { - if (nbttagcompound != null) { - ChunkStatus chunkstatus = ChunkStatus.a(nbttagcompound.getCompound("Level").getString("Status")); -diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index ca4b23007bec075412fd5c6f100b9b9fc5019db6..f231bb2f5bca184557182c50d251943932693614 100644 ---- a/src/main/java/net/minecraft/server/ChunkStatus.java -+++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -182,6 +182,7 @@ public class ChunkStatus { - return this.s; - } - -+ public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER - public ChunkStatus e() { - return this.u; - } -@@ -202,6 +203,17 @@ public class ChunkStatus { - return this.y; - } - -+ // Paper start -+ public static ChunkStatus getStatus(String name) { -+ try { -+ // We need this otherwise we return EMPTY for invalid names -+ MinecraftKey key = new MinecraftKey(name); -+ return IRegistry.CHUNK_STATUS.getOptional(key).orElse(null); -+ } catch (Exception ex) { -+ return null; // invalid name -+ } -+ } -+ // Paper end - public static ChunkStatus a(String s) { - return (ChunkStatus) IRegistry.CHUNK_STATUS.get(MinecraftKey.a(s)); - } -diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index 2fde0b6ca8f38a998ac73b68be61fbfea9088cee..fa03834dacacf7ae6a326c88007256a261153c27 100644 ---- a/src/main/java/net/minecraft/server/IChunkLoader.java -+++ b/src/main/java/net/minecraft/server/IChunkLoader.java -@@ -8,7 +8,7 @@ import javax.annotation.Nullable; - - public class IChunkLoader implements AutoCloseable { - -- private final IOWorker a; -+ private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER - protected final DataFixer b; - @Nullable - private PersistentStructureLegacy c; -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index b7af53dbf3139d7d51069e11388b945785cb47f6..2d749c07b159604e1ab904e026adf326eb9a732e 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -117,6 +117,19 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 9891cf98f8c740f84f9135ee8176e67abb648b3a..6bced8533df49d7bfdb32dfa0caad9d788ffc2c8 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -142,6 +142,19 @@ public class PlayerChunk { Either either = (Either) statusFuture.getNow(null); return either == null ? null : (Chunk) either.left().orElse(null); } @@ -131,11 +66,11 @@ index b7af53dbf3139d7d51069e11388b945785cb47f6..2d749c07b159604e1ab904e026adf326 // Paper end public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 21c261e3cb4d82e358a8e5c1151f59e68b483fd5..14288d7beaa9aea531b7eee16a4be4101d0380fa 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -939,12 +939,61 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index bdcc4542eb5da0a80f00a1d41d4773bb3be3996a..c8b2013791ce0ac4438243998b43bbd781405254 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -983,12 +983,61 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @Nullable @@ -199,11 +134,76 @@ index 21c261e3cb4d82e358a8e5c1151f59e68b483fd5..14288d7beaa9aea531b7eee16a4be410 boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { // Spigot start return isOutsideOfRange(chunkcoordintpair, false); -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 2fb4131e5972d3b554a763098709470e8a725280..3e299ffaabf2a91336fae28031c8fc0712667bc5 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -38,6 +38,30 @@ public class RegionFile implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +index 5e4c162654349f884becc10e8fbae4ded6889deb..711308cf84a816f09d116a7414f9cbee803c8713 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +@@ -193,6 +193,7 @@ public class ChunkStatus { + return this.s; + } + ++ public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER + public ChunkStatus e() { + return this.u; + } +@@ -213,6 +214,17 @@ public class ChunkStatus { + return this.y; + } + ++ // Paper start ++ public static ChunkStatus getStatus(String name) { ++ try { ++ // We need this otherwise we return EMPTY for invalid names ++ MinecraftKey key = new MinecraftKey(name); ++ return IRegistry.CHUNK_STATUS.getOptional(key).orElse(null); ++ } catch (Exception ex) { ++ return null; // invalid name ++ } ++ } ++ // Paper end + public static ChunkStatus a(String s) { + return (ChunkStatus) IRegistry.CHUNK_STATUS.get(MinecraftKey.a(s)); + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 1711c40e163a1148e2f7be58d4c020c61bef8bb2..839d3d08a2d1ff6714645517906598a87075687b 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -461,6 +461,17 @@ public class ChunkRegionLoader { + } + // Paper end + ++ // Paper start ++ public static ChunkStatus getStatus(NBTTagCompound compound) { ++ if (compound == null) { ++ return null; ++ } ++ ++ // Note: Copied from below ++ return ChunkStatus.getStatus(compound.getCompound("Level").getString("Status")); ++ } ++ // Paper end ++ + public static ChunkStatus.Type a(@Nullable NBTTagCompound nbttagcompound) { + if (nbttagcompound != null) { + ChunkStatus chunkstatus = ChunkStatus.a(nbttagcompound.getCompound("Level").getString("Status")); +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +index 247d14a3ca56734bbbf4dc0ec247d60a1f241e7a..d785f44cd503d4d91589f3fc4bc8dc805dff3d41 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +@@ -25,7 +25,7 @@ import net.minecraft.world.level.dimension.DimensionManager; + + public class IChunkLoader implements AutoCloseable { + +- private final IOWorker a; ++ private final IOWorker a; public IOWorker getIOWorker() { return a; } // Paper - OBFHELPER + protected final DataFixer b; + @Nullable + private PersistentStructureLegacy c; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 7491c09b3d8fdd27fa83d850ff097e44e1bb0eee..299806b73e44a7128e829b35cc2b017a321d7926 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -41,6 +41,30 @@ public class RegionFile implements AutoCloseable { protected final RegionFileBitSet freeSectors; public final File file; // Paper @@ -234,7 +234,7 @@ index 2fb4131e5972d3b554a763098709470e8a725280..3e299ffaabf2a91336fae28031c8fc07 public RegionFile(File file, File file1, boolean flag) throws IOException { this(file.toPath(), file1.toPath(), RegionFileCompression.b, flag); } -@@ -374,11 +398,13 @@ public class RegionFile implements AutoCloseable { +@@ -377,11 +401,13 @@ public class RegionFile implements AutoCloseable { return this.getOffset(chunkcoordintpair) != 0; } @@ -248,11 +248,11 @@ index 2fb4131e5972d3b554a763098709470e8a725280..3e299ffaabf2a91336fae28031c8fc07 try { this.d(); } finally { -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index de926992e20da3ec433f9c7b4bc73805fd9d36ab..7a15944926427eb6cad976daabe5e710f4fbf1bb 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -21,7 +21,14 @@ public final class RegionFileCache implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +index 571b34cd30bb76dcfac928e29a1cafd5824d4772..8ceebe1f5ca8821228faf65e1d26fa205ec1e56c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +@@ -25,7 +25,14 @@ public final class RegionFileCache implements AutoCloseable { this.c = flag; } @@ -268,7 +268,7 @@ index de926992e20da3ec433f9c7b4bc73805fd9d36ab..7a15944926427eb6cad976daabe5e710 long i = ChunkCoordIntPair.pair(chunkcoordintpair.getRegionX(), chunkcoordintpair.getRegionZ()); RegionFile regionfile = (RegionFile) this.cache.getAndMoveToFirst(i); -@@ -168,6 +175,7 @@ public final class RegionFileCache implements AutoCloseable { +@@ -172,6 +179,7 @@ public final class RegionFileCache implements AutoCloseable { try { NBTCompressedStreamTools.a(nbttagcompound, (DataOutput) dataoutputstream); @@ -277,7 +277,7 @@ index de926992e20da3ec433f9c7b4bc73805fd9d36ab..7a15944926427eb6cad976daabe5e710 } catch (Throwable throwable1) { throwable = throwable1; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 0db39ef48c3f1a4c055185e70a09e5268115bd15..f750973175f15c782bd384c09a176e72979068d9 100644 +index 7080dc890e959e1cce9aec63c1de8ac413b4b2e9..a0654c41ce981a12dc20e1ecaf13f1f2d150029f 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -19,6 +19,7 @@ import java.util.Objects; @@ -287,7 +287,7 @@ index 0db39ef48c3f1a4c055185e70a09e5268115bd15..f750973175f15c782bd384c09a176e72 +import java.util.concurrent.CompletableFuture; import java.util.function.Predicate; import java.util.stream.Collectors; - import net.minecraft.server.ArraySetSorted; + import net.minecraft.core.BlockPosition; @@ -419,8 +420,22 @@ public class CraftWorld implements World { @Override @@ -312,7 +312,7 @@ index 0db39ef48c3f1a4c055185e70a09e5268115bd15..f750973175f15c782bd384c09a176e72 } catch (IOException ex) { throw new RuntimeException(ex); } -@@ -531,20 +546,49 @@ public class CraftWorld implements World { +@@ -531,20 +546,48 @@ public class CraftWorld implements World { @Override public boolean loadChunk(int x, int z, boolean generate) { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot @@ -326,24 +326,23 @@ index 0db39ef48c3f1a4c055185e70a09e5268115bd15..f750973175f15c782bd384c09a176e72 - chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, true); - } + if (!generate) { - -- if (chunk instanceof net.minecraft.server.Chunk) { -- world.getChunkProvider().addTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 1, Unit.INSTANCE); -- return true; + IChunkAccess immediate = world.getChunkProvider().getChunkAtImmediately(x, z); + if (immediate == null) { + immediate = world.getChunkProvider().playerChunkMap.getUnloadingChunk(x, z); + } + if (immediate != null) { -+ if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.server.Chunk)) { ++ if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.world.level.chunk.Chunk)) { + return false; // not full status + } + world.getChunkProvider().addTicket(TicketType.PLUGIN, chunkPos, 1, Unit.INSTANCE); + world.getChunkAt(x, z); // make sure we're at ticket level 32 or lower + return true; + } -+ -+ net.minecraft.server.RegionFile file; + +- if (chunk instanceof net.minecraft.world.level.chunk.Chunk) { +- world.getChunkProvider().addTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 1, Unit.INSTANCE); +- return true; ++ net.minecraft.world.level.chunk.storage.RegionFile file; + try { + file = world.getChunkProvider().playerChunkMap.getIOWorker().getRegionFileCache().getFile(chunkPos, false); + } catch (IOException ex) { @@ -356,7 +355,7 @@ index 0db39ef48c3f1a4c055185e70a09e5268115bd15..f750973175f15c782bd384c09a176e72 + } + + IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.EMPTY, true); -+ if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.server.Chunk)) { ++ if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.world.level.chunk.Chunk)) { + return false; + } + diff --git a/Spigot-Server-Patches/0361-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch b/Spigot-Server-Patches/0361-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch index 0384e927a5..1dcdb2ef23 100644 --- a/Spigot-Server-Patches/0361-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch +++ b/Spigot-Server-Patches/0361-Synchronize-DataPaletteBlock-instead-of-ReentrantLoc.patch @@ -12,11 +12,11 @@ contention situations. And this is extremely a low contention situation. -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b74955f75339 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -23,7 +23,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index 8928157b01bb4f0dfe043732777b33708c23cda7..cc0c5995dc3840ce66ea849849f7c37555d3b5e6 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +@@ -32,7 +32,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER private final ReentrantLock j = new ReentrantLock(); @@ -25,7 +25,7 @@ index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b749 if (this.j.isLocked() && !this.j.isHeldByCurrentThread()) { String s = (String) Thread.getAllStackTraces().keySet().stream().filter(Objects::nonNull).map((thread) -> { return thread.getName() + ": \n\tat " + (String) Arrays.stream(thread.getStackTrace()).map(Object::toString).collect(Collectors.joining("\n\tat ")); -@@ -35,11 +35,11 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -44,11 +44,11 @@ public class DataPaletteBlock implements DataPaletteExpandable { throw new ReportedException(crashreport); } else { this.j.lock(); @@ -39,7 +39,7 @@ index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b749 } public DataPaletteBlock(DataPalette datapalette, RegistryBlockID registryblockid, Function function, Function function1, T t0) { -@@ -75,7 +75,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -84,7 +84,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } @Override @@ -48,7 +48,7 @@ index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b749 this.a(); DataBits databits = this.a; DataPalette datapalette = this.h; -@@ -98,18 +98,18 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -107,18 +107,18 @@ public class DataPaletteBlock implements DataPaletteExpandable { } public T setBlock(int i, int j, int k, T t0) { @@ -72,7 +72,7 @@ index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b749 int j = this.h.a(t0); int k = this.a.a(i, j); T t1 = this.h.a(k); -@@ -134,7 +134,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -143,7 +143,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { } public void writeDataPaletteBlock(PacketDataSerializer packetDataSerializer) { this.b(packetDataSerializer); } // Paper - OBFHELPER @@ -81,7 +81,7 @@ index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b749 this.a(); packetdataserializer.writeByte(this.i); this.h.b(packetdataserializer); -@@ -142,7 +142,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -151,7 +151,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { this.b(); } @@ -90,7 +90,7 @@ index eabc9d7b934f27c823e012f3f10fffc23b461292..f4c1b8d32b239c44e70d3fa6d094b749 this.a(); int i = Math.max(4, MathHelper.e(nbttaglist.size())); -@@ -175,7 +175,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -184,7 +184,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { this.b(); } diff --git a/Spigot-Server-Patches/0362-incremental-chunk-saving.patch b/Spigot-Server-Patches/0362-incremental-chunk-saving.patch index 4e03462f9b..67b733edcb 100644 --- a/Spigot-Server-Patches/0362-incremental-chunk-saving.patch +++ b/Spigot-Server-Patches/0362-incremental-chunk-saving.patch @@ -28,44 +28,11 @@ index ffe9b1a63d78925e1d77b9e730aef42fed6d58fa..1278d09f70c1e97607ef20d87a178dc2 + maxAutoSaveChunksPerTick = getInt("max-auto-save-chunks-per-tick", 24); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index b258d4a85c41c2de55a28c565766f57c3f1604ff..fa549cd2ab9d0665dc042f3d4e79e205eaf4da54 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -43,7 +43,7 @@ public class Chunk implements IChunkAccess { - private TickList o; - private TickList p; - private boolean q; -- private long lastSaved; -+ public long lastSaved; // Paper - private volatile boolean s; - private long inhabitedTime; - @Nullable -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index d340990000144d9500069824e7e6609400a54ece..71c7bf2fd4fdb0ad880ca81c198a7cf25cdb9e87 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -535,6 +535,15 @@ public class ChunkProviderServer extends IChunkProvider { - } // Paper - Timings - } - -+ // Paper start - duplicate save, but call incremental -+ public void saveIncrementally() { -+ this.tickDistanceManager(); -+ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings -+ this.playerChunkMap.saveIncrementally(); -+ } // Paper - Timings -+ } -+ // Paper end -+ - @Override - public void close() throws IOException { - // CraftBukkit start diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index ac512c5a1bd10b119a07c11dc6f8569005348ac8..7f63e60caac65a24909566e3f9a0f5ba5aa1575a 100644 +index e4b7bd30117e0a3af50ec28aada604df837ebb02..1d8695ac6692194c9a1cfd46c9d735120ca75245 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -154,6 +154,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant processQueue = new java.util.concurrent.ConcurrentLinkedQueue(); public int autosavePeriod; @@ -73,7 +40,7 @@ index ac512c5a1bd10b119a07c11dc6f8569005348ac8..7f63e60caac65a24909566e3f9a0f5ba public CommandDispatcher vanillaCommandDispatcher; private boolean forceTicks; // CraftBukkit end -@@ -1139,14 +1140,24 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 100) { // Spigot -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 2d749c07b159604e1ab904e026adf326eb9a732e..ad01b9333e73c8e4a7c848edc4ce252a51ea52b6 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -42,6 +42,9 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 24b7b76e11cf2b389c6f40fb4046294f356164c5..0b967cc5a86b357ff808621abcb96239bd09d077 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -557,6 +557,15 @@ public class ChunkProviderServer extends IChunkProvider { + } // Paper - Timings + } + ++ // Paper start - duplicate save, but call incremental ++ public void saveIncrementally() { ++ this.tickDistanceManager(); ++ try (co.aikar.timings.Timing timed = world.timings.chunkSaveData.startTiming()) { // Paper - Timings ++ this.playerChunkMap.saveIncrementally(); ++ } // Paper - Timings ++ } ++ // Paper end ++ + @Override + public void close() throws IOException { + // CraftBukkit start +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 6bced8533df49d7bfdb32dfa0caad9d788ffc2c8..75d4a8fc394449ccc006fe67a8842edcd9f36854 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -67,6 +67,9 @@ public class PlayerChunk { private final PlayerChunkMap chunkMap; // Paper @@ -117,7 +104,7 @@ index 2d749c07b159604e1ab904e026adf326eb9a732e..ad01b9333e73c8e4a7c848edc4ce252a public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -397,7 +400,19 @@ public class PlayerChunk { +@@ -422,7 +425,19 @@ public class PlayerChunk { boolean flag2 = playerchunk_state.isAtLeast(PlayerChunk.State.BORDER); boolean flag3 = playerchunk_state1.isAtLeast(PlayerChunk.State.BORDER); @@ -137,7 +124,7 @@ index 2d749c07b159604e1ab904e026adf326eb9a732e..ad01b9333e73c8e4a7c848edc4ce252a if (!flag2 && flag3) { // Paper start - cache ticking ready status int expectCreateCount = ++this.fullChunkCreateCount; -@@ -517,8 +532,32 @@ public class PlayerChunk { +@@ -542,8 +557,32 @@ public class PlayerChunk { } public void m() { @@ -170,19 +157,19 @@ index 2d749c07b159604e1ab904e026adf326eb9a732e..ad01b9333e73c8e4a7c848edc4ce252a public void a(ProtoChunkExtension protochunkextension) { for (int i = 0; i < this.statusFutures.length(); ++i) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 14288d7beaa9aea531b7eee16a4be4101d0380fa..abe94c9b7262a67de1a93914d94550f5d0abed28 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -47,6 +47,7 @@ import java.util.function.Supplier; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index c8b2013791ce0ac4438243998b43bbd781405254..ec9b765a09500c4e4e5dde8b7856e2b752e7fdc2 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -91,6 +91,7 @@ import net.minecraft.world.level.levelgen.structure.templatesystem.DefinedStruct + import net.minecraft.world.level.storage.Convertable; + import net.minecraft.world.level.storage.WorldPersistentData; + import net.minecraft.world.phys.Vec3D; +import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; // Paper import org.apache.commons.lang3.mutable.MutableBoolean; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -334,6 +335,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -378,6 +379,64 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -247,7 +234,7 @@ index 14288d7beaa9aea531b7eee16a4be4101d0380fa..abe94c9b7262a67de1a93914d94550f5 protected void save(boolean flag) { if (flag) { List list = (List) this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).peek(PlayerChunk::m).collect(Collectors.toList()); -@@ -444,6 +503,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -488,6 +547,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.world.unloadChunk(chunk); } @@ -255,7 +242,7 @@ index 14288d7beaa9aea531b7eee16a4be4101d0380fa..abe94c9b7262a67de1a93914d94550f5 this.lightEngine.a(ichunkaccess.getPos()); this.lightEngine.queueUpdate(); -@@ -636,6 +696,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -680,6 +740,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { playerchunk.a(new ProtoChunkExtension(chunk)); } @@ -264,11 +251,11 @@ index 14288d7beaa9aea531b7eee16a4be4101d0380fa..abe94c9b7262a67de1a93914d94550f5 chunk.a(() -> { return PlayerChunk.getChunkState(playerchunk.getTicketLevel()); }); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3a95b98b77171b4b18a1d939eb14953d24b903e0..3f97befa2742a575b103b68b19fc6415bfbd8c04 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -776,11 +776,43 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index bfcd40c0cf7f3b41601d4c422e75690a20860bf0..2d2857b301377d45ca5c63e6d855304b3e605f78 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -885,11 +885,43 @@ public class WorldServer extends World implements GeneratorAccessSeed { return !this.server.a(this, blockposition, entityhuman) && this.getWorldBorder().a(blockposition); } @@ -313,7 +300,7 @@ index 3a95b98b77171b4b18a1d939eb14953d24b903e0..3f97befa2742a575b103b68b19fc6415 try (co.aikar.timings.Timing ignored = timings.worldSave.startTiming()) { // Paper if (iprogressupdate != null) { iprogressupdate.a(new ChatMessage("menu.savingLevel")); -@@ -806,6 +838,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -915,6 +947,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { // CraftBukkit end } @@ -321,3 +308,16 @@ index 3a95b98b77171b4b18a1d939eb14953d24b903e0..3f97befa2742a575b103b68b19fc6415 private void aj() { if (this.dragonBattle != null) { this.worldDataServer.a(this.dragonBattle.a()); // CraftBukkit +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 5539ee8552c4bcfa718a63dbd4c25bd232048bff..f036cc45e7b1f3aedd8c63293b9b5436968a42c3 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -77,7 +77,7 @@ public class Chunk implements IChunkAccess { + private TickList o; + private TickList p; + private boolean q; +- private long lastSaved; ++ public long lastSaved; // Paper + private volatile boolean s; + private long inhabitedTime; + @Nullable diff --git a/Spigot-Server-Patches/0363-Anti-Xray.patch b/Spigot-Server-Patches/0363-Anti-Xray.patch index fb7a98719e..8336ac8a98 100644 --- a/Spigot-Server-Patches/0363-Anti-Xray.patch +++ b/Spigot-Server-Patches/0363-Anti-Xray.patch @@ -72,7 +72,7 @@ index 0000000000000000000000000000000000000000..2bfab782472b0b4f3a9cbb2b51183f28 +import net.minecraft.server.EnumDirection; +import net.minecraft.server.IBlockData; +import net.minecraft.server.IChunkAccess; -+import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; +import net.minecraft.server.PlayerInteractManager; +import net.minecraft.server.World; + @@ -756,7 +756,7 @@ index 0000000000000000000000000000000000000000..41618994b463267e41a9eb312db682e4 + +import net.minecraft.server.Chunk; +import net.minecraft.server.DataPalette; -+import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; + +public class ChunkPacketInfo { + @@ -843,7 +843,7 @@ index 0000000000000000000000000000000000000000..e61421d87a19bf2f6ce8836b48c445ff + +import net.minecraft.server.Chunk; +import net.minecraft.server.IBlockData; -+import net.minecraft.server.PacketPlayOutMapChunk; ++import net.minecraft.network.protocol.game.PacketPlayOutMapChunk; + +public final class ChunkPacketInfoAntiXray extends ChunkPacketInfo implements Runnable { + @@ -1011,11 +1011,200 @@ index 0000000000000000000000000000000000000000..333763936897befda5bb6c077944d266 + } + } +} -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index fa549cd2ab9d0665dc042f3d4e79e205eaf4da54..6763ecaf5f814302c310f29e3a5a42fc1312a990 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -427,7 +427,7 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +index 31a6f687a8a75b055a32a686c870d3898aae54c3..fe1910486ffc6acc54b565dc68b9873820053701 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMapChunk.java +@@ -1,5 +1,6 @@ + package net.minecraft.network.protocol.game; + ++import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info + import com.google.common.collect.Lists; + import io.netty.buffer.ByteBuf; + import io.netty.buffer.Unpooled; +@@ -32,7 +33,13 @@ public class PacketPlayOutMapChunk implements Packet { + private List g; + private boolean h; + +- public PacketPlayOutMapChunk() {} ++ // Paper start - Async-Anti-Xray - Set the ready flag to true ++ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager ++ public PacketPlayOutMapChunk() { ++ this.ready = true; ++ } ++ // Paper end ++ + // Paper start + private final java.util.List extraPackets = new java.util.ArrayList<>(); + private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); +@@ -42,7 +49,11 @@ public class PacketPlayOutMapChunk implements Packet { + return extraPackets; + } + // Paper end +- public PacketPlayOutMapChunk(Chunk chunk, int i) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public PacketPlayOutMapChunk(Chunk chunk, int i) { this(chunk, i, true); } // Notice for updates: Please make sure this constructor isn't used anywhere ++ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean modifyBlocks) { ++ ChunkPacketInfo chunkPacketInfo = modifyBlocks ? chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i) : null; ++ // Paper end + ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); + + this.a = chunkcoordintpair.x; +@@ -65,7 +76,12 @@ public class PacketPlayOutMapChunk implements Packet { + } + + this.f = new byte[this.a(chunk, i)]; +- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); ++ // Paper start - Anti-Xray - Add chunk packet info ++ if (chunkPacketInfo != null) { ++ chunkPacketInfo.setData(this.getData()); ++ } ++ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); ++ // Paper end + this.g = Lists.newArrayList(); + iterator = chunk.getTileEntities().entrySet().iterator(); + int totalTileEntities = 0; // Paper +@@ -92,8 +108,19 @@ public class PacketPlayOutMapChunk implements Packet { + this.g.add(nbttagcompound); + } + } ++ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks ++ } + ++ // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag ++ @Override ++ public boolean isReady() { ++ return this.ready; ++ } ++ ++ public void setReady(boolean ready) { ++ this.ready = ready; + } ++ // Paper end + + @Override + public void a(PacketDataSerializer packetdataserializer) throws IOException { +@@ -159,8 +186,12 @@ public class PacketPlayOutMapChunk implements Packet { + return bytebuf; + } + +- public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER +- public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { ++ // Paper start - Anti-Xray - Add chunk packet info ++ @Deprecated public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere ++ @Deprecated public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { return this.writeChunk(packetdataserializer, chunk, i, null); } // Notice for updates: Please make sure this method isn't used anywhere ++ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector, ChunkPacketInfo chunkPacketInfo) { return this.a(packetDataSerializer, chunk, chunkSectionSelector, chunkPacketInfo); } // OBFHELPER ++ public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i, ChunkPacketInfo chunkPacketInfo) { ++ // Paper end + int j = 0; + ChunkSection[] achunksection = chunk.getSections(); + int k = 0; +@@ -170,7 +201,7 @@ public class PacketPlayOutMapChunk implements Packet { + + if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) { + j |= 1 << k; +- chunksection.b(packetdataserializer); ++ chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info + } + } + +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index ec9b765a09500c4e4e5dde8b7856e2b752e7fdc2..78e2c2bab951a8f7759ea5badc3275ef4f00e9ba 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -654,7 +654,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + + this.g(chunkcoordintpair); +- return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); ++ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter + }, this.executor); + } + +@@ -1394,9 +1394,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + } + ++ private final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER + private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { + if (apacket[0] == null) { +- apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); ++ apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass + apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); + } + +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 0d32d7e9fc6bf6a05f3975fe225022a9e176e47b..3dcfb2326af92eb7a9cd16fd4725b3ae9acee17b 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -306,6 +306,8 @@ public class PlayerInteractManager { + } + + } ++ ++ this.world.chunkPacketBlockController.onPlayerLeftClickBlock(this, blockposition, enumdirection); // Paper - Anti-Xray + } + + public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 2d2857b301377d45ca5c63e6d855304b3e605f78..8b7e6dfa146abc3b4c8a5b0646e0ef1453ddb68c 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -209,7 +209,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { +- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); ++ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor + this.pvpMode = minecraftserver.getPVP(); + convertable = convertable_conversionsession; + uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 12330f20a8550ec044562e2135c465a9fc8e1d60..81f657084afdfcace67a2245230b0cb91dd919bd 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -2,6 +2,8 @@ package net.minecraft.world.level; + + import co.aikar.timings.Timing; + import co.aikar.timings.Timings; ++import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Paper - Anti-Xray ++import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Paper - Anti-Xray + import com.destroystokyo.paper.event.server.ServerExceptionEvent; + import com.destroystokyo.paper.exception.ServerInternalException; + import com.google.common.base.MoreObjects; +@@ -136,6 +138,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + + public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper ++ public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + + public final co.aikar.timings.WorldTimingsHandler timings; // Paper + public static BlockPosition lastPhysicsProblem; // Spigot +@@ -157,9 +160,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return typeKey; + } + +- protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { ++ protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper + this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName()); // Spigot + this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((net.minecraft.world.level.storage.WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper ++ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray + this.generator = gen; + this.world = new CraftWorld((WorldServer) this, gen, env); + this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit +@@ -425,6 +429,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + // CraftBukkit end + + IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag ++ this.chunkPacketBlockController.onBlockChange(this, blockposition, iblockdata, iblockdata1, i); // Paper - Anti-Xray + + if (iblockdata1 == null) { + // CraftBukkit start - remove blockstate if failed (or the same) +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index f036cc45e7b1f3aedd8c63293b9b5436968a42c3..9b75e5ea8987421523e0324a83db317f150d3f48 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -461,7 +461,7 @@ public class Chunk implements IChunkAccess { return null; } @@ -1024,11 +1213,11 @@ index fa549cd2ab9d0665dc042f3d4e79e205eaf4da54..6763ecaf5f814302c310f29e3a5a42fc this.sections[j >> 4] = chunksection; } -diff --git a/src/main/java/net/minecraft/server/ChunkEmpty.java b/src/main/java/net/minecraft/server/ChunkEmpty.java -index ed22ff28ea6c0978ec0d9d1ecf7baa3f422ed677..d2286f1549de563332c3e4181b9ada30845b3725 100644 ---- a/src/main/java/net/minecraft/server/ChunkEmpty.java -+++ b/src/main/java/net/minecraft/server/ChunkEmpty.java -@@ -12,7 +12,7 @@ public class ChunkEmpty extends Chunk { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java +index 89efd0b68b04457e1cd617dcc8bb1a6ea1c4717c..a8f4c1468759fe44c28957e0e733dee741aa502f 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkEmpty.java +@@ -28,7 +28,7 @@ public class ChunkEmpty extends Chunk { }); public ChunkEmpty(World world, ChunkCoordIntPair chunkcoordintpair) { @@ -1037,41 +1226,19 @@ index ed22ff28ea6c0978ec0d9d1ecf7baa3f422ed677..d2286f1549de563332c3e4181b9ada30 } // Paper start -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 23664a8e7c6e642e601fd83c875e5be56826be74..2dc4f1b689d2a2af9ae42156d954eb5284297ec0 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -58,7 +58,7 @@ public class ChunkRegionLoader { - byte b0 = nbttagcompound2.getByte("Y"); - - if (nbttagcompound2.hasKeyOfType("Palette", 9) && nbttagcompound2.hasKeyOfType("BlockStates", 12)) { -- ChunkSection chunksection = new ChunkSection(b0 << 4); -+ ChunkSection chunksection = new ChunkSection(b0 << 4, null, worldserver, false); // Paper - Anti-Xray - Add parameters - - chunksection.getBlocks().a(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); - chunksection.recalcBlockCounts(); -@@ -122,7 +122,7 @@ public class ChunkRegionLoader { - // CraftBukkit end - }); - } else { -- ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1); -+ ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter - - protochunk.a(biomestorage); - object = protochunk; -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 5c7068cd93806d67c643ed6aabdfcab8888ed94e..90bb2f7ad9f82818d58de9be918f1299c6725070 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index eea4a30428293eaf7afbe303a37adec60b44c2b4..00658974083a97d74e3336d9c719892f25aa22a9 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java @@ -1,6 +1,7 @@ - package net.minecraft.server; + package net.minecraft.world.level.chunk; import java.util.function.Predicate; +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import javax.annotation.Nullable; - - public class ChunkSection { -@@ -12,16 +13,22 @@ public class ChunkSection { + import net.minecraft.nbt.GameProfileSerializer; + import net.minecraft.network.PacketDataSerializer; +@@ -18,16 +19,22 @@ public class ChunkSection { private short e; final DataPaletteBlock blockIds; // Paper - package-private @@ -1098,7 +1265,7 @@ index 5c7068cd93806d67c643ed6aabdfcab8888ed94e..90bb2f7ad9f82818d58de9be918f1299 } public final IBlockData getType(int i, int j, int k) { // Paper -@@ -133,10 +140,14 @@ public class ChunkSection { +@@ -139,10 +146,14 @@ public class ChunkSection { return this.blockIds; } @@ -1116,19 +1283,19 @@ index 5c7068cd93806d67c643ed6aabdfcab8888ed94e..90bb2f7ad9f82818d58de9be918f1299 } public int j() { -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index f4c1b8d32b239c44e70d3fa6d094b74955f75339..ed77117630d54b7ad81f633110c7d2a7c59288e9 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index cc0c5995dc3840ce66ea849849f7c37555d3b5e6..68d53a51acc9790b9cda20ec4d2ec6edd1baac1a 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java @@ -1,6 +1,7 @@ - package net.minecraft.server; + package net.minecraft.world.level.chunk; import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap; +import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info import java.util.Arrays; import java.util.Objects; import java.util.concurrent.locks.ReentrantLock; -@@ -18,6 +19,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -27,6 +28,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { private final Function e; private final Function f; private final T g; @@ -1136,7 +1303,7 @@ index f4c1b8d32b239c44e70d3fa6d094b74955f75339..ed77117630d54b7ad81f633110c7d2a7 protected DataBits a; public final DataBits getDataBits() { return this.a; } // Paper - OBFHELPER private DataPalette h; private DataPalette getDataPalette() { return this.h; } // Paper - OBFHELPER private int i; private int getBitsPerObject() { return this.i; } // Paper - OBFHELPER -@@ -42,14 +44,47 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -51,14 +53,47 @@ public class DataPaletteBlock implements DataPaletteExpandable { //this.j.unlock(); // Paper - disable this } @@ -1186,7 +1353,7 @@ index f4c1b8d32b239c44e70d3fa6d094b74955f75339..ed77117630d54b7ad81f633110c7d2a7 private static int b(int i, int j, int k) { return j << 8 | k << 4 | i; -@@ -84,6 +119,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -93,6 +128,7 @@ public class DataPaletteBlock implements DataPaletteExpandable { int j; @@ -1194,7 +1361,7 @@ index f4c1b8d32b239c44e70d3fa6d094b74955f75339..ed77117630d54b7ad81f633110c7d2a7 for (j = 0; j < databits.b(); ++j) { T t1 = datapalette.a(databits.a(j)); -@@ -133,24 +169,38 @@ public class DataPaletteBlock implements DataPaletteExpandable { +@@ -142,24 +178,38 @@ public class DataPaletteBlock implements DataPaletteExpandable { return t0 == null ? this.g : t0; } @@ -1237,146 +1404,11 @@ index f4c1b8d32b239c44e70d3fa6d094b74955f75339..ed77117630d54b7ad81f633110c7d2a7 int j = along.length * 64 / 4096; if (this.h == this.b) { -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -index 5fae0ec8933cef2b87d2f465c8019af0af2e130d..b9276928a58d56ca9aac95d262d8555522946bd7 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMapChunk.java -@@ -1,5 +1,6 @@ - package net.minecraft.server; - -+import com.destroystokyo.paper.antixray.ChunkPacketInfo; // Paper - Anti-Xray - Add chunk packet info - import com.google.common.collect.Lists; - import io.netty.buffer.ByteBuf; - import io.netty.buffer.Unpooled; -@@ -21,7 +22,13 @@ public class PacketPlayOutMapChunk implements Packet { - private List g; - private boolean h; - -- public PacketPlayOutMapChunk() {} -+ // Paper start - Async-Anti-Xray - Set the ready flag to true -+ private volatile boolean ready; // Paper - Async-Anti-Xray - Ready flag for the network manager -+ public PacketPlayOutMapChunk() { -+ this.ready = true; -+ } -+ // Paper end -+ - // Paper start - private final java.util.List extraPackets = new java.util.ArrayList<>(); - private static final int TE_LIMIT = Integer.getInteger("Paper.excessiveTELimit", 750); -@@ -31,7 +38,11 @@ public class PacketPlayOutMapChunk implements Packet { - return extraPackets; - } - // Paper end -- public PacketPlayOutMapChunk(Chunk chunk, int i) { -+ // Paper start - Anti-Xray - Add chunk packet info -+ @Deprecated public PacketPlayOutMapChunk(Chunk chunk, int i) { this(chunk, i, true); } // Notice for updates: Please make sure this constructor isn't used anywhere -+ public PacketPlayOutMapChunk(Chunk chunk, int i, boolean modifyBlocks) { -+ ChunkPacketInfo chunkPacketInfo = modifyBlocks ? chunk.world.chunkPacketBlockController.getChunkPacketInfo(this, chunk, i) : null; -+ // Paper end - ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); - - this.a = chunkcoordintpair.x; -@@ -54,7 +65,12 @@ public class PacketPlayOutMapChunk implements Packet { - } - - this.f = new byte[this.a(chunk, i)]; -- this.c = this.a(new PacketDataSerializer(this.j()), chunk, i); -+ // Paper start - Anti-Xray - Add chunk packet info -+ if (chunkPacketInfo != null) { -+ chunkPacketInfo.setData(this.getData()); -+ } -+ this.c = this.writeChunk(new PacketDataSerializer(this.j()), chunk, i, chunkPacketInfo); -+ // Paper end - this.g = Lists.newArrayList(); - iterator = chunk.getTileEntities().entrySet().iterator(); - int totalTileEntities = 0; // Paper -@@ -81,8 +97,19 @@ public class PacketPlayOutMapChunk implements Packet { - this.g.add(nbttagcompound); - } - } -+ chunk.world.chunkPacketBlockController.modifyBlocks(this, chunkPacketInfo); // Paper - Anti-Xray - Modify blocks -+ } - -+ // Paper start - Async-Anti-Xray - Getter and Setter for the ready flag -+ @Override -+ public boolean isReady() { -+ return this.ready; -+ } -+ -+ public void setReady(boolean ready) { -+ this.ready = ready; - } -+ // Paper end - - @Override - public void a(PacketDataSerializer packetdataserializer) throws IOException { -@@ -148,8 +175,12 @@ public class PacketPlayOutMapChunk implements Packet { - return bytebuf; - } - -- public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // Paper - OBFHELPER -- public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { -+ // Paper start - Anti-Xray - Add chunk packet info -+ @Deprecated public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector) { return this.a(packetDataSerializer, chunk, chunkSectionSelector); } // OBFHELPER // Notice for updates: Please make sure this method isn't used anywhere -+ @Deprecated public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i) { return this.writeChunk(packetdataserializer, chunk, i, null); } // Notice for updates: Please make sure this method isn't used anywhere -+ public int writeChunk(PacketDataSerializer packetDataSerializer, Chunk chunk, int chunkSectionSelector, ChunkPacketInfo chunkPacketInfo) { return this.a(packetDataSerializer, chunk, chunkSectionSelector, chunkPacketInfo); } // OBFHELPER -+ public int a(PacketDataSerializer packetdataserializer, Chunk chunk, int i, ChunkPacketInfo chunkPacketInfo) { -+ // Paper end - int j = 0; - ChunkSection[] achunksection = chunk.getSections(); - int k = 0; -@@ -159,7 +190,7 @@ public class PacketPlayOutMapChunk implements Packet { - - if (chunksection != Chunk.a && (!this.f() || !chunksection.c()) && (i & 1 << k) != 0) { - j |= 1 << k; -- chunksection.b(packetdataserializer); -+ chunksection.writeChunkSection(packetdataserializer, chunkPacketInfo); // Paper - Anti-Xray - Add chunk packet info - } - } - -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index abe94c9b7262a67de1a93914d94550f5d0abed28..8f0590c2d5965b76083cb39f99f5ab4f33b01ed1 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -610,7 +610,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - - this.g(chunkcoordintpair); -- return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a)); -+ return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter - }, this.executor); - } - -@@ -1350,9 +1350,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - } - -+ private final void sendChunk(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { this.a(entityplayer, apacket, chunk); } // Paper - OBFHELPER - private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { - if (apacket[0] == null) { -- apacket[0] = new PacketPlayOutMapChunk(chunk, 65535); -+ apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass - apacket[1] = new PacketPlayOutLightUpdate(chunk.getPos(), this.lightEngine, true); - } - -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 21acea46a288348cbc2d4fa312035d6679987399..6ea691d81ea62bf05225baa303d974a6df0b822b 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -276,6 +276,8 @@ public class PlayerInteractManager { - } - - } -+ -+ this.world.chunkPacketBlockController.onPlayerLeftClickBlock(this, blockposition, enumdirection); // Paper - Anti-Xray - } - - public void a(BlockPosition blockposition, PacketPlayInBlockDig.EnumPlayerDigType packetplayinblockdig_enumplayerdigtype, String s) { -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 2bcd26ccccf4503241c6b77600ed6ce1d94ccfcc..912c5187a08e972fc9455aed33278387a83f03f2 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -46,16 +46,24 @@ public class ProtoChunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +index 9eeb99a21a6ed7f71ff64cf4cfdff646d31abbcf..9b308a10554b037ede0c455fbd3e906021218ddc 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +@@ -64,16 +64,24 @@ public class ProtoChunk implements IChunkAccess { private long s; private final Map t; private volatile boolean u; @@ -1404,7 +1436,7 @@ index 2bcd26ccccf4503241c6b77600ed6ce1d94ccfcc..912c5187a08e972fc9455aed33278387 this.f = Maps.newEnumMap(HeightMap.Type.class); this.g = ChunkStatus.EMPTY; this.h = Maps.newHashMap(); -@@ -210,7 +218,7 @@ public class ProtoChunk implements IChunkAccess { +@@ -228,7 +236,7 @@ public class ProtoChunk implements IChunkAccess { public ChunkSection a(int i) { if (this.j[i] == Chunk.a) { @@ -1413,11 +1445,11 @@ index 2bcd26ccccf4503241c6b77600ed6ce1d94ccfcc..912c5187a08e972fc9455aed33278387 } return this.j[i]; -diff --git a/src/main/java/net/minecraft/server/ProtoChunkExtension.java b/src/main/java/net/minecraft/server/ProtoChunkExtension.java -index 420bf7116def909d3dd7dc9a799723446ddf8f7f..300cbb8b01d94e7eb0cded0c8e118103c416d4b6 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunkExtension.java -+++ b/src/main/java/net/minecraft/server/ProtoChunkExtension.java -@@ -11,7 +11,7 @@ public class ProtoChunkExtension extends ProtoChunk { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java +index 9351e6ba541d440c485b6e4a3209170c5756e31e..7a82d43d51d80a3054e0871bf4b9aa7635920efc 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunkExtension.java +@@ -27,7 +27,7 @@ public class ProtoChunkExtension extends ProtoChunk { private final Chunk a; public ProtoChunkExtension(Chunk chunk) { @@ -1426,62 +1458,30 @@ index 420bf7116def909d3dd7dc9a799723446ddf8f7f..300cbb8b01d94e7eb0cded0c8e118103 this.a = chunk; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 342374450382fea241659f5b63a9cc9a17dcb7b8..16bc226dfef36b5f96d95f2de4c6bc2e6e606332 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -2,6 +2,8 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 839d3d08a2d1ff6714645517906598a87075687b..2853f9e06064a5c0fe2b0e5df75223d1275eae20 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -100,7 +100,7 @@ public class ChunkRegionLoader { + byte b0 = nbttagcompound2.getByte("Y"); - import co.aikar.timings.Timing; - import co.aikar.timings.Timings; -+import com.destroystokyo.paper.antixray.ChunkPacketBlockController; // Paper - Anti-Xray -+import com.destroystokyo.paper.antixray.ChunkPacketBlockControllerAntiXray; // Paper - Anti-Xray - import com.destroystokyo.paper.event.server.ServerExceptionEvent; - import com.destroystokyo.paper.exception.ServerInternalException; - import com.google.common.base.MoreObjects; -@@ -84,6 +86,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot + if (nbttagcompound2.hasKeyOfType("Palette", 9) && nbttagcompound2.hasKeyOfType("BlockStates", 12)) { +- ChunkSection chunksection = new ChunkSection(b0 << 4); ++ ChunkSection chunksection = new ChunkSection(b0 << 4, null, worldserver, false); // Paper - Anti-Xray - Add parameters - public final com.destroystokyo.paper.PaperWorldConfig paperConfig; // Paper -+ public final ChunkPacketBlockController chunkPacketBlockController; // Paper - Anti-Xray + chunksection.getBlocks().a(nbttagcompound2.getList("Palette", 10), nbttagcompound2.getLongArray("BlockStates")); + chunksection.recalcBlockCounts(); +@@ -164,7 +164,7 @@ public class ChunkRegionLoader { + // CraftBukkit end + }); + } else { +- ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1); ++ ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter - public final co.aikar.timings.WorldTimingsHandler timings; // Paper - public static BlockPosition lastPhysicsProblem; // Spigot -@@ -105,9 +108,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return typeKey; - } - -- protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env) { -+ protected World(WorldDataMutable worlddatamutable, ResourceKey resourcekey, final DimensionManager dimensionmanager, Supplier supplier, boolean flag, boolean flag1, long i, org.bukkit.generator.ChunkGenerator gen, org.bukkit.World.Environment env, java.util.concurrent.Executor executor) { // Paper - this.spigotConfig = new org.spigotmc.SpigotWorldConfig(((WorldDataServer) worlddatamutable).getName()); // Spigot - this.paperConfig = new com.destroystokyo.paper.PaperWorldConfig(((WorldDataServer) worlddatamutable).getName(), this.spigotConfig); // Paper -+ this.chunkPacketBlockController = this.paperConfig.antiXray ? new ChunkPacketBlockControllerAntiXray(this, executor) : ChunkPacketBlockController.NO_OPERATION_INSTANCE; // Paper - Anti-Xray - this.generator = gen; - this.world = new CraftWorld((WorldServer) this, gen, env); - this.ticksPerAnimalSpawns = this.getServer().getTicksPerAnimalSpawns(); // CraftBukkit -@@ -373,6 +377,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - // CraftBukkit end - - IBlockData iblockdata1 = chunk.setType(blockposition, iblockdata, (i & 64) != 0, (i & 1024) == 0); // CraftBukkit custom NO_PLACE flag -+ this.chunkPacketBlockController.onBlockChange(this, blockposition, iblockdata, iblockdata1, i); // Paper - Anti-Xray - - if (iblockdata1 == null) { - // CraftBukkit start - remove blockstate if failed (or the same) -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3f97befa2742a575b103b68b19fc6415bfbd8c04..5ce589e38f924c1a60597589ea12d15dbc2a479c 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -100,7 +100,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { -- super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env); -+ super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor - this.pvpMode = minecraftserver.getPVP(); - convertable = convertable_conversionsession; - uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); + protochunk.a(biomestorage); + object = protochunk; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 569c0dd3d22c6ae154d3184905f5c09f9cbee238..f09e783e38bbe4d8e825abf77884b9cb307bcce4 100644 +index a8e94f69faec93661dc6ae2efeec44b8bfd2e965..c36f55f178166eb099cc5c64784be5a9f4750199 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -44,7 +44,7 @@ public class CraftChunk implements Chunk { @@ -1492,18 +1492,18 @@ index 569c0dd3d22c6ae154d3184905f5c09f9cbee238..f09e783e38bbe4d8e825abf77884b9cb + private static final DataPaletteBlock emptyBlockIDs = new ChunkSection(0, null, null, true).getBlocks(); // Paper - Anti-Xray - Add parameters private static final byte[] emptyLight = new byte[2048]; - public CraftChunk(net.minecraft.server.Chunk chunk) { + public CraftChunk(net.minecraft.world.level.chunk.Chunk chunk) { @@ -288,7 +288,7 @@ public class CraftChunk implements Chunk { NBTTagCompound data = new NBTTagCompound(); cs[i].getBlocks().a(data, "Palette", "BlockStates"); -- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection -+ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.server.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally +- DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.world.level.block.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData()); // TODO: snapshot whole ChunkSection ++ DataPaletteBlock blockids = new DataPaletteBlock<>(ChunkSection.GLOBAL_PALETTE, net.minecraft.world.level.block.Block.REGISTRY_ID, GameProfileSerializer::c, GameProfileSerializer::a, Blocks.AIR.getBlockData(), null, false); // TODO: snapshot whole ChunkSection // Paper - Anti-Xray - Add no predefined block data and don't initialize because it's done in the line below internally blockids.a(data.getList("Palette", CraftMagicNumbers.NBT.TAG_COMPOUND), data.getLongArray("BlockStates")); sectionBlockIDs[i] = blockids; diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index 8191e7c34899e204b8afbb2fd11d235e8ef8db99..bb18740ebdf4a14ced9944efa82103b350b32ba5 100644 +index 3d15915275331cb767750c24c89b4b43d43033ef..afca0038bb74ac53f07a25729a3c1542e244c6fd 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -21,9 +21,11 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { diff --git a/Spigot-Server-Patches/0364-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch b/Spigot-Server-Patches/0364-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch index 79b73bbf77..b7f512ff2e 100644 --- a/Spigot-Server-Patches/0364-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch +++ b/Spigot-Server-Patches/0364-Only-count-Natural-Spawned-mobs-towards-natural-spaw.patch @@ -37,11 +37,11 @@ index c45493e88bf7e8811be2759ff9ac19e3fe9d938a..384cb363eed794551bee6b0ec11ba1be public boolean antiXray; public EngineMode engineMode; public int maxChunkSectionIndex; -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 60f0301747ff2363007791432471c20471d79f01..979988c3c39afd80ce0b99a65dff5618a69ab600 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -48,6 +48,13 @@ public final class SpawnerCreature { +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +index 28b3a74d139820f91775d3377d79675d308aff65..166609e03474946882791dbebafe7121a3727854 100644 +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +@@ -80,6 +80,13 @@ public final class SpawnerCreature { EnumCreatureType enumcreaturetype = entity.getEntityType().e(); if (enumcreaturetype != EnumCreatureType.MISC) { diff --git a/Spigot-Server-Patches/0365-Configurable-projectile-relative-velocity.patch b/Spigot-Server-Patches/0365-Configurable-projectile-relative-velocity.patch index 1c2407f5fb..343b1ed420 100644 --- a/Spigot-Server-Patches/0365-Configurable-projectile-relative-velocity.patch +++ b/Spigot-Server-Patches/0365-Configurable-projectile-relative-velocity.patch @@ -38,11 +38,11 @@ index 384cb363eed794551bee6b0ec11ba1be92a3d7ac..1ee2cced100626e48eb36ee14f84b925 + disableRelativeProjectileVelocity = getBoolean("game-mechanics.disable-relative-projectile-velocity", false); + } } -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java -index 8d26521bc414b3d34f496e966f0c918b023f4833..9f5ce64a60fe7c312399ee416b11b84213dd3bee 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java -@@ -114,7 +114,7 @@ public abstract class IProjectile extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +index 1ff55a1b6c1faae95a83cd8fc12a2045ad479145..0e3c646dca1fa1fa895c3aece037367a9b2cf378 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +@@ -125,7 +125,7 @@ public abstract class IProjectile extends Entity { this.shoot((double) f5, (double) f6, (double) f7, f3, f4); Vec3D vec3d = entity.getMot(); diff --git a/Spigot-Server-Patches/0366-Mark-entities-as-being-ticked-when-notifying-navigat.patch b/Spigot-Server-Patches/0366-Mark-entities-as-being-ticked-when-notifying-navigat.patch index 1309794f71..6a6a5226e3 100644 --- a/Spigot-Server-Patches/0366-Mark-entities-as-being-ticked-when-notifying-navigat.patch +++ b/Spigot-Server-Patches/0366-Mark-entities-as-being-ticked-when-notifying-navigat.patch @@ -4,11 +4,11 @@ Date: Sun, 28 Jul 2019 00:51:11 +0100 Subject: [PATCH] Mark entities as being ticked when notifying navigation -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 5ce589e38f924c1a60597589ea12d15dbc2a479c..6f9c3f913b2afbde3b5e285ffb9ee49017fa5464 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1364,6 +1364,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 8b7e6dfa146abc3b4c8a5b0646e0ef1453ddb68c..86e6a11c760b2ec47711bd8327b185ae902c4527 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1473,6 +1473,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); if (VoxelShapes.c(voxelshape, voxelshape1, OperatorBoolean.NOT_SAME)) { @@ -16,7 +16,7 @@ index 5ce589e38f924c1a60597589ea12d15dbc2a479c..6f9c3f913b2afbde3b5e285ffb9ee490 Iterator iterator = this.navigators.iterator(); while (iterator.hasNext()) { -@@ -1385,6 +1386,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1494,6 +1495,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } diff --git a/Spigot-Server-Patches/0367-offset-item-frame-ticking.patch b/Spigot-Server-Patches/0367-offset-item-frame-ticking.patch index 81874da096..b2190b5c55 100644 --- a/Spigot-Server-Patches/0367-offset-item-frame-ticking.patch +++ b/Spigot-Server-Patches/0367-offset-item-frame-ticking.patch @@ -4,11 +4,11 @@ Date: Tue, 30 Jul 2019 03:17:16 +0500 Subject: [PATCH] offset item frame ticking -diff --git a/src/main/java/net/minecraft/server/EntityHanging.java b/src/main/java/net/minecraft/server/EntityHanging.java -index 2fb7abc3639036a54512056cc75c518be085a3f1..747b0b7e6f7412751e8fa7ab98fe642a78760a87 100644 ---- a/src/main/java/net/minecraft/server/EntityHanging.java -+++ b/src/main/java/net/minecraft/server/EntityHanging.java -@@ -15,7 +15,7 @@ public abstract class EntityHanging extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java b/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java +index 477c86bec21159608707c1b3bf2ad5f2b455214f..9d491240bcb3ba6ffbee963a13d31aa7b6cd5d45 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityHanging.java +@@ -37,7 +37,7 @@ public abstract class EntityHanging extends Entity { protected static final Predicate b = (entity) -> { return entity instanceof EntityHanging; }; diff --git a/Spigot-Server-Patches/0368-Avoid-hopper-searches-if-there-are-no-items.patch b/Spigot-Server-Patches/0368-Avoid-hopper-searches-if-there-are-no-items.patch index c8c1bfae8b..4773ab73f6 100644 --- a/Spigot-Server-Patches/0368-Avoid-hopper-searches-if-there-are-no-items.patch +++ b/Spigot-Server-Patches/0368-Avoid-hopper-searches-if-there-are-no-items.patch @@ -13,11 +13,23 @@ And since minecart hoppers are used _very_ rarely near we can avoid alot of sear Combined, this adds up a lot. -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 6763ecaf5f814302c310f29e3a5a42fc1312a990..0601e9cdeb33dec82642ee9fbfaac1712bd0fae9 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -85,6 +85,10 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +index cb5cda5e6497edeb801ef712f9bd8823cb055750..1a6f8aec32af85717f5d56e0b00a02cda88ce028 100644 +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -16,6 +16,7 @@ public final class IEntitySelector { + public static final Predicate c = (entity) -> { + return entity.isAlive() && !entity.isVehicle() && !entity.isPassenger(); + }; ++ public static final Predicate isInventory() { return d; } // Paper - OBFHELPER + public static final Predicate d = (entity) -> { + return entity instanceof IInventory && entity.isAlive(); + }; +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 9b75e5ea8987421523e0324a83db317f150d3f48..46467230aac994e2b3864b7a1eddc701c4ade91c 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -119,6 +119,10 @@ public class Chunk implements IChunkAccess { return removed; } } @@ -28,7 +40,7 @@ index 6763ecaf5f814302c310f29e3a5a42fc1312a990..0601e9cdeb33dec82642ee9fbfaac171 // Paper end public Chunk(World world, ChunkCoordIntPair chunkcoordintpair, BiomeStorage biomestorage, ChunkConverter chunkconverter, TickList ticklist, TickList ticklist1, long i, @Nullable ChunkSection[] achunksection, @Nullable Consumer consumer) { -@@ -544,6 +548,13 @@ public class Chunk implements IChunkAccess { +@@ -578,6 +582,13 @@ public class Chunk implements IChunkAccess { entity.chunkZ = this.loc.z; this.entities.add(entity); // Paper - per chunk entity list this.entitySlices[k].add(entity); @@ -42,7 +54,7 @@ index 6763ecaf5f814302c310f29e3a5a42fc1312a990..0601e9cdeb33dec82642ee9fbfaac171 entity.entitySlice = this.entitySlices[k]; // Paper this.markDirty(); // Paper } -@@ -577,6 +588,11 @@ public class Chunk implements IChunkAccess { +@@ -611,6 +622,11 @@ public class Chunk implements IChunkAccess { if (!this.entitySlices[i].remove(entity)) { return; } @@ -54,7 +66,7 @@ index 6763ecaf5f814302c310f29e3a5a42fc1312a990..0601e9cdeb33dec82642ee9fbfaac171 entityCounts.decrement(entity.getMinecraftKeyString()); this.markDirty(); // Paper // Paper end -@@ -862,6 +878,14 @@ public class Chunk implements IChunkAccess { +@@ -896,6 +912,14 @@ public class Chunk implements IChunkAccess { for (int k = i; k <= j; ++k) { Iterator iterator = this.entitySlices[k].iterator(); // Spigot @@ -69,7 +81,7 @@ index 6763ecaf5f814302c310f29e3a5a42fc1312a990..0601e9cdeb33dec82642ee9fbfaac171 while (iterator.hasNext()) { T entity = (T) iterator.next(); // CraftBukkit - decompile error if (entity.shouldBeRemoved) continue; // Paper -@@ -882,9 +906,29 @@ public class Chunk implements IChunkAccess { +@@ -916,9 +940,29 @@ public class Chunk implements IChunkAccess { i = MathHelper.clamp(i, 0, this.entitySlices.length - 1); j = MathHelper.clamp(j, 0, this.entitySlices.length - 1); @@ -99,15 +111,3 @@ index 6763ecaf5f814302c310f29e3a5a42fc1312a990..0601e9cdeb33dec82642ee9fbfaac171 while (iterator.hasNext()) { T t0 = (T) iterator.next(); // CraftBukkit - decompile error if (t0.shouldBeRemoved) continue; // Paper -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 3d54b7a4bf102dfc568e782706f67e4b5269eaf1..3913af9e27139538114580f7967cbf990d9307f7 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -11,6 +11,7 @@ public final class IEntitySelector { - public static final Predicate c = (entity) -> { - return entity.isAlive() && !entity.isVehicle() && !entity.isPassenger(); - }; -+ public static final Predicate isInventory() { return d; } // Paper - OBFHELPER - public static final Predicate d = (entity) -> { - return entity instanceof IInventory && entity.isAlive(); - }; diff --git a/Spigot-Server-Patches/0369-Asynchronous-chunk-IO-and-loading.patch b/Spigot-Server-Patches/0369-Asynchronous-chunk-IO-and-loading.patch index b8fcaceba4..a2d7b9c369 100644 --- a/Spigot-Server-Patches/0369-Asynchronous-chunk-IO-and-loading.patch +++ b/Spigot-Server-Patches/0369-Asynchronous-chunk-IO-and-loading.patch @@ -161,7 +161,7 @@ index 944fd203e9f39d6c6fc9e270940c76c98067273a..a27dc38d1a29ed1d63d2f44b7984c2b6 public static Timing getTickList(WorldServer worldserver, String timingsType) { diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 901c16ef303d4744ec8043a506dd894215dd1b6a..a6aa757137d644c1fe342e23f6d025e0f4dd5aac 100644 +index a7a02072e5c7ce62cbecbb638fcc74abf2fb57ee..f657e9b6bb3d24a6c77ef584711a003d1eea0341 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java @@ -1,5 +1,6 @@ @@ -2299,11 +2299,63 @@ index 0000000000000000000000000000000000000000..49a594e5f345096cb3b9913b8ee27607 + } + +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 71c7bf2fd4fdb0ad880ca81c198a7cf25cdb9e87..03e59fd8dc339f3479243acb5d1c89883b280b68 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -310,11 +310,138 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java +index e201e4efd4ecc65ec3c38528a4ec5336e2d51ab2..45f3f8964a587c382b6ea82560e9da30be42987f 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInTabComplete.java +@@ -14,7 +14,7 @@ public class PacketPlayInTabComplete implements Packet { + @Override + public void a(PacketDataSerializer packetdataserializer) throws IOException { + this.a = packetdataserializer.i(); +- this.b = packetdataserializer.e(32500); ++ this.b = packetdataserializer.e(2048); + } + + @Override +diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java +index 5f8b8b5fac14983fbeb64ce3f09bf9a885179e8c..2489a29e344145f3ce4ff3c9fe08d6ee64a47acb 100644 +--- a/src/main/java/net/minecraft/server/MCUtil.java ++++ b/src/main/java/net/minecraft/server/MCUtil.java +@@ -704,4 +704,9 @@ public final class MCUtil { + out.print(fileData); + } + } ++ ++ public static int getTicketLevelFor(ChunkStatus status) { ++ // TODO make sure the constant `33` is correct on future updates. See getChunkAt(int, int, ChunkStatus, boolean) ++ return 33 + ChunkStatus.getTicketLevelOffset(status); ++ } + } +diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java +index 191a74bd9b894f9d64d0a55747cb17e07ceef597..949e374d1e3bdbe31b160ad5ab6c0153f16fb07e 100644 +--- a/src/main/java/net/minecraft/server/Main.java ++++ b/src/main/java/net/minecraft/server/Main.java +@@ -210,6 +210,7 @@ public class Main { + + convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object); + */ ++ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async + final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.a((thread) -> { + DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new); + +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index 1d8695ac6692194c9a1cfd46c9d735120ca75245..eafee14262ac8abb482bdd0fa52a8a33bf4a0f87 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -910,7 +910,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { return this.getChunkAt(i, j, chunkstatus, flag); -@@ -337,11 +464,16 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -359,11 +486,16 @@ public class ChunkProviderServer extends IChunkProvider { } gameprofilerfiller.c("getChunkCacheMiss"); @@ -2460,7 +2512,7 @@ index 71c7bf2fd4fdb0ad880ca81c198a7cf25cdb9e87..03e59fd8dc339f3479243acb5d1c8988 this.world.timings.syncChunkLoad.stopTiming(); // Paper } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { -@@ -407,6 +539,11 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -429,6 +561,11 @@ public class ChunkProviderServer extends IChunkProvider { } private CompletableFuture> getChunkFutureMainThread(int i, int j, ChunkStatus chunkstatus, boolean flag) { @@ -2472,7 +2524,7 @@ index 71c7bf2fd4fdb0ad880ca81c198a7cf25cdb9e87..03e59fd8dc339f3479243acb5d1c8988 ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(i, j); long k = chunkcoordintpair.pair(); int l = 33 + ChunkStatus.a(chunkstatus); -@@ -806,11 +943,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -828,11 +965,12 @@ public class ChunkProviderServer extends IChunkProvider { protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task try { @@ -2486,10 +2538,814 @@ index 71c7bf2fd4fdb0ad880ca81c198a7cf25cdb9e87..03e59fd8dc339f3479243acb5d1c8988 } } finally { playerChunkMap.callbackExecutor.run(); -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be44578353e3e 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 75d4a8fc394449ccc006fe67a8842edcd9f36854..6433463938d8bb717840c8f57fe6e7079e1030f2 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -158,6 +158,18 @@ public class PlayerChunk { + } + return null; + } ++ ++ public ChunkStatus getChunkHolderStatus() { ++ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getPreviousStatus(); curr != next; curr = next, next = next.getPreviousStatus()) { ++ CompletableFuture> future = this.getStatusFutureUnchecked(curr); ++ Either either = future.getNow(null); ++ if (either == null || !either.left().isPresent()) { ++ continue; ++ } ++ return curr; ++ } ++ return null; ++ } + // Paper end + + public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { +@@ -376,7 +388,7 @@ public class PlayerChunk { + ChunkStatus chunkstatus = getChunkStatus(this.oldTicketLevel); + ChunkStatus chunkstatus1 = getChunkStatus(this.ticketLevel); + boolean flag = this.oldTicketLevel <= PlayerChunkMap.GOLDEN_TICKET; +- boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET; ++ boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET; // Paper - diff on change: (flag1 = new ticket level is in loadable range) + PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel); + PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel); + // CraftBukkit start +@@ -412,6 +424,12 @@ public class PlayerChunk { + } + }); + ++ // Paper start ++ if (!flag1) { ++ playerchunkmap.world.asyncChunkTaskManager.cancelChunkLoad(this.location.x, this.location.z); ++ } ++ // Paper end ++ + for (int i = flag1 ? chunkstatus1.c() + 1 : 0; i <= chunkstatus.c(); ++i) { + completablefuture = (CompletableFuture) this.statusFutures.get(i); + if (completablefuture != null) { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 78e2c2bab951a8f7759ea5badc3275ef4f00e9ba..a9c970f6a3227c37e55549488ab9bdadf833b0c1 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -110,7 +110,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + private final LightEngineThreaded lightEngine; + private final IAsyncTaskHandler executor; + public final ChunkGenerator chunkGenerator; +- private final Supplier l; ++ private final Supplier l; public final Supplier getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER + private final VillagePlace m; + public final LongSet unloadQueue; + private boolean updatingChunksModified; +@@ -120,7 +120,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + public final WorldLoadListener worldLoadListener; + public final PlayerChunkMap.a chunkDistanceManager; + private final AtomicInteger u; +- private final DefinedStructureManager definedStructureManager; ++ public final DefinedStructureManager definedStructureManager; // Paper - private -> public + private final File w; + private final PlayerMap playerMap; + public final Int2ObjectMap trackedEntities; +@@ -203,7 +203,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false)); + this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); + this.l = supplier; +- this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag); ++ this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper + this.setViewDistance(i); + } + +@@ -245,12 +245,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + + @Nullable +- protected PlayerChunk getUpdatingChunk(long i) { ++ public PlayerChunk getUpdatingChunk(long i) { // Paper + return (PlayerChunk) this.updatingChunks.get(i); + } + + @Nullable +- protected PlayerChunk getVisibleChunk(long i) { ++ public PlayerChunk getVisibleChunk(long i) { // Paper - protected -> public + return (PlayerChunk) this.visibleChunks.get(i); + } + +@@ -372,6 +372,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + public void close() throws IOException { + try { + this.p.close(); ++ this.world.asyncChunkTaskManager.close(true); // Paper - Required since we're closing regionfiles in the next line + this.m.close(); + } finally { + super.close(); +@@ -463,7 +464,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + this.b(() -> { + return true; + }); +- this.i(); ++ this.world.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour ++// this.i(); // Paper - nuke IOWorker + PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName()); + } else { + this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> { +@@ -479,16 +481,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + } + +- private static final double UNLOAD_QUEUE_RESIZE_FACTOR = 0.96; // Spigot ++ private static final double UNLOAD_QUEUE_RESIZE_FACTOR = 0.90; // Spigot // Paper - unload more + + protected void unloadChunks(BooleanSupplier booleansupplier) { + GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); + ++ try (Timing ignored = this.world.timings.poiUnload.startTiming()) { // Paper + gameprofilerfiller.enter("poi"); + this.m.a(booleansupplier); ++ } // Paper + gameprofilerfiller.exitEnter("chunk_unload"); + if (!this.world.isSavingDisabled()) { ++ try (Timing ignored = this.world.timings.chunkUnload.startTiming()) { // Paper + this.b(booleansupplier); ++ }// Paper + } + + gameprofilerfiller.exit(); +@@ -509,12 +515,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + if (playerchunk != null) { + this.pendingUnload.put(j, playerchunk); + this.updatingChunksModified = true; ++ this.a(j, playerchunk); // Paper - Move up - don't leak chunks + // Spigot start + if (!booleansupplier.getAsBoolean() && this.unloadQueue.size() <= targetSize && activityAccountant.activityTimeIsExhausted()) { + break; + } + // Spigot end +- this.a(j, playerchunk); ++ //this.a(j, playerchunk); // Paper - move up because spigot did a dumb + } + } + activityAccountant.endActivity(); // Spigot +@@ -528,6 +535,60 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + } + ++ // Paper start - async chunk save for unload ++ // Note: This is very unsafe to call if the chunk is still in use. ++ // This is also modeled after PlayerChunkMap#saveChunk(IChunkAccess, boolean), with the intentional difference being ++ // serializing the chunk is left to a worker thread. ++ private void asyncSave(IChunkAccess chunk) { ++ ChunkCoordIntPair chunkPos = chunk.getPos(); ++ NBTTagCompound poiData; ++ try (Timing ignored = this.world.timings.chunkUnloadPOISerialization.startTiming()) { ++ poiData = this.getVillagePlace().getData(chunk.getPos()); ++ } ++ ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkPos.x, chunkPos.z, ++ poiData, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); ++ ++ if (!chunk.isNeedsSaving()) { ++ return; ++ } ++ ++ ChunkStatus chunkstatus = chunk.getChunkStatus(); ++ ++ // Copied from PlayerChunkMap#saveChunk(IChunkAccess, boolean) ++ if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { ++ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper ++ // Paper start - Optimize save by using status cache ++ try { ++ ChunkStatus statusOnDisk = this.getChunkStatusOnDisk(chunkPos); ++ if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) { ++ // Paper end ++ return; ++ } ++ ++ if (chunkstatus == ChunkStatus.EMPTY && chunk.h().values().stream().noneMatch(StructureStart::e)) { ++ return; ++ } ++ } catch (IOException ex) { ++ ex.printStackTrace(); ++ return; ++ } ++ } ++ } ++ ++ ChunkRegionLoader.AsyncSaveData asyncSaveData; ++ try (Timing ignored = this.world.timings.chunkUnloadPrepareSave.startTiming()) { ++ asyncSaveData = ChunkRegionLoader.getAsyncSaveData(this.world, chunk); ++ } ++ ++ this.world.asyncChunkTaskManager.scheduleChunkSave(chunkPos.x, chunkPos.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY, ++ asyncSaveData, chunk); ++ ++ chunk.setLastSaved(this.world.getTime()); ++ chunk.setNeedsSaving(false); ++ } ++ // Paper end ++ + private void a(long i, PlayerChunk playerchunk) { + CompletableFuture completablefuture = playerchunk.getChunkSave(); + Consumer consumer = (ichunkaccess) -> { // CraftBukkit - decompile error +@@ -541,7 +602,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + ((Chunk) ichunkaccess).setLoaded(false); + } + +- this.saveChunk(ichunkaccess); ++ //this.saveChunk(ichunkaccess);// Paper - delay + if (this.loadedChunks.remove(i) && ichunkaccess instanceof Chunk) { + Chunk chunk = (Chunk) ichunkaccess; + +@@ -549,6 +610,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + this.autoSaveQueue.remove(playerchunk); // Paper + ++ try { ++ this.asyncSave(ichunkaccess); // Paper - async chunk saving ++ } catch (Throwable ex) { ++ LOGGER.fatal("Failed to prepare async save, attempting synchronous save", ex); ++ this.saveChunk(ichunkaccess); ++ } ++ + this.lightEngine.a(ichunkaccess.getPos()); + this.lightEngine.queueUpdate(); + this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null); +@@ -619,19 +687,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + + private CompletableFuture> f(ChunkCoordIntPair chunkcoordintpair) { +- return CompletableFuture.supplyAsync(() -> { ++ // Paper start - Async chunk io ++ final java.util.function.BiFunction> syncLoadComplete = (chunkHolder, ioThrowable) -> { + try (Timing ignored = this.world.timings.chunkLoad.startTimingIfSync()) { // Paper + this.world.getMethodProfiler().c("chunkLoad"); +- NBTTagCompound nbttagcompound; // Paper +- try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings +- nbttagcompound = this.readChunkData(chunkcoordintpair); +- } // Paper end ++ // Paper start ++ if (ioThrowable != null) { ++ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable); ++ } + +- if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings +- boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); ++ this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData); ++ chunkHolder.tasks.forEach(Runnable::run); ++ // Paper end + +- if (flag) { +- ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound); ++ if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async ++ ++ if (true) { ++ ProtoChunk protochunk = chunkHolder.protoChunk; + + protochunk.setLastSaved(this.world.getTime()); + this.a(chunkcoordintpair, protochunk.getChunkStatus().getType()); +@@ -655,7 +727,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + this.g(chunkcoordintpair); + return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter +- }, this.executor); ++ // Paper start - Async chunk io ++ }; ++ CompletableFuture> ret = new CompletableFuture<>(); ++ ++ Consumer chunkHolderConsumer = (ChunkRegionLoader.InProgressChunkHolder holder) -> { ++ // Go into the chunk load queue and not server task queue so we can be popped out even faster. ++ com.destroystokyo.paper.io.chunk.ChunkTaskManager.queueChunkWaitTask(() -> { ++ try { ++ ret.complete(syncLoadComplete.apply(holder, null)); ++ } catch (Exception e) { ++ ret.completeExceptionally(e); ++ } ++ }); ++ }; ++ ++ CompletableFuture chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z); ++ if (chunkSaveFuture != null) { ++ this.world.asyncChunkTaskManager.scheduleChunkLoad(chunkcoordintpair.x, chunkcoordintpair.z, ++ com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY, chunkHolderConsumer, false, chunkSaveFuture); ++ this.world.asyncChunkTaskManager.raisePriority(chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY); ++ } else { ++ this.world.asyncChunkTaskManager.scheduleChunkLoad(chunkcoordintpair.x, chunkcoordintpair.z, ++ com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY, chunkHolderConsumer, false); ++ } ++ return ret; ++ // Paper end + } + + private void g(ChunkCoordIntPair chunkcoordintpair) { +@@ -882,6 +979,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + + public boolean saveChunk(IChunkAccess ichunkaccess) { ++ try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper + this.m.a(ichunkaccess.getPos()); + if (!ichunkaccess.isNeedsSaving()) { + return false; +@@ -894,6 +992,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + ChunkStatus chunkstatus = ichunkaccess.getChunkStatus(); + + if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { ++ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper + if (this.h(chunkcoordintpair)) { + return false; + } +@@ -901,12 +1000,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) { + return false; + } ++ } // Paper + } + + this.world.getMethodProfiler().c("chunkSave"); +- NBTTagCompound nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); ++ NBTTagCompound nbttagcompound; ++ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveDataSerialization.startTiming()) { // Paper ++ nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); ++ } // Paper ++ + +- this.a(chunkcoordintpair, nbttagcompound); ++ // Paper start - async chunk io ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkcoordintpair.x, chunkcoordintpair.z, ++ null, nbttagcompound, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY); ++ // Paper end - async chunk io + this.a(chunkcoordintpair, chunkstatus.getType()); + return true; + } catch (Exception exception) { +@@ -915,6 +1022,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + return false; + } + } ++ } // Paper + } + + private boolean h(ChunkCoordIntPair chunkcoordintpair) { +@@ -1044,6 +1152,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + } + ++ // Paper start - Asynchronous chunk io ++ @Nullable ++ @Override ++ public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { ++ if (Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { ++ NBTTagCompound ret = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE ++ .loadChunkDataAsyncFuture(this.world, chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread(), ++ false, true, true).join().chunkData; ++ ++ if (ret == com.destroystokyo.paper.io.PaperFileIOThread.FAILURE_VALUE) { ++ throw new IOException("See logs for further detail"); ++ } ++ return ret; ++ } ++ return super.read(chunkcoordintpair); ++ } ++ ++ @Override ++ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { ++ if (Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave( ++ this.world, chunkcoordintpair.x, chunkcoordintpair.z, null, nbttagcompound, ++ com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread()); ++ return; ++ } ++ super.write(chunkcoordintpair, nbttagcompound); ++ } ++ // Paper end ++ + @Nullable + public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public + NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); +@@ -1065,33 +1202,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + // Paper start - chunk status cache "api" + public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) { +- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getRegionFileIfLoaded(chunkPos); ++ synchronized (this) { // Paper ++ RegionFile regionFile = this.regionFileCache.getRegionFileIfLoaded(chunkPos); + + return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); ++ } // Paper + } + + public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException { +- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, true); ++ // Paper start - async chunk save for unload ++ IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(chunkPos.x, chunkPos.z); ++ if (unloadingChunk != null) { ++ return unloadingChunk.getChunkStatus(); ++ } ++ // Paper end ++ // Paper start - async io ++ NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE ++ .getPendingWrite(this.world, chunkPos.x, chunkPos.z, false); + +- if (regionFile == null || !regionFile.chunkExists(chunkPos)) { +- return null; ++ if (inProgressWrite != null) { ++ return ChunkRegionLoader.getStatus(inProgressWrite); + } ++ // Paper end ++ synchronized (this) { // Paper - async io ++ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, true); ++ ++ if (regionFile == null || !regionFile.chunkExists(chunkPos)) { ++ return null; ++ } + +- ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); ++ ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); + +- if (status != null) { +- return status; ++ if (status != null) { ++ return status; ++ } ++ // Paper start - async io + } + +- this.readChunkData(chunkPos); ++ NBTTagCompound compound = this.readChunkData(chunkPos); + +- return regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); ++ return ChunkRegionLoader.getStatus(compound); ++ // Paper end + } + + public void updateChunkStatusOnDisk(ChunkCoordIntPair chunkPos, @Nullable NBTTagCompound compound) throws IOException { +- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); ++ synchronized (this) { ++ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, false); + +- regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); ++ regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); ++ } + } + + public IChunkAccess getUnloadingChunk(int chunkX, int chunkZ) { +@@ -1100,6 +1259,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + } + // Paper end + ++ ++ // Paper start - async io ++ // this function will not load chunk data off disk to check for status ++ // ret null for unknown, empty for empty status on disk or absent from disk ++ public ChunkStatus getStatusOnDiskNoLoad(int x, int z) { ++ // Paper start - async chunk save for unload ++ IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(x, z); ++ if (unloadingChunk != null) { ++ return unloadingChunk.getChunkStatus(); ++ } ++ // Paper end ++ // Paper start - async io ++ net.minecraft.server.NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE ++ .getPendingWrite(this.world, x, z, false); ++ ++ if (inProgressWrite != null) { ++ return net.minecraft.server.ChunkRegionLoader.getStatus(inProgressWrite); ++ } ++ // Paper end ++ // variant of PlayerChunkMap#getChunkStatusOnDisk that does not load data off disk, but loads the region file ++ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); ++ synchronized (world.getChunkProvider().playerChunkMap) { ++ net.minecraft.server.RegionFile file; ++ try { ++ file = world.getChunkProvider().playerChunkMap.regionFileCache.getFile(chunkPos, false); ++ } catch (IOException ex) { ++ throw new RuntimeException(ex); ++ } ++ ++ return !file.chunkExists(chunkPos) ? ChunkStatus.EMPTY : file.getStatusIfCached(x, z); ++ } ++ } ++ + boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { + // Spigot start + return isOutsideOfRange(chunkcoordintpair, false); +@@ -1446,6 +1638,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { + + } + ++ public VillagePlace getVillagePlace() { return this.h(); } // Paper - OBFHELPER + protected VillagePlace h() { + return this.m; + } +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index 285a03b57431bd6a4d26bb84e916d2c6e1eb0213..218dc900e125a11548485887b1918742072c7a77 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -26,6 +26,7 @@ public class TicketType { + public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit + public static final TicketType PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit + public static final TicketType FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper ++ public static final TicketType ASYNC_LOAD = a("async_load", Long::compareTo); // Paper + + public static TicketType a(String s, Comparator comparator) { + return new TicketType<>(s, comparator, 0L); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 86e6a11c760b2ec47711bd8327b185ae902c4527..ea89392698cd712844cde6976d60a1c2ba6f1b15 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -207,6 +207,79 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return this.chunkProvider.getChunkAt(x, z, false); + } + ++ // Paper start - Asynchronous IO ++ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController poiDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { ++ @Override ++ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { ++ WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().write(new ChunkCoordIntPair(x, z), compound); ++ } ++ ++ @Override ++ public NBTTagCompound readData(int x, int z) throws java.io.IOException { ++ return WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().read(new ChunkCoordIntPair(x, z)); ++ } ++ ++ @Override ++ public T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { ++ RegionFile file; ++ ++ try { ++ file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); ++ } catch (java.io.IOException ex) { ++ throw new RuntimeException(ex); ++ } ++ ++ return function.apply(file); ++ } ++ } ++ ++ @Override ++ public T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { ++ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); ++ return function.apply(file); ++ } ++ } ++ }; ++ ++ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController chunkDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { ++ @Override ++ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { ++ WorldServer.this.getChunkProvider().playerChunkMap.write(new ChunkCoordIntPair(x, z), compound); ++ } ++ ++ @Override ++ public NBTTagCompound readData(int x, int z) throws java.io.IOException { ++ return WorldServer.this.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)); ++ } ++ ++ @Override ++ public T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { ++ RegionFile file; ++ ++ try { ++ file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); ++ } catch (java.io.IOException ex) { ++ throw new RuntimeException(ex); ++ } ++ ++ return function.apply(file); ++ } ++ } ++ ++ @Override ++ public T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function function) { ++ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { ++ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); ++ return function.apply(file); ++ } ++ } ++ }; ++ public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; ++ // Paper end ++ + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -254,6 +327,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.dragonBattle = null; + } + this.getServer().addWorld(this.getWorld()); // CraftBukkit ++ ++ this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper + } + + // CraftBukkit start +@@ -1741,7 +1816,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> { +- getChunkProvider().getChunkAtMainThread(pair.x, pair.z); ++ getChunkProvider().getChunkAtAsynchronously(pair.x, pair.z, true, false).exceptionally((ex) -> { ++ ex.printStackTrace(); ++ return null; ++ }); + }); + } + public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 1cfa8a4066baaf86f10e3f709d9b1d60aba4dec5..24184c88f354baa082e2ceb0674a4a1a4e1eb65b 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -728,6 +728,13 @@ public class PlayerConnection implements PacketListenerPlayIn { + minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper + return; + } ++ // Paper start ++ String str = packetplayintabcomplete.c(); int index = -1; ++ if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { ++ minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper ++ return; ++ } ++ // Paper end + // CraftBukkit end + StringReader stringreader = new StringReader(packetplayintabcomplete.c()); + +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +index e5641f2b41d89a57285fc072a48b951aa03a14a7..ca23ca14d8011fc8daa7e20f2eaa550a8ff92c53 100644 +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +@@ -91,7 +91,7 @@ public abstract class IAsyncTaskHandler implements Mailbox public + while (this.executeNext()) { + ; + } +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +index aa1d948e6aebef25f0f4c4c07f5131d2e8387e59..6f3f968b30fdc210e47cb8d99139173869df1638 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +@@ -36,8 +36,16 @@ public class VillagePlace extends RegionFileSection { + private final VillagePlace.a a = new VillagePlace.a(); + private final LongSet b = new LongOpenHashSet(); + ++ private final WorldServer world; // Paper ++ + public VillagePlace(File file, DataFixer datafixer, boolean flag) { ++ // Paper start - add world parameter ++ this(file, datafixer, flag, null); ++ } ++ public VillagePlace(File file, DataFixer datafixer, boolean flag, WorldServer world) { + super(file, VillagePlaceSection::a, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK, flag); ++ this.world = world; ++ // Paper end - add world parameter + } + + public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) { +@@ -155,7 +163,23 @@ public class VillagePlace extends RegionFileSection { + + @Override + public void a(BooleanSupplier booleansupplier) { +- super.a(booleansupplier); ++ // Paper start - async chunk io ++ if (this.world == null) { ++ super.a(booleansupplier); ++ } else { ++ //super.a(booleansupplier); // re-implement below ++ while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { ++ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).r(); ++ ++ NBTTagCompound data; ++ try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) { ++ data = this.getData(chunkcoordintpair); ++ } ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, ++ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); ++ } ++ } ++ // Paper end + this.a.a(); + } + +@@ -255,6 +279,35 @@ public class VillagePlace extends RegionFileSection { + } + } + ++ // Paper start - Asynchronous chunk io ++ @javax.annotation.Nullable ++ @Override ++ public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws java.io.IOException { ++ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { ++ NBTTagCompound ret = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE ++ .loadChunkDataAsyncFuture(this.world, chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread(), ++ true, false, true).join().poiData; ++ ++ if (ret == com.destroystokyo.paper.io.PaperFileIOThread.FAILURE_VALUE) { ++ throw new java.io.IOException("See logs for further detail"); ++ } ++ return ret; ++ } ++ return super.read(chunkcoordintpair); ++ } ++ ++ @Override ++ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws java.io.IOException { ++ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { ++ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave( ++ this.world, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound, null, ++ com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread()); ++ return; ++ } ++ super.write(chunkcoordintpair, nbttagcompound); ++ } ++ // Paper end ++ + public static enum Occupancy { + + HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { +diff --git a/src/main/java/net/minecraft/world/level/NextTickListEntry.java b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +index f3bcb96232d18abbcd86b079a7c5830bb30d75d2..37b7dd82a227a88b720c13a813dd7e8caf803e03 100644 +--- a/src/main/java/net/minecraft/world/level/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +@@ -5,7 +5,7 @@ import net.minecraft.core.BlockPosition; + + public class NextTickListEntry { + +- private static long d; ++ private static final java.util.concurrent.atomic.AtomicLong COUNTER = new java.util.concurrent.atomic.AtomicLong(); // Paper - async chunk loading + private final T e; + public final BlockPosition a; + public final long b; +@@ -17,7 +17,7 @@ public class NextTickListEntry { + } + + public NextTickListEntry(BlockPosition blockposition, T t0, long i, TickListPriority ticklistpriority) { +- this.f = (long) (NextTickListEntry.d++); ++ this.f = (long) (NextTickListEntry.COUNTER.getAndIncrement()); // Paper - async chunk loading + this.a = blockposition.immutableCopy(); + this.e = t0; + this.b = i; +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +index 711308cf84a816f09d116a7414f9cbee803c8713..f094ddf6b4d155f3c7a08a3b811c98b0862fd098 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkStatus.java +@@ -170,6 +170,7 @@ public class ChunkStatus { + return ChunkStatus.q.size(); + } + ++ public static int getTicketLevelOffset(ChunkStatus status) { return ChunkStatus.a(status); } // Paper - OBFHELPER + public static int a(ChunkStatus chunkstatus) { + return ChunkStatus.r.getInt(chunkstatus.c()); + } +@@ -185,6 +186,7 @@ public class ChunkStatus { + this.t = chunkstatus == null ? 0 : chunkstatus.c() + 1; + } + ++ public final int getStatusIndex() { return c(); } // Paper - OBFHELPER + public int c() { + return this.t; + } +@@ -193,7 +195,7 @@ public class ChunkStatus { + return this.s; + } + +- public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER ++ public final ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER + public ChunkStatus e() { + return this.u; + } +@@ -206,6 +208,7 @@ public class ChunkStatus { + return this.w.doWork(this, worldserver, definedstructuremanager, lightenginethreaded, function, ichunkaccess); + } + ++ public final int getNeighborRadius() { return this.f(); } // Paper - OBFHELPER + public int f() { + return this.x; + } +@@ -233,6 +236,7 @@ public class ChunkStatus { + return this.z; + } + ++ public final boolean isAtLeastStatus(ChunkStatus chunkstatus) { return b(chunkstatus); } // Paper - OBFHELPER + public boolean b(ChunkStatus chunkstatus) { + return this.c() >= chunkstatus.c(); + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +index 37d31b49dbbbf834daf29e50daffd9852bfaaf03..2e86be5be969ebf672ef3844e1367583c823f252 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java ++++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +@@ -72,6 +72,7 @@ public class NibbleArray { + return this.a; + } + ++ public NibbleArray copy() { return this.b(); } // Paper - OBFHELPER + public NibbleArray b() { + return this.a == null ? new NibbleArray() : new NibbleArray((byte[]) this.a.clone()); + } +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 2853f9e06064a5c0fe2b0e5df75223d1275eae20..42dc430d948dbab38ad1a1788aaff840f28bc8e8 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java @@ -6,6 +6,7 @@ import it.unimi.dsi.fastutil.longs.LongOpenHashSet; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.shorts.ShortList; @@ -2498,7 +3354,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 import java.util.Arrays; import java.util.BitSet; import java.util.EnumSet; -@@ -23,7 +24,29 @@ public class ChunkRegionLoader { +@@ -65,7 +66,29 @@ public class ChunkRegionLoader { private static final Logger LOGGER = LogManager.getLogger(); @@ -2528,7 +3384,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("Level"); -@@ -50,7 +73,9 @@ public class ChunkRegionLoader { +@@ -92,7 +115,9 @@ public class ChunkRegionLoader { LightEngine lightengine = chunkproviderserver.getLightEngine(); if (flag) { @@ -2539,7 +3395,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 } for (int i = 0; i < nbttaglist.size(); ++i) { -@@ -66,16 +91,28 @@ public class ChunkRegionLoader { +@@ -108,16 +133,28 @@ public class ChunkRegionLoader { achunksection[b0] = chunksection; } @@ -2571,7 +3427,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 } } } -@@ -184,7 +221,7 @@ public class ChunkRegionLoader { +@@ -226,7 +263,7 @@ public class ChunkRegionLoader { } if (chunkstatus_type == ChunkStatus.Type.LEVELCHUNK) { @@ -2580,7 +3436,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 } else { ProtoChunk protochunk1 = (ProtoChunk) object; -@@ -223,11 +260,83 @@ public class ChunkRegionLoader { +@@ -265,11 +302,83 @@ public class ChunkRegionLoader { protochunk1.a(worldgenstage_features, BitSet.valueOf(nbttagcompound5.getByteArray(s1))); } @@ -2665,7 +3521,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos(); NBTTagCompound nbttagcompound = new NBTTagCompound(); NBTTagCompound nbttagcompound1 = new NBTTagCompound(); -@@ -236,7 +345,7 @@ public class ChunkRegionLoader { +@@ -278,7 +387,7 @@ public class ChunkRegionLoader { nbttagcompound.set("Level", nbttagcompound1); nbttagcompound1.setInt("xPos", chunkcoordintpair.x); nbttagcompound1.setInt("zPos", chunkcoordintpair.z); @@ -2674,7 +3530,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 nbttagcompound1.setLong("InhabitedTime", ichunkaccess.getInhabitedTime()); nbttagcompound1.setString("Status", ichunkaccess.getChunkStatus().d()); ChunkConverter chunkconverter = ichunkaccess.p(); -@@ -252,14 +361,22 @@ public class ChunkRegionLoader { +@@ -294,14 +403,22 @@ public class ChunkRegionLoader { NBTTagCompound nbttagcompound2; @@ -2701,7 +3557,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 if (chunksection != Chunk.a || nibblearray != null || nibblearray1 != null) { nbttagcompound2 = new NBTTagCompound(); nbttagcompound2.setByte("Y", (byte) (i & 255)); -@@ -326,7 +443,7 @@ public class ChunkRegionLoader { +@@ -368,7 +485,7 @@ public class ChunkRegionLoader { Entity entity = (Entity) iterator1.next(); NBTTagCompound nbttagcompound4 = new NBTTagCompound(); // Paper start @@ -2710,7 +3566,7 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 toUpdate.add(entity); continue; } -@@ -369,24 +486,32 @@ public class ChunkRegionLoader { +@@ -411,24 +528,32 @@ public class ChunkRegionLoader { } nbttagcompound1.set("Entities", nbttaglist2); @@ -2747,69 +3603,11 @@ index 2dc4f1b689d2a2af9ae42156d954eb5284297ec0..b09d9436d17159edd6733ab4856be445 } nbttagcompound1.set("PostProcessing", a(ichunkaccess.l())); -diff --git a/src/main/java/net/minecraft/server/ChunkStatus.java b/src/main/java/net/minecraft/server/ChunkStatus.java -index f231bb2f5bca184557182c50d251943932693614..f6c9bdbf52d773d7aa601125b887b347163f9328 100644 ---- a/src/main/java/net/minecraft/server/ChunkStatus.java -+++ b/src/main/java/net/minecraft/server/ChunkStatus.java -@@ -159,6 +159,7 @@ public class ChunkStatus { - return ChunkStatus.q.size(); - } - -+ public static int getTicketLevelOffset(ChunkStatus status) { return ChunkStatus.a(status); } // Paper - OBFHELPER - public static int a(ChunkStatus chunkstatus) { - return ChunkStatus.r.getInt(chunkstatus.c()); - } -@@ -174,6 +175,7 @@ public class ChunkStatus { - this.t = chunkstatus == null ? 0 : chunkstatus.c() + 1; - } - -+ public final int getStatusIndex() { return c(); } // Paper - OBFHELPER - public int c() { - return this.t; - } -@@ -182,7 +184,7 @@ public class ChunkStatus { - return this.s; - } - -- public ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER -+ public final ChunkStatus getPreviousStatus() { return this.e(); } // Paper - OBFHELPER - public ChunkStatus e() { - return this.u; - } -@@ -195,6 +197,7 @@ public class ChunkStatus { - return this.w.doWork(this, worldserver, definedstructuremanager, lightenginethreaded, function, ichunkaccess); - } - -+ public final int getNeighborRadius() { return this.f(); } // Paper - OBFHELPER - public int f() { - return this.x; - } -@@ -222,6 +225,7 @@ public class ChunkStatus { - return this.z; - } - -+ public final boolean isAtLeastStatus(ChunkStatus chunkstatus) { return b(chunkstatus); } // Paper - OBFHELPER - public boolean b(ChunkStatus chunkstatus) { - return this.c() >= chunkstatus.c(); - } -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index f97fb0434e80478d514a718a1e7376fd2717037d..bc15da4640a4a6107c9c186a01ce76df87511b41 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -@@ -91,7 +91,7 @@ public abstract class IAsyncTaskHandler implements Mailbox public - while (this.executeNext()) { - ; - } -diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index fa03834dacacf7ae6a326c88007256a261153c27..c0d2df8ef3b4d0224ede2b7a4ef4e3f930590209 100644 ---- a/src/main/java/net/minecraft/server/IChunkLoader.java -+++ b/src/main/java/net/minecraft/server/IChunkLoader.java -@@ -3,37 +3,50 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +index d785f44cd503d4d91589f3fc4bc8dc805dff3d41..65c2bbeb4d77b9accbfa0e26504fdec3f581fa6a 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +@@ -3,6 +3,10 @@ package net.minecraft.world.level.chunk.storage; import com.mojang.datafixers.DataFixer; import java.io.File; import java.io.IOException; @@ -2819,6 +3617,8 @@ index fa03834dacacf7ae6a326c88007256a261153c27..c0d2df8ef3b4d0224ede2b7a4ef4e3f9 +// Paper end import java.util.function.Supplier; import javax.annotation.Nullable; + import net.minecraft.SharedConstants; +@@ -25,32 +29,41 @@ import net.minecraft.world.level.dimension.DimensionManager; public class IChunkLoader implements AutoCloseable { @@ -2871,7 +3671,7 @@ index fa03834dacacf7ae6a326c88007256a261153c27..c0d2df8ef3b4d0224ede2b7a4ef4e3f9 ChunkStatus status = ChunkStatus.a(level.getString("Status")); if (status != null && status.b(ChunkStatus.FEATURES)) { -@@ -64,11 +77,13 @@ public class IChunkLoader implements AutoCloseable { +@@ -81,11 +94,13 @@ public class IChunkLoader implements AutoCloseable { if (i < 1493) { nbttagcompound = GameProfileSerializer.a(this.b, DataFixTypes.CHUNK, nbttagcompound, i, 1493); if (nbttagcompound.getCompound("Level").getBoolean("hasLegacyStructureData")) { @@ -2885,7 +3685,7 @@ index fa03834dacacf7ae6a326c88007256a261153c27..c0d2df8ef3b4d0224ede2b7a4ef4e3f9 } } -@@ -86,22 +101,20 @@ public class IChunkLoader implements AutoCloseable { +@@ -103,22 +118,20 @@ public class IChunkLoader implements AutoCloseable { @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { @@ -2915,610 +3715,11 @@ index fa03834dacacf7ae6a326c88007256a261153c27..c0d2df8ef3b4d0224ede2b7a4ef4e3f9 + this.regionFileCache.close(); } } -diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 2507bdf7bfa65f1bc728a46322d2a570e566e32c..c470c6527b214026c230feaae0c0875c86dea673 100644 ---- a/src/main/java/net/minecraft/server/MCUtil.java -+++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -697,4 +697,9 @@ public final class MCUtil { - out.print(fileData); - } - } -+ -+ public static int getTicketLevelFor(ChunkStatus status) { -+ // TODO make sure the constant `33` is correct on future updates. See getChunkAt(int, int, ChunkStatus, boolean) -+ return 33 + ChunkStatus.getTicketLevelOffset(status); -+ } - } -diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index 85f7cfa1fade8d574e7f85d857ab071c66ec4a95..e79ed0b5702688aaa5a86dc5a511c32685c883d9 100644 ---- a/src/main/java/net/minecraft/server/Main.java -+++ b/src/main/java/net/minecraft/server/Main.java -@@ -171,6 +171,7 @@ public class Main { - - convertable_conversionsession.a((IRegistryCustom) iregistrycustom_dimension, (SaveData) object); - */ -+ Class.forName("net.minecraft.server.VillagerTrades");// Paper - load this sync so it won't fail later async - final DedicatedServer dedicatedserver = (DedicatedServer) MinecraftServer.a((thread) -> { - DedicatedServer dedicatedserver1 = new DedicatedServer(optionset, datapackconfiguration1, thread, iregistrycustom_dimension, convertable_conversionsession, resourcepackrepository, datapackresources, null, dedicatedserversettings, DataConverterRegistry.a(), minecraftsessionservice, gameprofilerepository, usercache, WorldLoadListenerLogger::new); - -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 7f63e60caac65a24909566e3f9a0f5ba5aa1575a..3b2fd34a797089c191d397c3e39551c395f7cfce 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -803,7 +803,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { - -- private static long d; -+ private static final java.util.concurrent.atomic.AtomicLong COUNTER = new java.util.concurrent.atomic.AtomicLong(); // Paper - async chunk loading - private final T e; - public final BlockPosition a; - public final long b; -@@ -16,7 +16,7 @@ public class NextTickListEntry { - } - - public NextTickListEntry(BlockPosition blockposition, T t0, long i, TickListPriority ticklistpriority) { -- this.f = (long) (NextTickListEntry.d++); -+ this.f = (long) (NextTickListEntry.COUNTER.getAndIncrement()); // Paper - async chunk loading - this.a = blockposition.immutableCopy(); - this.e = t0; - this.b = i; -diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java -index 9aeb6ed1b4f452a69de217076aab015b164cc295..6d608dfa52fffd79878f3bdebcda9fab176e413e 100644 ---- a/src/main/java/net/minecraft/server/NibbleArray.java -+++ b/src/main/java/net/minecraft/server/NibbleArray.java -@@ -71,6 +71,7 @@ public class NibbleArray { - return this.a; - } - -+ public NibbleArray copy() { return this.b(); } // Paper - OBFHELPER - public NibbleArray b() { - return this.a == null ? new NibbleArray() : new NibbleArray((byte[]) this.a.clone()); - } -diff --git a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -index 4c52c57c02571353f71772e3650932f314da62ca..71daa0cb08d69c16bded510d1a49053477faf600 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInTabComplete.java -@@ -12,7 +12,7 @@ public class PacketPlayInTabComplete implements Packet { - @Override - public void a(PacketDataSerializer packetdataserializer) throws IOException { - this.a = packetdataserializer.i(); -- this.b = packetdataserializer.e(32500); -+ this.b = packetdataserializer.e(2048); - } - - @Override -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index ad01b9333e73c8e4a7c848edc4ce252a51ea52b6..25f8febe63167349460e32c831088bb80b6b77ad 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -133,6 +133,18 @@ public class PlayerChunk { - } - return null; - } -+ -+ public ChunkStatus getChunkHolderStatus() { -+ for (ChunkStatus curr = ChunkStatus.FULL, next = curr.getPreviousStatus(); curr != next; curr = next, next = next.getPreviousStatus()) { -+ CompletableFuture> future = this.getStatusFutureUnchecked(curr); -+ Either either = future.getNow(null); -+ if (either == null || !either.left().isPresent()) { -+ continue; -+ } -+ return curr; -+ } -+ return null; -+ } - // Paper end - - public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { -@@ -351,7 +363,7 @@ public class PlayerChunk { - ChunkStatus chunkstatus = getChunkStatus(this.oldTicketLevel); - ChunkStatus chunkstatus1 = getChunkStatus(this.ticketLevel); - boolean flag = this.oldTicketLevel <= PlayerChunkMap.GOLDEN_TICKET; -- boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET; -+ boolean flag1 = this.ticketLevel <= PlayerChunkMap.GOLDEN_TICKET; // Paper - diff on change: (flag1 = new ticket level is in loadable range) - PlayerChunk.State playerchunk_state = getChunkState(this.oldTicketLevel); - PlayerChunk.State playerchunk_state1 = getChunkState(this.ticketLevel); - // CraftBukkit start -@@ -387,6 +399,12 @@ public class PlayerChunk { - } - }); - -+ // Paper start -+ if (!flag1) { -+ playerchunkmap.world.asyncChunkTaskManager.cancelChunkLoad(this.location.x, this.location.z); -+ } -+ // Paper end -+ - for (int i = flag1 ? chunkstatus1.c() + 1 : 0; i <= chunkstatus.c(); ++i) { - completablefuture = (CompletableFuture) this.statusFutures.get(i); - if (completablefuture != null) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 8f0590c2d5965b76083cb39f99f5ab4f33b01ed1..fff3604936365cab07ca9f94a2aaf1dd41911eef 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -66,7 +66,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - private final LightEngineThreaded lightEngine; - private final IAsyncTaskHandler executor; - public final ChunkGenerator chunkGenerator; -- private final Supplier l; -+ private final Supplier l; public final Supplier getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER - private final VillagePlace m; - public final LongSet unloadQueue; - private boolean updatingChunksModified; -@@ -76,7 +76,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - public final WorldLoadListener worldLoadListener; - public final PlayerChunkMap.a chunkDistanceManager; - private final AtomicInteger u; -- private final DefinedStructureManager definedStructureManager; -+ public final DefinedStructureManager definedStructureManager; // Paper - private -> public - private final File w; - private final PlayerMap playerMap; - public final Int2ObjectMap trackedEntities; -@@ -159,7 +159,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false)); - this.chunkDistanceManager = new PlayerChunkMap.a(executor, iasynctaskhandler); - this.l = supplier; -- this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag); -+ this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper - this.setViewDistance(i); - } - -@@ -201,12 +201,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - - @Nullable -- protected PlayerChunk getUpdatingChunk(long i) { -+ public PlayerChunk getUpdatingChunk(long i) { // Paper - return (PlayerChunk) this.updatingChunks.get(i); - } - - @Nullable -- protected PlayerChunk getVisibleChunk(long i) { -+ public PlayerChunk getVisibleChunk(long i) { // Paper - protected -> public - return (PlayerChunk) this.visibleChunks.get(i); - } - -@@ -328,6 +328,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - public void close() throws IOException { - try { - this.p.close(); -+ this.world.asyncChunkTaskManager.close(true); // Paper - Required since we're closing regionfiles in the next line - this.m.close(); - } finally { - super.close(); -@@ -419,7 +420,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - this.b(() -> { - return true; - }); -- this.i(); -+ this.world.asyncChunkTaskManager.flush(); // Paper - flush to preserve behavior compat with pre-async behaviour -+// this.i(); // Paper - nuke IOWorker - PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName()); - } else { - this.visibleChunks.values().stream().filter(PlayerChunk::hasBeenLoaded).forEach((playerchunk) -> { -@@ -435,16 +437,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - } - -- private static final double UNLOAD_QUEUE_RESIZE_FACTOR = 0.96; // Spigot -+ private static final double UNLOAD_QUEUE_RESIZE_FACTOR = 0.90; // Spigot // Paper - unload more - - protected void unloadChunks(BooleanSupplier booleansupplier) { - GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); - -+ try (Timing ignored = this.world.timings.poiUnload.startTiming()) { // Paper - gameprofilerfiller.enter("poi"); - this.m.a(booleansupplier); -+ } // Paper - gameprofilerfiller.exitEnter("chunk_unload"); - if (!this.world.isSavingDisabled()) { -+ try (Timing ignored = this.world.timings.chunkUnload.startTiming()) { // Paper - this.b(booleansupplier); -+ }// Paper - } - - gameprofilerfiller.exit(); -@@ -465,12 +471,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - if (playerchunk != null) { - this.pendingUnload.put(j, playerchunk); - this.updatingChunksModified = true; -+ this.a(j, playerchunk); // Paper - Move up - don't leak chunks - // Spigot start - if (!booleansupplier.getAsBoolean() && this.unloadQueue.size() <= targetSize && activityAccountant.activityTimeIsExhausted()) { - break; - } - // Spigot end -- this.a(j, playerchunk); -+ //this.a(j, playerchunk); // Paper - move up because spigot did a dumb - } - } - activityAccountant.endActivity(); // Spigot -@@ -484,6 +491,60 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - } - -+ // Paper start - async chunk save for unload -+ // Note: This is very unsafe to call if the chunk is still in use. -+ // This is also modeled after PlayerChunkMap#saveChunk(IChunkAccess, boolean), with the intentional difference being -+ // serializing the chunk is left to a worker thread. -+ private void asyncSave(IChunkAccess chunk) { -+ ChunkCoordIntPair chunkPos = chunk.getPos(); -+ NBTTagCompound poiData; -+ try (Timing ignored = this.world.timings.chunkUnloadPOISerialization.startTiming()) { -+ poiData = this.getVillagePlace().getData(chunk.getPos()); -+ } -+ -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkPos.x, chunkPos.z, -+ poiData, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); -+ -+ if (!chunk.isNeedsSaving()) { -+ return; -+ } -+ -+ ChunkStatus chunkstatus = chunk.getChunkStatus(); -+ -+ // Copied from PlayerChunkMap#saveChunk(IChunkAccess, boolean) -+ if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { -+ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper -+ // Paper start - Optimize save by using status cache -+ try { -+ ChunkStatus statusOnDisk = this.getChunkStatusOnDisk(chunkPos); -+ if (statusOnDisk != null && statusOnDisk.getType() == ChunkStatus.Type.LEVELCHUNK) { -+ // Paper end -+ return; -+ } -+ -+ if (chunkstatus == ChunkStatus.EMPTY && chunk.h().values().stream().noneMatch(StructureStart::e)) { -+ return; -+ } -+ } catch (IOException ex) { -+ ex.printStackTrace(); -+ return; -+ } -+ } -+ } -+ -+ ChunkRegionLoader.AsyncSaveData asyncSaveData; -+ try (Timing ignored = this.world.timings.chunkUnloadPrepareSave.startTiming()) { -+ asyncSaveData = ChunkRegionLoader.getAsyncSaveData(this.world, chunk); -+ } -+ -+ this.world.asyncChunkTaskManager.scheduleChunkSave(chunkPos.x, chunkPos.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY, -+ asyncSaveData, chunk); -+ -+ chunk.setLastSaved(this.world.getTime()); -+ chunk.setNeedsSaving(false); -+ } -+ // Paper end -+ - private void a(long i, PlayerChunk playerchunk) { - CompletableFuture completablefuture = playerchunk.getChunkSave(); - Consumer consumer = (ichunkaccess) -> { // CraftBukkit - decompile error -@@ -497,7 +558,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - ((Chunk) ichunkaccess).setLoaded(false); - } - -- this.saveChunk(ichunkaccess); -+ //this.saveChunk(ichunkaccess);// Paper - delay - if (this.loadedChunks.remove(i) && ichunkaccess instanceof Chunk) { - Chunk chunk = (Chunk) ichunkaccess; - -@@ -505,6 +566,13 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - this.autoSaveQueue.remove(playerchunk); // Paper - -+ try { -+ this.asyncSave(ichunkaccess); // Paper - async chunk saving -+ } catch (Throwable ex) { -+ LOGGER.fatal("Failed to prepare async save, attempting synchronous save", ex); -+ this.saveChunk(ichunkaccess); -+ } -+ - this.lightEngine.a(ichunkaccess.getPos()); - this.lightEngine.queueUpdate(); - this.worldLoadListener.a(ichunkaccess.getPos(), (ChunkStatus) null); -@@ -575,19 +643,23 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - - private CompletableFuture> f(ChunkCoordIntPair chunkcoordintpair) { -- return CompletableFuture.supplyAsync(() -> { -+ // Paper start - Async chunk io -+ final java.util.function.BiFunction> syncLoadComplete = (chunkHolder, ioThrowable) -> { - try (Timing ignored = this.world.timings.chunkLoad.startTimingIfSync()) { // Paper - this.world.getMethodProfiler().c("chunkLoad"); -- NBTTagCompound nbttagcompound; // Paper -- try (Timing ignored2 = this.world.timings.chunkIO.startTimingIfSync()) { // Paper start - timings -- nbttagcompound = this.readChunkData(chunkcoordintpair); -- } // Paper end -+ // Paper start -+ if (ioThrowable != null) { -+ com.destroystokyo.paper.util.SneakyThrow.sneaky(ioThrowable); -+ } - -- if (nbttagcompound != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings -- boolean flag = nbttagcompound.hasKeyOfType("Level", 10) && nbttagcompound.getCompound("Level").hasKeyOfType("Status", 8); -+ this.getVillagePlace().loadInData(chunkcoordintpair, chunkHolder.poiData); -+ chunkHolder.tasks.forEach(Runnable::run); -+ // Paper end - -- if (flag) { -- ProtoChunk protochunk = ChunkRegionLoader.loadChunk(this.world, this.definedStructureManager, this.m, chunkcoordintpair, nbttagcompound); -+ if (chunkHolder.protoChunk != null) {try (Timing ignored2 = this.world.timings.chunkLoadLevelTimer.startTimingIfSync()) { // Paper start - timings // Paper - chunk is created async -+ -+ if (true) { -+ ProtoChunk protochunk = chunkHolder.protoChunk; - - protochunk.setLastSaved(this.world.getTime()); - this.a(chunkcoordintpair, protochunk.getChunkStatus().getType()); -@@ -611,7 +683,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - this.g(chunkcoordintpair); - return Either.left(new ProtoChunk(chunkcoordintpair, ChunkConverter.a, this.world)); // Paper - Anti-Xray - Add parameter -- }, this.executor); -+ // Paper start - Async chunk io -+ }; -+ CompletableFuture> ret = new CompletableFuture<>(); -+ -+ Consumer chunkHolderConsumer = (ChunkRegionLoader.InProgressChunkHolder holder) -> { -+ // Go into the chunk load queue and not server task queue so we can be popped out even faster. -+ com.destroystokyo.paper.io.chunk.ChunkTaskManager.queueChunkWaitTask(() -> { -+ try { -+ ret.complete(syncLoadComplete.apply(holder, null)); -+ } catch (Exception e) { -+ ret.completeExceptionally(e); -+ } -+ }); -+ }; -+ -+ CompletableFuture chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z); -+ if (chunkSaveFuture != null) { -+ this.world.asyncChunkTaskManager.scheduleChunkLoad(chunkcoordintpair.x, chunkcoordintpair.z, -+ com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY, chunkHolderConsumer, false, chunkSaveFuture); -+ this.world.asyncChunkTaskManager.raisePriority(chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY); -+ } else { -+ this.world.asyncChunkTaskManager.scheduleChunkLoad(chunkcoordintpair.x, chunkcoordintpair.z, -+ com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY, chunkHolderConsumer, false); -+ } -+ return ret; -+ // Paper end - } - - private void g(ChunkCoordIntPair chunkcoordintpair) { -@@ -838,6 +935,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - - public boolean saveChunk(IChunkAccess ichunkaccess) { -+ try (co.aikar.timings.Timing ignored = this.world.timings.chunkSave.startTiming()) { // Paper - this.m.a(ichunkaccess.getPos()); - if (!ichunkaccess.isNeedsSaving()) { - return false; -@@ -850,6 +948,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - ChunkStatus chunkstatus = ichunkaccess.getChunkStatus(); - - if (chunkstatus.getType() != ChunkStatus.Type.LEVELCHUNK) { -+ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveOverwriteCheck.startTiming()) { // Paper - if (this.h(chunkcoordintpair)) { - return false; - } -@@ -857,12 +956,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - if (chunkstatus == ChunkStatus.EMPTY && ichunkaccess.h().values().stream().noneMatch(StructureStart::e)) { - return false; - } -+ } // Paper - } - - this.world.getMethodProfiler().c("chunkSave"); -- NBTTagCompound nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); -+ NBTTagCompound nbttagcompound; -+ try (co.aikar.timings.Timing ignored1 = this.world.timings.chunkSaveDataSerialization.startTiming()) { // Paper -+ nbttagcompound = ChunkRegionLoader.saveChunk(this.world, ichunkaccess); -+ } // Paper -+ - -- this.a(chunkcoordintpair, nbttagcompound); -+ // Paper start - async chunk io -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, chunkcoordintpair.x, chunkcoordintpair.z, -+ null, nbttagcompound, com.destroystokyo.paper.io.PrioritizedTaskQueue.NORMAL_PRIORITY); -+ // Paper end - async chunk io - this.a(chunkcoordintpair, chunkstatus.getType()); - return true; - } catch (Exception exception) { -@@ -871,6 +978,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - return false; - } - } -+ } // Paper - } - - private boolean h(ChunkCoordIntPair chunkcoordintpair) { -@@ -1000,6 +1108,35 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - } - -+ // Paper start - Asynchronous chunk io -+ @Nullable -+ @Override -+ public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { -+ if (Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { -+ NBTTagCompound ret = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE -+ .loadChunkDataAsyncFuture(this.world, chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread(), -+ false, true, true).join().chunkData; -+ -+ if (ret == com.destroystokyo.paper.io.PaperFileIOThread.FAILURE_VALUE) { -+ throw new IOException("See logs for further detail"); -+ } -+ return ret; -+ } -+ return super.read(chunkcoordintpair); -+ } -+ -+ @Override -+ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { -+ if (Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave( -+ this.world, chunkcoordintpair.x, chunkcoordintpair.z, null, nbttagcompound, -+ com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread()); -+ return; -+ } -+ super.write(chunkcoordintpair, nbttagcompound); -+ } -+ // Paper end -+ - @Nullable - public NBTTagCompound readChunkData(ChunkCoordIntPair chunkcoordintpair) throws IOException { // Paper - private -> public - NBTTagCompound nbttagcompound = this.read(chunkcoordintpair); -@@ -1021,33 +1158,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - // Paper start - chunk status cache "api" - public ChunkStatus getChunkStatusOnDiskIfCached(ChunkCoordIntPair chunkPos) { -- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getRegionFileIfLoaded(chunkPos); -+ synchronized (this) { // Paper -+ RegionFile regionFile = this.regionFileCache.getRegionFileIfLoaded(chunkPos); - - return regionFile == null ? null : regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); -+ } // Paper - } - - public ChunkStatus getChunkStatusOnDisk(ChunkCoordIntPair chunkPos) throws IOException { -- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, true); -+ // Paper start - async chunk save for unload -+ IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(chunkPos.x, chunkPos.z); -+ if (unloadingChunk != null) { -+ return unloadingChunk.getChunkStatus(); -+ } -+ // Paper end -+ // Paper start - async io -+ NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE -+ .getPendingWrite(this.world, chunkPos.x, chunkPos.z, false); - -- if (regionFile == null || !regionFile.chunkExists(chunkPos)) { -- return null; -+ if (inProgressWrite != null) { -+ return ChunkRegionLoader.getStatus(inProgressWrite); - } -+ // Paper end -+ synchronized (this) { // Paper - async io -+ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, true); -+ -+ if (regionFile == null || !regionFile.chunkExists(chunkPos)) { -+ return null; -+ } - -- ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); -+ ChunkStatus status = regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); - -- if (status != null) { -- return status; -+ if (status != null) { -+ return status; -+ } -+ // Paper start - async io - } - -- this.readChunkData(chunkPos); -+ NBTTagCompound compound = this.readChunkData(chunkPos); - -- return regionFile.getStatusIfCached(chunkPos.x, chunkPos.z); -+ return ChunkRegionLoader.getStatus(compound); -+ // Paper end - } - - public void updateChunkStatusOnDisk(ChunkCoordIntPair chunkPos, @Nullable NBTTagCompound compound) throws IOException { -- RegionFile regionFile = this.getIOWorker().getRegionFileCache().getFile(chunkPos, false); -+ synchronized (this) { -+ RegionFile regionFile = this.regionFileCache.getFile(chunkPos, false); - -- regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); -+ regionFile.setStatus(chunkPos.x, chunkPos.z, ChunkRegionLoader.getStatus(compound)); -+ } - } - - public IChunkAccess getUnloadingChunk(int chunkX, int chunkZ) { -@@ -1056,6 +1215,39 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - } - // Paper end - -+ -+ // Paper start - async io -+ // this function will not load chunk data off disk to check for status -+ // ret null for unknown, empty for empty status on disk or absent from disk -+ public ChunkStatus getStatusOnDiskNoLoad(int x, int z) { -+ // Paper start - async chunk save for unload -+ IChunkAccess unloadingChunk = this.world.asyncChunkTaskManager.getChunkInSaveProgress(x, z); -+ if (unloadingChunk != null) { -+ return unloadingChunk.getChunkStatus(); -+ } -+ // Paper end -+ // Paper start - async io -+ net.minecraft.server.NBTTagCompound inProgressWrite = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE -+ .getPendingWrite(this.world, x, z, false); -+ -+ if (inProgressWrite != null) { -+ return net.minecraft.server.ChunkRegionLoader.getStatus(inProgressWrite); -+ } -+ // Paper end -+ // variant of PlayerChunkMap#getChunkStatusOnDisk that does not load data off disk, but loads the region file -+ ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); -+ synchronized (world.getChunkProvider().playerChunkMap) { -+ net.minecraft.server.RegionFile file; -+ try { -+ file = world.getChunkProvider().playerChunkMap.regionFileCache.getFile(chunkPos, false); -+ } catch (IOException ex) { -+ throw new RuntimeException(ex); -+ } -+ -+ return !file.chunkExists(chunkPos) ? ChunkStatus.EMPTY : file.getStatusIfCached(x, z); -+ } -+ } -+ - boolean isOutsideOfRange(ChunkCoordIntPair chunkcoordintpair) { - // Spigot start - return isOutsideOfRange(chunkcoordintpair, false); -@@ -1402,6 +1594,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { - - } - -+ public VillagePlace getVillagePlace() { return this.h(); } // Paper - OBFHELPER - protected VillagePlace h() { - return this.m; - } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 9886ccda757a150d00c914a017ddd7a43167a6bd..24a7666a74421ca07b6aeaa23ef3fc06d94b1f2e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -584,6 +584,13 @@ public class PlayerConnection implements PacketListenerPlayIn { - minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper - return; - } -+ // Paper start -+ String str = packetplayintabcomplete.c(); int index = -1; -+ if (str.length() > 64 && ((index = str.indexOf(' ')) == -1 || index >= 64)) { -+ minecraftServer.scheduleOnMain(() -> this.disconnect(new ChatMessage("disconnect.spam", new Object[0]))); // Paper -+ return; -+ } -+ // Paper end - // CraftBukkit end - StringReader stringreader = new StringReader(packetplayintabcomplete.c()); - -diff --git a/src/main/java/net/minecraft/server/RegionFile.java b/src/main/java/net/minecraft/server/RegionFile.java -index 3e299ffaabf2a91336fae28031c8fc0712667bc5..1751fb6934d9242e475c1a44b2a4a1ade6987766 100644 ---- a/src/main/java/net/minecraft/server/RegionFile.java -+++ b/src/main/java/net/minecraft/server/RegionFile.java -@@ -38,6 +38,8 @@ public class RegionFile implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +index 299806b73e44a7128e829b35cc2b017a321d7926..1b9836672a82ee3bb8f8df96f7b4d5d493fb9e95 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFile.java +@@ -41,6 +41,8 @@ public class RegionFile implements AutoCloseable { protected final RegionFileBitSet freeSectors; public final File file; // Paper @@ -3527,7 +3728,7 @@ index 3e299ffaabf2a91336fae28031c8fc0712667bc5..1751fb6934d9242e475c1a44b2a4a1ad // Paper start - Cache chunk status private final ChunkStatus[] statuses = new ChunkStatus[32 * 32]; -@@ -244,7 +246,7 @@ public class RegionFile implements AutoCloseable { +@@ -247,7 +249,7 @@ public class RegionFile implements AutoCloseable { return (i + 4096 - 1) / 4096; } @@ -3536,7 +3737,7 @@ index 3e299ffaabf2a91336fae28031c8fc0712667bc5..1751fb6934d9242e475c1a44b2a4a1ad int i = this.getOffset(chunkcoordintpair); if (i == 0) { -@@ -404,6 +406,11 @@ public class RegionFile implements AutoCloseable { +@@ -407,6 +409,11 @@ public class RegionFile implements AutoCloseable { } public void close() throws IOException { @@ -3548,7 +3749,7 @@ index 3e299ffaabf2a91336fae28031c8fc0712667bc5..1751fb6934d9242e475c1a44b2a4a1ad this.closed = true; // Paper try { this.d(); -@@ -414,6 +421,10 @@ public class RegionFile implements AutoCloseable { +@@ -417,6 +424,10 @@ public class RegionFile implements AutoCloseable { this.dataFile.close(); } } @@ -3559,20 +3760,20 @@ index 3e299ffaabf2a91336fae28031c8fc0712667bc5..1751fb6934d9242e475c1a44b2a4a1ad } -diff --git a/src/main/java/net/minecraft/server/RegionFileCache.java b/src/main/java/net/minecraft/server/RegionFileCache.java -index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2db5419f2 100644 ---- a/src/main/java/net/minecraft/server/RegionFileCache.java -+++ b/src/main/java/net/minecraft/server/RegionFileCache.java -@@ -10,7 +10,7 @@ import java.io.File; - import java.io.IOException; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +index 8ceebe1f5ca8821228faf65e1d26fa205ec1e56c..53500c2643279fdae73c4cfce2a0d7fb684366df 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileCache.java +@@ -14,7 +14,7 @@ import net.minecraft.nbt.NBTTagCompound; + import net.minecraft.util.ExceptionSuppressor; + import net.minecraft.world.level.ChunkCoordIntPair; -public final class RegionFileCache implements AutoCloseable { +public class RegionFileCache implements AutoCloseable { // Paper - no final public final Long2ObjectLinkedOpenHashMap cache = new Long2ObjectLinkedOpenHashMap(); private final File b; -@@ -23,16 +23,27 @@ public final class RegionFileCache implements AutoCloseable { +@@ -27,16 +27,27 @@ public final class RegionFileCache implements AutoCloseable { // Paper start @@ -3602,7 +3803,7 @@ index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2 return regionfile; } else { if (this.cache.size() >= com.destroystokyo.paper.PaperConfig.regionFileCacheSize) { // Paper - configurable -@@ -48,6 +59,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -52,6 +63,12 @@ public final class RegionFileCache implements AutoCloseable { RegionFile regionfile1 = new RegionFile(file, this.b, this.c); this.cache.putAndMoveToFirst(i, regionfile1); @@ -3615,7 +3816,7 @@ index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2 return regionfile1; } } -@@ -123,11 +140,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -127,11 +144,12 @@ public final class RegionFileCache implements AutoCloseable { @Nullable public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws IOException { // CraftBukkit start - SPIGOT-5680: There's no good reason to preemptively create files on read, save that for writing @@ -3629,7 +3830,7 @@ index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2 DataInputStream datainputstream = regionfile.a(chunkcoordintpair); // Paper start if (regionfile.isOversized(chunkcoordintpair.x, chunkcoordintpair.z)) { -@@ -165,10 +183,14 @@ public final class RegionFileCache implements AutoCloseable { +@@ -169,10 +187,14 @@ public final class RegionFileCache implements AutoCloseable { } return nbttagcompound; @@ -3645,7 +3846,7 @@ index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2 int attempts = 0; Exception laste = null; while (attempts++ < 5) { try { // Paper DataOutputStream dataoutputstream = regionfile.c(chunkcoordintpair); Throwable throwable = null; -@@ -207,9 +229,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -211,9 +233,12 @@ public final class RegionFileCache implements AutoCloseable { MinecraftServer.LOGGER.error("Failed to save chunk", laste); } // Paper end @@ -3659,7 +3860,7 @@ index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2 ExceptionSuppressor exceptionsuppressor = new ExceptionSuppressor<>(); ObjectIterator objectiterator = this.cache.values().iterator(); -@@ -236,4 +261,12 @@ public final class RegionFileCache implements AutoCloseable { +@@ -240,4 +265,12 @@ public final class RegionFileCache implements AutoCloseable { } } @@ -3672,11 +3873,11 @@ index 7a15944926427eb6cad976daabe5e710f4fbf1bb..d64f7ad925e5f40740a58ceee0845ac2 + } + // CraftBukkit end } -diff --git a/src/main/java/net/minecraft/server/RegionFileSection.java b/src/main/java/net/minecraft/server/RegionFileSection.java -index 21e75a3b5f03262a3885b2f9e3b3c175422efc03..04256a95108b8182e8f808e856e0d2b62165e242 100644 ---- a/src/main/java/net/minecraft/server/RegionFileSection.java -+++ b/src/main/java/net/minecraft/server/RegionFileSection.java -@@ -21,28 +21,29 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java +index 8ad97a8a2189553da88810380b1c240079eacc93..40cf6af57c9fad294dd502f797d23e6d908087c2 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/RegionFileSection.java +@@ -30,28 +30,29 @@ import net.minecraft.world.level.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -3711,7 +3912,7 @@ index 21e75a3b5f03262a3885b2f9e3b3c175422efc03..04256a95108b8182e8f808e856e0d2b6 this.d(chunkcoordintpair); } -@@ -96,13 +97,18 @@ public class RegionFileSection implements AutoCloseable { +@@ -105,13 +106,18 @@ public class RegionFileSection implements AutoCloseable { } private void b(ChunkCoordIntPair chunkcoordintpair) { @@ -3732,7 +3933,7 @@ index 21e75a3b5f03262a3885b2f9e3b3c175422efc03..04256a95108b8182e8f808e856e0d2b6 } catch (IOException ioexception) { RegionFileSection.LOGGER.error("Error reading chunk {} data from disk", chunkcoordintpair, ioexception); return null; -@@ -148,17 +154,31 @@ public class RegionFileSection implements AutoCloseable { +@@ -157,17 +163,31 @@ public class RegionFileSection implements AutoCloseable { } private void d(ChunkCoordIntPair chunkcoordintpair) { @@ -3766,7 +3967,7 @@ index 21e75a3b5f03262a3885b2f9e3b3c175422efc03..04256a95108b8182e8f808e856e0d2b6 private Dynamic a(ChunkCoordIntPair chunkcoordintpair, DynamicOps dynamicops) { Map map = Maps.newHashMap(); -@@ -204,9 +224,9 @@ public class RegionFileSection implements AutoCloseable { +@@ -213,9 +233,9 @@ public class RegionFileSection implements AutoCloseable { public void a(ChunkCoordIntPair chunkcoordintpair) { if (!this.d.isEmpty()) { for (int i = 0; i < 16; ++i) { @@ -3778,7 +3979,7 @@ index 21e75a3b5f03262a3885b2f9e3b3c175422efc03..04256a95108b8182e8f808e856e0d2b6 this.d(chunkcoordintpair); return; } -@@ -215,7 +235,26 @@ public class RegionFileSection implements AutoCloseable { +@@ -224,7 +244,26 @@ public class RegionFileSection implements AutoCloseable { } @@ -3807,222 +4008,15 @@ index 21e75a3b5f03262a3885b2f9e3b3c175422efc03..04256a95108b8182e8f808e856e0d2b6 } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 75ab9f185b3231113dfa387c956a707b403bb2db..8055f5998213ab1c6c10d03d88d2b14d220a5e40 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -22,6 +22,7 @@ public class TicketType { - public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit - public static final TicketType PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit - public static final TicketType FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper -+ public static final TicketType ASYNC_LOAD = a("async_load", Long::compareTo); // Paper - - public static TicketType a(String s, Comparator comparator) { - return new TicketType<>(s, comparator, 0L); -diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index d6aca683465c6898536507fab9e6888fef2e77e5..b926cebd053bef829517c9d9bbf1c609c23ca04a 100644 ---- a/src/main/java/net/minecraft/server/VillagePlace.java -+++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -25,8 +25,16 @@ public class VillagePlace extends RegionFileSection { - private final VillagePlace.a a = new VillagePlace.a(); - private final LongSet b = new LongOpenHashSet(); - -+ private final WorldServer world; // Paper -+ - public VillagePlace(File file, DataFixer datafixer, boolean flag) { -+ // Paper start - add world parameter -+ this(file, datafixer, flag, null); -+ } -+ public VillagePlace(File file, DataFixer datafixer, boolean flag, WorldServer world) { - super(file, VillagePlaceSection::a, VillagePlaceSection::new, datafixer, DataFixTypes.POI_CHUNK, flag); -+ this.world = world; -+ // Paper end - add world parameter - } - - public void a(BlockPosition blockposition, VillagePlaceType villageplacetype) { -@@ -144,7 +152,23 @@ public class VillagePlace extends RegionFileSection { - - @Override - public void a(BooleanSupplier booleansupplier) { -- super.a(booleansupplier); -+ // Paper start - async chunk io -+ if (this.world == null) { -+ super.a(booleansupplier); -+ } else { -+ //super.a(booleansupplier); // re-implement below -+ while (!((RegionFileSection)this).d.isEmpty() && booleansupplier.getAsBoolean()) { -+ ChunkCoordIntPair chunkcoordintpair = SectionPosition.a(((RegionFileSection)this).d.firstLong()).r(); -+ -+ NBTTagCompound data; -+ try (co.aikar.timings.Timing ignored1 = this.world.timings.poiSaveDataSerialization.startTiming()) { -+ data = this.getData(chunkcoordintpair); -+ } -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave(this.world, -+ chunkcoordintpair.x, chunkcoordintpair.z, data, null, com.destroystokyo.paper.io.PrioritizedTaskQueue.LOW_PRIORITY); -+ } -+ } -+ // Paper end - this.a.a(); - } - -@@ -244,6 +268,35 @@ public class VillagePlace extends RegionFileSection { - } - } - -+ // Paper start - Asynchronous chunk io -+ @javax.annotation.Nullable -+ @Override -+ public NBTTagCompound read(ChunkCoordIntPair chunkcoordintpair) throws java.io.IOException { -+ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { -+ NBTTagCompound ret = com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE -+ .loadChunkDataAsyncFuture(this.world, chunkcoordintpair.x, chunkcoordintpair.z, com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread(), -+ true, false, true).join().poiData; -+ -+ if (ret == com.destroystokyo.paper.io.PaperFileIOThread.FAILURE_VALUE) { -+ throw new java.io.IOException("See logs for further detail"); -+ } -+ return ret; -+ } -+ return super.read(chunkcoordintpair); -+ } -+ -+ @Override -+ public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws java.io.IOException { -+ if (this.world != null && Thread.currentThread() != com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE) { -+ com.destroystokyo.paper.io.PaperFileIOThread.Holder.INSTANCE.scheduleSave( -+ this.world, chunkcoordintpair.x, chunkcoordintpair.z, nbttagcompound, null, -+ com.destroystokyo.paper.io.IOUtil.getPriorityForCurrentThread()); -+ return; -+ } -+ super.write(chunkcoordintpair, nbttagcompound); -+ } -+ // Paper end -+ - public static enum Occupancy { - - HAS_SPACE(VillagePlaceRecord::d), IS_OCCUPIED(VillagePlaceRecord::e), ANY((villageplacerecord) -> { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 6f9c3f913b2afbde3b5e285ffb9ee49017fa5464..85c9943a32f21e338daa295d5034af379edb8ddd 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -98,6 +98,79 @@ public class WorldServer extends World implements GeneratorAccessSeed { - return this.chunkProvider.getChunkAt(x, z, false); - } - -+ // Paper start - Asynchronous IO -+ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController poiDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { -+ @Override -+ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { -+ WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().write(new ChunkCoordIntPair(x, z), compound); -+ } -+ -+ @Override -+ public NBTTagCompound readData(int x, int z) throws java.io.IOException { -+ return WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().read(new ChunkCoordIntPair(x, z)); -+ } -+ -+ @Override -+ public T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { -+ RegionFile file; -+ -+ try { -+ file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } -+ -+ return function.apply(file); -+ } -+ } -+ -+ @Override -+ public T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace()) { -+ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.getVillagePlace().getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); -+ return function.apply(file); -+ } -+ } -+ }; -+ -+ public final com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController chunkDataController = new com.destroystokyo.paper.io.PaperFileIOThread.ChunkDataController() { -+ @Override -+ public void writeData(int x, int z, NBTTagCompound compound) throws java.io.IOException { -+ WorldServer.this.getChunkProvider().playerChunkMap.write(new ChunkCoordIntPair(x, z), compound); -+ } -+ -+ @Override -+ public NBTTagCompound readData(int x, int z) throws java.io.IOException { -+ return WorldServer.this.getChunkProvider().playerChunkMap.read(new ChunkCoordIntPair(x, z)); -+ } -+ -+ @Override -+ public T computeForRegionFile(int chunkX, int chunkZ, java.util.function.Function function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { -+ RegionFile file; -+ -+ try { -+ file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getFile(new ChunkCoordIntPair(chunkX, chunkZ), false); -+ } catch (java.io.IOException ex) { -+ throw new RuntimeException(ex); -+ } -+ -+ return function.apply(file); -+ } -+ } -+ -+ @Override -+ public T computeForRegionFileIfLoaded(int chunkX, int chunkZ, java.util.function.Function function) { -+ synchronized (WorldServer.this.getChunkProvider().playerChunkMap) { -+ RegionFile file = WorldServer.this.getChunkProvider().playerChunkMap.regionFileCache.getRegionFileIfLoaded(new ChunkCoordIntPair(chunkX, chunkZ)); -+ return function.apply(file); -+ } -+ } -+ }; -+ public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; -+ // Paper end -+ - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor -@@ -145,6 +218,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.dragonBattle = null; - } - this.getServer().addWorld(this.getWorld()); // CraftBukkit -+ -+ this.asyncChunkTaskManager = new com.destroystokyo.paper.io.chunk.ChunkTaskManager(this); // Paper - } - - // CraftBukkit start -@@ -1632,7 +1707,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - - MCUtil.getSpiralOutChunks(spawn, radiusInBlocks >> 4).forEach(pair -> { -- getChunkProvider().getChunkAtMainThread(pair.x, pair.z); -+ getChunkProvider().getChunkAtAsynchronously(pair.x, pair.z, true, false).exceptionally((ex) -> { -+ ex.printStackTrace(); -+ return null; -+ }); - }); - } - public void removeTicketsForSpawn(int radiusInBlocks, BlockPosition spawn) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index f750973175f15c782bd384c09a176e72979068d9..dbfc080be333dfd165da5bf300282b17fd35b9b6 100644 +index a0654c41ce981a12dc20e1ecaf13f1f2d150029f..ff6aff979ffaa740a5141ef6dc929fb3368bc194 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -75,6 +75,7 @@ import net.minecraft.server.IBlockData; - import net.minecraft.server.IChunkAccess; - import net.minecraft.server.IRegistry; - import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.MinecraftServer; - import net.minecraft.server.MovingObjectPosition; - import net.minecraft.server.PacketPlayOutCustomSoundEffect; - import net.minecraft.server.PacketPlayOutUpdateTime; -@@ -564,22 +565,23 @@ public class CraftWorld implements World { +@@ -563,22 +563,23 @@ public class CraftWorld implements World { return true; } -- net.minecraft.server.RegionFile file; +- net.minecraft.world.level.chunk.storage.RegionFile file; - try { - file = world.getChunkProvider().playerChunkMap.getIOWorker().getRegionFileCache().getFile(chunkPos, false); - } catch (IOException ex) { @@ -4040,7 +4034,7 @@ index f750973175f15c782bd384c09a176e72979068d9..dbfc080be333dfd165da5bf300282b17 + if (status == null) { // at this stage we don't know what it is on disk IChunkAccess chunk = world.getChunkProvider().getChunkAt(x, z, ChunkStatus.EMPTY, true); - if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.server.Chunk)) { + if (!(chunk instanceof ProtoChunkExtension) && !(chunk instanceof net.minecraft.world.level.chunk.Chunk)) { return false; } + } else if (status != ChunkStatus.FULL) { @@ -4050,7 +4044,7 @@ index f750973175f15c782bd384c09a176e72979068d9..dbfc080be333dfd165da5bf300282b17 // fall through to load // we do this so we do not re-read the chunk data on disk -@@ -2503,6 +2505,34 @@ public class CraftWorld implements World { +@@ -2502,6 +2503,34 @@ public class CraftWorld implements World { public DragonBattle getEnderDragonBattle() { return (getHandle().getDragonBattle() == null) ? null : new CraftDragonBattle(getHandle().getDragonBattle()); } @@ -4058,7 +4052,7 @@ index f750973175f15c782bd384c09a176e72979068d9..dbfc080be333dfd165da5bf300282b17 + @Override + public CompletableFuture getChunkAtAsync(int x, int z, boolean gen, boolean urgent) { + if (Bukkit.isPrimaryThread()) { -+ net.minecraft.server.Chunk immediate = this.world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z); ++ net.minecraft.world.level.chunk.Chunk immediate = this.world.getChunkProvider().getChunkAtIfLoadedImmediately(x, z); + if (immediate != null) { + return CompletableFuture.completedFuture(immediate.getBukkitChunk()); + } @@ -4077,19 +4071,19 @@ index f750973175f15c782bd384c09a176e72979068d9..dbfc080be333dfd165da5bf300282b17 + } + + return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { -+ net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); ++ net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null); + return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); -+ }, MinecraftServer.getServer()); ++ }, net.minecraft.server.MinecraftServer.getServer()); + } + // Paper end // Spigot start @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index d3d0f432da363414f8bbe5c62ac4ecadaf2ad0e4..84a39736a131338c27ffe202d45ac1f74409d4b2 100644 +index 93bbf63e9d38f32d5528c7693633d4b65655bb9d..27b90388cc21ffdccaabc8072ead1bd29f3e88c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -509,6 +509,28 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -508,6 +508,28 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { entity.setHeadRotation(yaw); } @@ -4119,7 +4113,7 @@ index d3d0f432da363414f8bbe5c62ac4ecadaf2ad0e4..84a39736a131338c27ffe202d45ac1f7 public boolean teleport(Location location) { return teleport(location, TeleportCause.PLUGIN); diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 1827fb786338fa49d15a3ab231eb7f26a8fa93b6..9c1fc19851817a842779ab89bc9300e1adf3d2a2 100644 +index abaefa0b71104756e4b458abefe13d179e7a1724..58e50bf0fb0f309227e1f4c1f6bb11c01d8e08d3 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -6,6 +6,7 @@ import java.lang.management.ThreadInfo; diff --git a/Spigot-Server-Patches/0370-Use-getChunkIfLoadedImmediately-in-places.patch b/Spigot-Server-Patches/0370-Use-getChunkIfLoadedImmediately-in-places.patch index 69fb8b1728..b011cf62ad 100644 --- a/Spigot-Server-Patches/0370-Use-getChunkIfLoadedImmediately-in-places.patch +++ b/Spigot-Server-Patches/0370-Use-getChunkIfLoadedImmediately-in-places.patch @@ -7,11 +7,24 @@ This prevents us from hitting chunk loads for chunks at or less-than ticket level 33 (yes getChunkIfLoaded will actually perform a chunk load in that case). -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 24a7666a74421ca07b6aeaa23ef3fc06d94b1f2e..0c21e000e9bcb921d8dde4fe4957d1e47f6df16d 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1098,7 +1098,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index ea89392698cd712844cde6976d60a1c2ba6f1b15..cc24b2fa12ba998fa7c41376ec442c05eb754375 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -204,7 +204,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + + @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI +- return this.chunkProvider.getChunkAt(x, z, false); ++ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper + } + + // Paper start - Asynchronous IO +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 24184c88f354baa082e2ceb0674a4a1a4e1eb65b..0ac3df7c0b9f49a7bb4dfcf97df74e9caeddc1f7 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1242,7 +1242,7 @@ public class PlayerConnection implements PacketListenerPlayIn { speed = player.abilities.walkSpeed * 10f; } // Paper start - Prevent moving into unloaded chunks @@ -20,11 +33,11 @@ index 24a7666a74421ca07b6aeaa23ef3fc06d94b1f2e..0c21e000e9bcb921d8dde4fe4957d1e4 this.internalTeleport(this.player.locX(), this.player.locY(), this.player.locZ(), this.player.yaw, this.player.pitch, Collections.emptySet()); return; } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 16bc226dfef36b5f96d95f2de4c6bc2e6e606332..c922f4d5c3a5e7af7237361cb95a5ba8bb3ce715 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -104,6 +104,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 81f657084afdfcace67a2245230b0cb91dd919bd..dbe1de86ea8d638f90adaf8ff78a34c2e95d0691 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -156,6 +156,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { return (CraftServer) Bukkit.getServer(); } @@ -38,7 +51,7 @@ index 16bc226dfef36b5f96d95f2de4c6bc2e6e606332..c922f4d5c3a5e7af7237361cb95a5ba8 public ResourceKey getTypeKey() { return typeKey; } -@@ -1002,14 +1009,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1054,14 +1061,14 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } public boolean p(BlockPosition blockposition) { @@ -55,7 +68,7 @@ index 16bc226dfef36b5f96d95f2de4c6bc2e6e606332..c922f4d5c3a5e7af7237361cb95a5ba8 return ichunkaccess == null ? false : ichunkaccess.getType(blockposition).a((IBlockAccess) this, blockposition, entity, enumdirection); } -@@ -1130,7 +1137,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -1182,7 +1189,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { for (int i1 = i; i1 < j; ++i1) { for (int j1 = k; j1 < l; ++j1) { @@ -64,24 +77,11 @@ index 16bc226dfef36b5f96d95f2de4c6bc2e6e606332..c922f4d5c3a5e7af7237361cb95a5ba8 if (chunk != null) { chunk.a(oclass, axisalignedbb, list, predicate); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 85c9943a32f21e338daa295d5034af379edb8ddd..f599d607afd73e30008e54757502077d783636a1 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -95,7 +95,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - } - - @Override public Chunk getChunkIfLoaded(int x, int z) { // Paper - this was added in world too but keeping here for NMS ABI -- return this.chunkProvider.getChunkAt(x, z, false); -+ return this.chunkProvider.getChunkAtIfLoadedImmediately(x, z); // Paper - } - - // Paper start - Asynchronous IO diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index d44ef056bdab3bcff39aea45b40a4c7e9c62398f..797e579afdbc77a8dc5fc4cdf5874e546922fbfa 100644 +index 58d22363124a9343188d8c19476e5a92f2f0b80b..53d0541aba207b5eaea2e49edbb56df918d30333 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -141,9 +141,10 @@ public class ActivationRange +@@ -140,9 +140,10 @@ public class ActivationRange { for ( int j1 = k; j1 <= l; ++j1 ) { diff --git a/Spigot-Server-Patches/0371-Reduce-sync-loads.patch b/Spigot-Server-Patches/0371-Reduce-sync-loads.patch index 18386c7851..e9346712b3 100644 --- a/Spigot-Server-Patches/0371-Reduce-sync-loads.patch +++ b/Spigot-Server-Patches/0371-Reduce-sync-loads.patch @@ -11,10 +11,10 @@ it must be enabled by setting the startup flag -Dpaper.debug-sync-loads=true To get a debug log for sync loads, the command is /paper syncloadinfo diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index 12f5e4b8b5d231b54405339518536aebf6a9d8fc..ebb17a2efde002f1384b5ad8f4f4576e9a3cc675 100644 +index f657e9b6bb3d24a6c77ef584711a003d1eea0341..eb1e86e8bb0f421e3686ffa02a4015a588107863 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -1,12 +1,16 @@ +@@ -1,6 +1,7 @@ package com.destroystokyo.paper; import com.destroystokyo.paper.io.chunk.ChunkTaskManager; @@ -22,16 +22,18 @@ index 12f5e4b8b5d231b54405339518536aebf6a9d8fc..ebb17a2efde002f1384b5ad8f4f4576e import com.google.common.base.Functions; import com.google.common.base.Joiner; import com.google.common.collect.ImmutableSet; - import com.google.common.collect.Iterables; +@@ -8,6 +9,10 @@ import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Maps; + import net.minecraft.resources.MinecraftKey; +import com.google.gson.JsonObject; +import com.google.gson.internal.Streams; +import com.google.gson.stream.JsonWriter; - import net.minecraft.server.ChunkCoordIntPair; - import net.minecraft.server.ChunkProviderServer; - import net.minecraft.server.Entity; -@@ -29,6 +33,9 @@ import org.bukkit.craftbukkit.CraftWorld; ++import net.minecraft.server.MCUtil; + import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.ChunkProviderServer; + import net.minecraft.server.level.PlayerChunk; +@@ -29,6 +34,9 @@ import org.bukkit.craftbukkit.CraftWorld; import org.bukkit.entity.Player; import java.io.File; @@ -41,7 +43,7 @@ index 12f5e4b8b5d231b54405339518536aebf6a9d8fc..ebb17a2efde002f1384b5ad8f4f4576e import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.ArrayList; -@@ -44,7 +51,7 @@ import java.util.stream.Collectors; +@@ -44,7 +52,7 @@ import java.util.stream.Collectors; public class PaperCommand extends Command { private static final String BASE_PERM = "bukkit.command.paper."; @@ -50,7 +52,7 @@ index 12f5e4b8b5d231b54405339518536aebf6a9d8fc..ebb17a2efde002f1384b5ad8f4f4576e public PaperCommand(String name) { super(name); -@@ -162,6 +169,9 @@ public class PaperCommand extends Command { +@@ -162,6 +170,9 @@ public class PaperCommand extends Command { case "chunkinfo": doChunkInfo(sender, args); break; @@ -60,7 +62,7 @@ index 12f5e4b8b5d231b54405339518536aebf6a9d8fc..ebb17a2efde002f1384b5ad8f4f4576e case "ver": if (!testPermission(sender, "version")) break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set) case "version": -@@ -179,6 +189,40 @@ public class PaperCommand extends Command { +@@ -179,6 +190,40 @@ public class PaperCommand extends Command { return true; } @@ -279,11 +281,11 @@ index 0000000000000000000000000000000000000000..1a68a8012f83bab9e814159c76b8c371 + } + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 03e59fd8dc339f3479243acb5d1c89883b280b68..070c3a842ebd9fa03e5daaee8355775718df6fb2 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -471,6 +471,7 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 32ef8b2e52b47c2fdeb13d00df5107fa7c3b540e..3d3c58cef3a92355caa6dad7053d129f2e8e0732 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -493,6 +493,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end @@ -291,42 +293,11 @@ index 03e59fd8dc339f3479243acb5d1c89883b280b68..070c3a842ebd9fa03e5daaee83557757 this.world.timings.syncChunkLoad.startTiming(); // Paper this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c922f4d5c3a5e7af7237361cb95a5ba8bb3ce715..dcca5257a03b6fe32ffcd6528e505762b7b4a3e7 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1070,7 +1070,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - for (int i1 = i; i1 <= j; ++i1) { - for (int j1 = k; j1 <= l; ++j1) { -- Chunk chunk = ichunkprovider.getChunkAt(i1, j1, false); -+ Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper - - if (chunk != null) { - chunk.a(entity, axisalignedbb, list, predicate); -@@ -1091,7 +1091,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - for (int i1 = i; i1 < j; ++i1) { - for (int j1 = k; j1 < l; ++j1) { -- Chunk chunk = this.getChunkProvider().getChunkAt(i1, j1, false); -+ Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper - - if (chunk != null) { - chunk.a(entitytypes, axisalignedbb, list, predicate); -@@ -1114,7 +1114,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - for (int i1 = i; i1 < j; ++i1) { - for (int j1 = k; j1 < l; ++j1) { -- Chunk chunk = ichunkprovider.getChunkAt(i1, j1, false); -+ Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper - - if (chunk != null) { - chunk.a(oclass, axisalignedbb, list, predicate); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index f599d607afd73e30008e54757502077d783636a1..6646b8e83c8658fa6cd4838ccd669fd4a280e2e8 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -170,6 +170,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index cc24b2fa12ba998fa7c41376ec442c05eb754375..04cbcb6a872c0b595a691f705131100341e0ec63 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -279,6 +279,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { }; public final com.destroystokyo.paper.io.chunk.ChunkTaskManager asyncChunkTaskManager; // Paper end @@ -339,3 +310,34 @@ index f599d607afd73e30008e54757502077d783636a1..6646b8e83c8658fa6cd4838ccd669fd4 // Add env and gen to constructor, WorldData -> WorldDataServer public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index dbe1de86ea8d638f90adaf8ff78a34c2e95d0691..3c66c1920119fdf6208e0d545f6b8bbd4e5d9a6d 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -1122,7 +1122,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + for (int i1 = i; i1 <= j; ++i1) { + for (int j1 = k; j1 <= l; ++j1) { +- Chunk chunk = ichunkprovider.getChunkAt(i1, j1, false); ++ Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper + + if (chunk != null) { + chunk.a(entity, axisalignedbb, list, predicate); +@@ -1143,7 +1143,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + for (int i1 = i; i1 < j; ++i1) { + for (int j1 = k; j1 < l; ++j1) { +- Chunk chunk = this.getChunkProvider().getChunkAt(i1, j1, false); ++ Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper + + if (chunk != null) { + chunk.a(entitytypes, axisalignedbb, list, predicate); +@@ -1166,7 +1166,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + for (int i1 = i; i1 < j; ++i1) { + for (int j1 = k; j1 < l; ++j1) { +- Chunk chunk = ichunkprovider.getChunkAt(i1, j1, false); ++ Chunk chunk = (Chunk)this.getChunkIfLoadedImmediately(i1, j1); // Paper + + if (chunk != null) { + chunk.a(oclass, axisalignedbb, list, predicate); diff --git a/Spigot-Server-Patches/0372-Implement-alternative-item-despawn-rate.patch b/Spigot-Server-Patches/0372-Implement-alternative-item-despawn-rate.patch index e517977715..4af6ed58d8 100644 --- a/Spigot-Server-Patches/0372-Implement-alternative-item-despawn-rate.patch +++ b/Spigot-Server-Patches/0372-Implement-alternative-item-despawn-rate.patch @@ -77,19 +77,19 @@ index 1ee2cced100626e48eb36ee14f84b9257c79a2f8..b913cd2dd0cd1b369b3f7b5a9d8b1be7 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 001ddbe669c8c1a534a4e023386c00085ee1af95..4a20ceaf649f91860047017028809cd8040c9e58 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -7,6 +7,7 @@ import java.util.UUID; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 02e4d6891adc902f73ed349f15dae3a429bd283a..0b2e6e72a85e05f239d56afb6785c91da5b25d55 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -33,6 +33,7 @@ import net.minecraft.world.phys.Vec3D; // CraftBukkit start + import net.minecraft.server.MinecraftServer; +import org.bukkit.Material; // Paper import org.bukkit.event.entity.EntityPickupItemEvent; import org.bukkit.event.player.PlayerPickupItemEvent; // CraftBukkit end -@@ -135,7 +136,7 @@ public class EntityItem extends Entity { +@@ -161,7 +162,7 @@ public class EntityItem extends Entity { } } @@ -98,7 +98,7 @@ index 001ddbe669c8c1a534a4e023386c00085ee1af95..4a20ceaf649f91860047017028809cd8 // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -159,7 +160,7 @@ public class EntityItem extends Entity { +@@ -185,7 +186,7 @@ public class EntityItem extends Entity { this.lastTick = MinecraftServer.currentTick; // CraftBukkit end @@ -107,7 +107,7 @@ index 001ddbe669c8c1a534a4e023386c00085ee1af95..4a20ceaf649f91860047017028809cd8 // CraftBukkit start - fire ItemDespawnEvent if (org.bukkit.craftbukkit.event.CraftEventFactory.callItemDespawnEvent(this).isCancelled()) { this.age = 0; -@@ -509,9 +510,16 @@ public class EntityItem extends Entity { +@@ -535,9 +536,16 @@ public class EntityItem extends Entity { public void s() { this.o(); diff --git a/Spigot-Server-Patches/0373-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch b/Spigot-Server-Patches/0373-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch index cdc056a6d5..b6182e96bc 100644 --- a/Spigot-Server-Patches/0373-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch +++ b/Spigot-Server-Patches/0373-Do-less-work-if-we-have-a-custom-Bukkit-generator.patch @@ -7,10 +7,10 @@ If the Bukkit generator already has a spawn, use it immediately instead of spending time generating one that we won't use diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 3b2fd34a797089c191d397c3e39551c395f7cfce..5c1f4ceb02908893b44e9e6120d3b278847141d4 100644 +index eafee14262ac8abb482bdd0fa52a8a33bf4a0f87..ede36b4c4d806bee62fd46d2e1ba595c9cd515ce 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -511,12 +511,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { - return this.bl; - } - -+ public final EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER - public EnumCreatureType e() { - return this.bg; - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index fff3604936365cab07ca9f94a2aaf1dd41911eef..938439d22f47fb18b36c145c4f4ea355f8405673 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -82,7 +82,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index a9c970f6a3227c37e55549488ab9bdadf833b0c1..207c8343815991c687c411cb374081fb485dd0b7 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -126,7 +126,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final Int2ObjectMap trackedEntities; private final Long2ByteMap z; private final Queue A; private final Queue getUnloadQueueTasks() { return this.A; } // Paper - OBFHELPER @@ -630,7 +618,7 @@ index fff3604936365cab07ca9f94a2aaf1dd41911eef..938439d22f47fb18b36c145c4f4ea355 // CraftBukkit start - recursion-safe executor for Chunk loadCallback() and unloadCallback() public final CallbackExecutor callbackExecutor = new CallbackExecutor(); -@@ -161,6 +162,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -205,6 +206,24 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.l = supplier; this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); @@ -655,11 +643,23 @@ index fff3604936365cab07ca9f94a2aaf1dd41911eef..938439d22f47fb18b36c145c4f4ea355 } private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { -diff --git a/src/main/java/net/minecraft/server/SpawnerCreature.java b/src/main/java/net/minecraft/server/SpawnerCreature.java -index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d7c88f8e5 100644 ---- a/src/main/java/net/minecraft/server/SpawnerCreature.java -+++ b/src/main/java/net/minecraft/server/SpawnerCreature.java -@@ -29,6 +29,11 @@ public final class SpawnerCreature { +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index 8ba75c847efa0633e7b8cb718e3a9b55e0b8ad77..82f42f73b9696220be6d8003ec8c108a4ba3f082 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -425,6 +425,7 @@ public class EntityTypes { + return this.bl; + } + ++ public final EnumCreatureType getEnumCreatureType() { return this.e(); } // Paper - OBFHELPER + public EnumCreatureType e() { + return this.bg; + } +diff --git a/src/main/java/net/minecraft/world/level/SpawnerCreature.java b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +index 166609e03474946882791dbebafe7121a3727854..66350a00f728901a7eef1c376c79a4cde2e9ed4b 100644 +--- a/src/main/java/net/minecraft/world/level/SpawnerCreature.java ++++ b/src/main/java/net/minecraft/world/level/SpawnerCreature.java +@@ -61,6 +61,11 @@ public final class SpawnerCreature { }); public static SpawnerCreature.d a(int i, Iterable iterable, SpawnerCreature.b spawnercreature_b) { @@ -671,7 +671,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d SpawnerCreatureProbabilities spawnercreatureprobabilities = new SpawnerCreatureProbabilities(); Object2IntOpenHashMap object2intopenhashmap = new Object2IntOpenHashMap(); Iterator iterator = iterable.iterator(); -@@ -66,6 +71,11 @@ public final class SpawnerCreature { +@@ -98,6 +103,11 @@ public final class SpawnerCreature { } object2intopenhashmap.addTo(enumcreaturetype, 1); @@ -683,7 +683,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d }); } } -@@ -124,13 +134,31 @@ public final class SpawnerCreature { +@@ -156,13 +166,31 @@ public final class SpawnerCreature { continue; } @@ -718,7 +718,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d } } -@@ -139,22 +167,34 @@ public final class SpawnerCreature { +@@ -171,22 +199,34 @@ public final class SpawnerCreature { } public static void a(EnumCreatureType enumcreaturetype, WorldServer worldserver, Chunk chunk, SpawnerCreature.c spawnercreature_c, SpawnerCreature.a spawnercreature_a) { @@ -755,7 +755,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d int k = 0; while (k < 3) { -@@ -194,7 +234,7 @@ public final class SpawnerCreature { +@@ -226,7 +266,7 @@ public final class SpawnerCreature { // Paper start Boolean doSpawning = a(worldserver, enumcreaturetype, structuremanager, chunkgenerator, biomesettingsmobs_c, blockposition_mutableblockposition, d2); if (doSpawning == null) { @@ -764,7 +764,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d } if (doSpawning && spawnercreature_c.test(biomesettingsmobs_c.c, blockposition_mutableblockposition, ichunkaccess)) { // Paper end -@@ -202,7 +242,7 @@ public final class SpawnerCreature { +@@ -234,7 +274,7 @@ public final class SpawnerCreature { if (entityinsentient == null) { @@ -773,7 +773,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d } entityinsentient.setPositionRotation(d0, (double) i, d1, worldserver.random.nextFloat() * 360.0F, 0.0F); -@@ -211,13 +251,18 @@ public final class SpawnerCreature { +@@ -243,13 +283,18 @@ public final class SpawnerCreature { // CraftBukkit start worldserver.addAllEntities(entityinsentient, SpawnReason.NATURAL); if (!entityinsentient.dead) { @@ -795,7 +795,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d } if (entityinsentient.c(k1)) { -@@ -239,6 +284,7 @@ public final class SpawnerCreature { +@@ -271,6 +316,7 @@ public final class SpawnerCreature { } } @@ -803,7 +803,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d } private static boolean a(WorldServer worldserver, IChunkAccess ichunkaccess, BlockPosition.MutableBlockPosition blockposition_mutableblockposition, double d0) { -@@ -479,8 +525,8 @@ public final class SpawnerCreature { +@@ -511,8 +557,8 @@ public final class SpawnerCreature { public static class d { @@ -814,7 +814,7 @@ index 979988c3c39afd80ce0b99a65dff5618a69ab600..661ad8f8e67046211e001ea40d97660d private final SpawnerCreatureProbabilities c; private final Object2IntMap d; @Nullable -@@ -541,7 +587,7 @@ public final class SpawnerCreature { +@@ -573,7 +619,7 @@ public final class SpawnerCreature { // CraftBukkit start private boolean a(EnumCreatureType enumcreaturetype, int limit) { diff --git a/Spigot-Server-Patches/0376-Prevent-consuming-the-wrong-itemstack.patch b/Spigot-Server-Patches/0376-Prevent-consuming-the-wrong-itemstack.patch index 82d110fb07..dba977497d 100644 --- a/Spigot-Server-Patches/0376-Prevent-consuming-the-wrong-itemstack.patch +++ b/Spigot-Server-Patches/0376-Prevent-consuming-the-wrong-itemstack.patch @@ -4,11 +4,11 @@ Date: Mon, 19 Aug 2019 19:42:35 +0500 Subject: [PATCH] Prevent consuming the wrong itemstack -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 870aa56735bae3344d7d01d252b943225cc056c4..4567b0fe175765748bb787049e10fbe0af0a61d9 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -3107,10 +3107,13 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 8a0d125bc1cf3a75141a286f0c9fb553827e556f..f0feb60b95eed9e7445bb37f60231ae1ac108963 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3200,10 +3200,13 @@ public abstract class EntityLiving extends Entity { this.datawatcher.set(EntityLiving.ag, (byte) j); } @@ -24,7 +24,7 @@ index 870aa56735bae3344d7d01d252b943225cc056c4..4567b0fe175765748bb787049e10fbe0 this.activeItem = itemstack; this.bd = itemstack.k(); if (!this.world.isClientSide) { -@@ -3188,6 +3191,7 @@ public abstract class EntityLiving extends Entity { +@@ -3281,6 +3284,7 @@ public abstract class EntityLiving extends Entity { this.releaseActiveItem(); } else { if (!this.activeItem.isEmpty() && this.isHandRaised()) { @@ -32,7 +32,7 @@ index 870aa56735bae3344d7d01d252b943225cc056c4..4567b0fe175765748bb787049e10fbe0 this.b(this.activeItem, 16); // CraftBukkit start - fire PlayerItemConsumeEvent ItemStack itemstack; -@@ -3222,8 +3226,8 @@ public abstract class EntityLiving extends Entity { +@@ -3315,8 +3319,8 @@ public abstract class EntityLiving extends Entity { } this.clearActiveItem(); diff --git a/Spigot-Server-Patches/0378-Generator-Settings.patch b/Spigot-Server-Patches/0378-Generator-Settings.patch index 213cd68b41..35a2520f5f 100644 --- a/Spigot-Server-Patches/0378-Generator-Settings.patch +++ b/Spigot-Server-Patches/0378-Generator-Settings.patch @@ -18,44 +18,11 @@ index 6aec502eb529d4090306e12e837117cde7e114eb..290e49cf0077909ad7ab8127c01ef93c + generateFlatBedrock = getBoolean("generator-settings.flat-bedrock", false); + } } -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 24befd3222e73cdd5853aac502a22387b1fdf81a..4741d28aec73ffa1d5a9f60a4086eac3375c83b1 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -374,8 +374,8 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - int i = ichunkaccess.getPos().d(); - int j = ichunkaccess.getPos().e(); - GeneratorSettingBase generatorsettingbase = (GeneratorSettingBase) this.h.get(); -- int k = generatorsettingbase.f(); -- int l = this.x - 1 - generatorsettingbase.e(); -+ int k = generatorsettingbase.f(); final int floorHeight = k; // Paper -+ int l = this.x - 1 - generatorsettingbase.e(); final int roofHeight = l; // Paper - boolean flag = true; - boolean flag1 = l + 4 >= 0 && l < this.x; - boolean flag2 = k + 4 >= 0 && k < this.x; -@@ -389,7 +389,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - - if (flag1) { - for (i1 = 0; i1 < 5; ++i1) { -- if (i1 <= random.nextInt(5)) { -+ if (i1 <= (ichunkaccess.generateFlatBedrock() ? roofHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock roof - ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), l - i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); - } - } -@@ -397,7 +397,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - - if (flag2) { - for (i1 = 4; i1 >= 0; --i1) { -- if (i1 <= random.nextInt(5)) { -+ if (i1 <= (ichunkaccess.generateFlatBedrock() ? floorHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock floor - ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), k + i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); - } - } -diff --git a/src/main/java/net/minecraft/server/IChunkAccess.java b/src/main/java/net/minecraft/server/IChunkAccess.java -index 887366f4c2ab608974113e75760b58c47f2afa00..180b6b58dc5663158db84b6f1257591439b48c31 100644 ---- a/src/main/java/net/minecraft/server/IChunkAccess.java -+++ b/src/main/java/net/minecraft/server/IChunkAccess.java -@@ -12,6 +12,18 @@ import org.apache.logging.log4j.LogManager; +diff --git a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java +index e570dc58efa56bd0aa5ada5575b4054ee38d505e..cdf612d7553a8f4aaebb5e0e66bd2a47a280457a 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java ++++ b/src/main/java/net/minecraft/world/level/chunk/IChunkAccess.java +@@ -25,6 +25,18 @@ import org.apache.logging.log4j.LogManager; public interface IChunkAccess extends IBlockAccess, IStructureAccess { @@ -74,11 +41,11 @@ index 887366f4c2ab608974113e75760b58c47f2afa00..180b6b58dc5663158db84b6f12575914 IBlockData getType(final int x, final int y, final int z); // Paper @Nullable IBlockData setType(BlockPosition blockposition, IBlockData iblockdata, boolean flag); -diff --git a/src/main/java/net/minecraft/server/ProtoChunk.java b/src/main/java/net/minecraft/server/ProtoChunk.java -index 912c5187a08e972fc9455aed33278387a83f03f2..5b0cd414ca1949ab53b289f7159f18da07d21f14 100644 ---- a/src/main/java/net/minecraft/server/ProtoChunk.java -+++ b/src/main/java/net/minecraft/server/ProtoChunk.java -@@ -46,7 +46,7 @@ public class ProtoChunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +index 9b308a10554b037ede0c455fbd3e906021218ddc..7bfac4e852c4a6697435647dab173913df6034e9 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ProtoChunk.java +@@ -64,7 +64,7 @@ public class ProtoChunk implements IChunkAccess { private long s; private final Map t; private volatile boolean u; @@ -87,3 +54,36 @@ index 912c5187a08e972fc9455aed33278387a83f03f2..5b0cd414ca1949ab53b289f7159f18da // Paper start - Anti-Xray - Add world @Deprecated public ProtoChunk(ChunkCoordIntPair chunkcoordintpair, ChunkConverter chunkconverter) { this(chunkcoordintpair, chunkconverter, null); } // Notice for updates: Please make sure this constructor isn't used anywhere +diff --git a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +index b137d65953fe1e44709e9a6dab3a4533df644d06..700b32322e8d0fbb8ec2824e50a340be16b48f81 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +@@ -408,8 +408,8 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + int i = ichunkaccess.getPos().d(); + int j = ichunkaccess.getPos().e(); + GeneratorSettingBase generatorsettingbase = (GeneratorSettingBase) this.h.get(); +- int k = generatorsettingbase.f(); +- int l = this.x - 1 - generatorsettingbase.e(); ++ int k = generatorsettingbase.f(); final int floorHeight = k; // Paper ++ int l = this.x - 1 - generatorsettingbase.e(); final int roofHeight = l; // Paper + boolean flag = true; + boolean flag1 = l + 4 >= 0 && l < this.x; + boolean flag2 = k + 4 >= 0 && k < this.x; +@@ -423,7 +423,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + + if (flag1) { + for (i1 = 0; i1 < 5; ++i1) { +- if (i1 <= random.nextInt(5)) { ++ if (i1 <= (ichunkaccess.generateFlatBedrock() ? roofHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock roof + ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), l - i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); + } + } +@@ -431,7 +431,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + + if (flag2) { + for (i1 = 4; i1 >= 0; --i1) { +- if (i1 <= random.nextInt(5)) { ++ if (i1 <= (ichunkaccess.generateFlatBedrock() ? floorHeight : random.nextInt(5))) { // Paper - Configurable flat bedrock floor + ichunkaccess.setType(blockposition_mutableblockposition.d(blockposition.getX(), k + i1, blockposition.getZ()), Blocks.BEDROCK.getBlockData(), false); + } + } diff --git a/Spigot-Server-Patches/0379-Fix-MC-161754.patch b/Spigot-Server-Patches/0379-Fix-MC-161754.patch index bdf800ee63..8ef2ece0bd 100644 --- a/Spigot-Server-Patches/0379-Fix-MC-161754.patch +++ b/Spigot-Server-Patches/0379-Fix-MC-161754.patch @@ -8,11 +8,11 @@ Fixes https://github.com/PaperMC/Paper/issues/2580 We can use an entity valid check since this method is invoked for each inventory iteraction (thanks to CB) and on player tick (vanilla). -diff --git a/src/main/java/net/minecraft/server/ContainerHorse.java b/src/main/java/net/minecraft/server/ContainerHorse.java -index 62a9f7802f3800a24a886cb7f592c803d65d1b9d..0c85658ec6f8314eb0fb30b55bdbc20dc03aa981 100644 ---- a/src/main/java/net/minecraft/server/ContainerHorse.java -+++ b/src/main/java/net/minecraft/server/ContainerHorse.java -@@ -76,7 +76,7 @@ public class ContainerHorse extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerHorse.java b/src/main/java/net/minecraft/world/inventory/ContainerHorse.java +index ecabe8e52865b71b6f89d09850b37741e7e79b50..ea64ef313a8378fa7dee086e137e1e5f43376804 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerHorse.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerHorse.java +@@ -85,7 +85,7 @@ public class ContainerHorse extends Container { @Override public boolean canUse(EntityHuman entityhuman) { diff --git a/Spigot-Server-Patches/0380-Performance-improvement-for-Chunk.getEntities.patch b/Spigot-Server-Patches/0380-Performance-improvement-for-Chunk.getEntities.patch index 7248da0be2..0b09feb060 100644 --- a/Spigot-Server-Patches/0380-Performance-improvement-for-Chunk.getEntities.patch +++ b/Spigot-Server-Patches/0380-Performance-improvement-for-Chunk.getEntities.patch @@ -10,7 +10,7 @@ operation. This patch will reduce the load of plugins which for example implement custom moblimits and depend on Chunk.getEntities(). diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index f09e783e38bbe4d8e825abf77884b9cb307bcce4..531d5e41dfbfbfe8da0676207f6325a0bca97a9a 100644 +index c36f55f178166eb099cc5c64784be5a9f4750199..8ade81a693286cdf65f8c0eeca2121a217c90350 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -117,14 +117,14 @@ public class CraftChunk implements Chunk { @@ -19,14 +19,14 @@ index f09e783e38bbe4d8e825abf77884b9cb307bcce4..531d5e41dfbfbfe8da0676207f6325a0 for (int i = 0; i < 16; i++) { - - for (Object obj : chunk.entitySlices[i].toArray()) { -- if (!(obj instanceof net.minecraft.server.Entity)) { +- if (!(obj instanceof net.minecraft.world.entity.Entity)) { + // Paper start - speed up (was with chunk.entitySlices[i].toArray() and cast checks which costs a lot of performance if called often) -+ for (net.minecraft.server.Entity entity : chunk.entitySlices[i]) { ++ for (net.minecraft.world.entity.Entity entity : chunk.entitySlices[i]) { + if (entity == null) { continue; } - -- entities[index++] = ((net.minecraft.server.Entity) obj).getBukkitEntity(); +- entities[index++] = ((net.minecraft.world.entity.Entity) obj).getBukkitEntity(); + entities[index++] = entity.getBukkitEntity(); } + // Paper end diff --git a/Spigot-Server-Patches/0381-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch b/Spigot-Server-Patches/0381-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch index bc5715ad8c..77a2de386b 100644 --- a/Spigot-Server-Patches/0381-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch +++ b/Spigot-Server-Patches/0381-Fix-spawning-of-hanging-entities-that-are-not-ItemFr.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix spawning of hanging entities that are not ItemFrames and diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index dbfc080be333dfd165da5bf300282b17fd35b9b6..1d76bf1045cd27e70c115ba490ceb5854b996604 100644 +index ff6aff979ffaa740a5141ef6dc929fb3368bc194..cc15f27759771c0d839dcc7118ed898cf3617619 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -1894,7 +1894,12 @@ public class CraftWorld implements World { +@@ -1892,7 +1892,12 @@ public class CraftWorld implements World { height = 9; } diff --git a/Spigot-Server-Patches/0383-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch b/Spigot-Server-Patches/0383-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch index 8dc9bf2ec7..88ed547850 100644 --- a/Spigot-Server-Patches/0383-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch +++ b/Spigot-Server-Patches/0383-Fix-stuck-in-sneak-when-changing-worlds-MC-10657.patch @@ -4,11 +4,11 @@ Date: Wed, 9 Oct 2019 21:51:43 -0500 Subject: [PATCH] Fix stuck in sneak when changing worlds (MC-10657) -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 92d0ccb9eddae6041e39a6dc06ad0c277bca3d1d..03730ae7a3e1464a406ddc8ea606a6046fb93d8a 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -944,6 +944,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 4a03432a644763dc3a56788e69ee2580a9e15254..77f1a2a5b1c172c5bc991d27aaa3e19a53de72c0 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -1071,6 +1071,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.lastHealthSent = -1.0F; this.lastFoodSent = -1; @@ -17,11 +17,11 @@ index 92d0ccb9eddae6041e39a6dc06ad0c277bca3d1d..03730ae7a3e1464a406ddc8ea606a604 // CraftBukkit start PlayerChangedWorldEvent changeEvent = new PlayerChangedWorldEvent(this.getBukkitEntity(), worldserver1.getWorld()); this.world.getServer().getPluginManager().callEvent(changeEvent); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index e0f075aade555ad3129ec0de47ee0ef0263953fe..bd8d2e60a1d0609d03978328b44516a18a0d2553 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -769,6 +769,8 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 7386c30b4455deb4e8916bb721e9505ad0aded15..0c51f90c103600be8881f204bdd18fb12e0ef11c 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -844,6 +844,8 @@ public abstract class PlayerList { entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobEffect)); } diff --git a/Spigot-Server-Patches/0384-Add-option-to-disable-pillager-patrols.patch b/Spigot-Server-Patches/0384-Add-option-to-disable-pillager-patrols.patch index 45289ae184..7adaa55dec 100644 --- a/Spigot-Server-Patches/0384-Add-option-to-disable-pillager-patrols.patch +++ b/Spigot-Server-Patches/0384-Add-option-to-disable-pillager-patrols.patch @@ -18,11 +18,11 @@ index 290e49cf0077909ad7ab8127c01ef93cf7b70b51..e726b6213cf2e8f5b326f05c0438b8f1 + disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols); + } } -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -index ec5c96112cedf418a9e7f7d245a4b007b56db953..7ed89bbe465402582c9d28f0a3935758a6b0f7af 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -@@ -10,6 +10,7 @@ public class MobSpawnerPatrol implements MobSpawner { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java +index 04a1af9c6742f7aa944dec80e75ff8a4ca4bf57f..cba98adb7f2711fb97c7e4120d962f46a59682e7 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java +@@ -26,6 +26,7 @@ public class MobSpawnerPatrol implements MobSpawner { @Override public int a(WorldServer worldserver, boolean flag, boolean flag1) { diff --git a/Spigot-Server-Patches/0385-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch b/Spigot-Server-Patches/0385-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch index 5a3ac63908..d77ec9555a 100644 --- a/Spigot-Server-Patches/0385-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch +++ b/Spigot-Server-Patches/0385-Fix-AssertionError-when-player-hand-set-to-empty-typ.patch @@ -6,23 +6,11 @@ Subject: [PATCH] Fix AssertionError when player hand set to empty type Fixes an AssertionError when setting the player's item in hand to null or a new ItemStack of Air in PlayerInteractEvent Fixes GH-2718 -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 4567b0fe175765748bb787049e10fbe0af0a61d9..11a1fad5450ec94aeb4b135d7efc72718297c9cd 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2062,6 +2062,7 @@ public abstract class EntityLiving extends Entity { - return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem()); - } - -+ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER - public ItemStack b(EnumHand enumhand) { - if (enumhand == EnumHand.MAIN_HAND) { - return this.getEquipment(EnumItemSlot.MAINHAND); -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0c21e000e9bcb921d8dde4fe4957d1e47f6df16d..33112515865b6c2d357c0560637c0aa995ca6d0f 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1561,6 +1561,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 0ac3df7c0b9f49a7bb4dfcf97df74e9caeddc1f7..fef5b401a168c5b2be26c834e03b014d6231daf9 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1705,6 +1705,10 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.getBukkitEntity().updateInventory(); // SPIGOT-2524 return; } @@ -33,3 +21,15 @@ index 0c21e000e9bcb921d8dde4fe4957d1e47f6df16d..33112515865b6c2d357c0560637c0aa9 EnumInteractionResult enuminteractionresult = this.player.playerInteractManager.a(this.player, worldserver, itemstack, enumhand); if (enuminteractionresult.b()) { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index f0feb60b95eed9e7445bb37f60231ae1ac108963..1102659557ea9f0ab4fe6225cbf1dc1006661caf 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -2155,6 +2155,7 @@ public abstract class EntityLiving extends Entity { + return predicate.test(this.getItemInMainHand().getItem()) || predicate.test(this.getItemInOffHand().getItem()); + } + ++ public final ItemStack getItemInHand(EnumHand enumhand) { return this.b(enumhand); } // Paper - OBFHELPER + public ItemStack b(EnumHand enumhand) { + if (enumhand == EnumHand.MAIN_HAND) { + return this.getEquipment(EnumItemSlot.MAINHAND); diff --git a/Spigot-Server-Patches/0386-PlayerLaunchProjectileEvent.patch b/Spigot-Server-Patches/0386-PlayerLaunchProjectileEvent.patch index 169c1a0029..f3b9110187 100644 --- a/Spigot-Server-Patches/0386-PlayerLaunchProjectileEvent.patch +++ b/Spigot-Server-Patches/0386-PlayerLaunchProjectileEvent.patch @@ -4,10 +4,10 @@ Date: Sat, 21 Jul 2018 03:11:03 -0500 Subject: [PATCH] PlayerLaunchProjectileEvent -diff --git a/src/main/java/net/minecraft/server/InteractionResultWrapper.java b/src/main/java/net/minecraft/server/InteractionResultWrapper.java -index d59a0b739c0b8787029969a14002042e5c288ae8..8b2fc1c0e608c911b2cdc95ef134f84e3760c05d 100644 ---- a/src/main/java/net/minecraft/server/InteractionResultWrapper.java -+++ b/src/main/java/net/minecraft/server/InteractionResultWrapper.java +diff --git a/src/main/java/net/minecraft/world/InteractionResultWrapper.java b/src/main/java/net/minecraft/world/InteractionResultWrapper.java +index dd17c111670e637b574f5c7f38d27848900ce194..8cecc3d909a51b1892b4a299a5e6ec3518db9b39 100644 +--- a/src/main/java/net/minecraft/world/InteractionResultWrapper.java ++++ b/src/main/java/net/minecraft/world/InteractionResultWrapper.java @@ -10,6 +10,7 @@ public class InteractionResultWrapper { this.b = t0; } @@ -16,11 +16,11 @@ index d59a0b739c0b8787029969a14002042e5c288ae8..8b2fc1c0e608c911b2cdc95ef134f84e public EnumInteractionResult a() { return this.a; } -diff --git a/src/main/java/net/minecraft/server/ItemEgg.java b/src/main/java/net/minecraft/server/ItemEgg.java -index f028cb04d692f848a4682aa2eeac2174eb0f6769..6ddb0237c013e5c40d6c28a300f33443f6f703a5 100644 ---- a/src/main/java/net/minecraft/server/ItemEgg.java -+++ b/src/main/java/net/minecraft/server/ItemEgg.java -@@ -16,21 +16,35 @@ public class ItemEgg extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemEgg.java b/src/main/java/net/minecraft/world/item/ItemEgg.java +index 2083ab6e0dc7e48d409a5ee33e712e34abd6f6bf..4b1a6ee784da4595931396a905f1358b7a13f3dd 100644 +--- a/src/main/java/net/minecraft/world/item/ItemEgg.java ++++ b/src/main/java/net/minecraft/world/item/ItemEgg.java +@@ -25,21 +25,35 @@ public class ItemEgg extends Item { entityegg.setItem(itemstack); entityegg.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F); @@ -31,18 +31,18 @@ index f028cb04d692f848a4682aa2eeac2174eb0f6769..6ddb0237c013e5c40d6c28a300f33443 + if (event.callEvent() && world.addEntity(entityegg)) { + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); ++ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { ++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } + -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_EGG_THROW, SoundCategory.PLAYERS, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); + entityhuman.b(StatisticList.ITEM_USED.b(this)); + } else { - if (entityhuman instanceof EntityPlayer) { - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { + ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); } - return InteractionResultWrapper.fail(itemstack); -+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); ++ return new InteractionResultWrapper(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); } - // CraftBukkit end + // Paper end @@ -60,11 +60,11 @@ index f028cb04d692f848a4682aa2eeac2174eb0f6769..6ddb0237c013e5c40d6c28a300f33443 return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemEnderPearl.java b/src/main/java/net/minecraft/server/ItemEnderPearl.java -index aa7356e6a18c0bf72314e92809a4eab320d3695f..0e154ee2976694dacf8d41fcd831f21fbbda13af 100644 ---- a/src/main/java/net/minecraft/server/ItemEnderPearl.java -+++ b/src/main/java/net/minecraft/server/ItemEnderPearl.java -@@ -16,22 +16,37 @@ public class ItemEnderPearl extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemEnderPearl.java b/src/main/java/net/minecraft/world/item/ItemEnderPearl.java +index 5349282b9a5b43c4c3539e1677971463e2ca5a17..9896d77381e7fadf1ef2619210713e190c1445d0 100644 +--- a/src/main/java/net/minecraft/world/item/ItemEnderPearl.java ++++ b/src/main/java/net/minecraft/world/item/ItemEnderPearl.java +@@ -25,22 +25,37 @@ public class ItemEnderPearl extends Item { entityenderpearl.setItem(itemstack); entityenderpearl.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F); @@ -74,20 +74,20 @@ index aa7356e6a18c0bf72314e92809a4eab320d3695f..0e154ee2976694dacf8d41fcd831f21f + if (event.callEvent() && world.addEntity(entityenderpearl)) { + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { + itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); ++ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { ++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } + -+ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); ++ world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_ENDER_PEARL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (net.minecraft.world.entity.Entity.SHARED_RANDOM.nextFloat() * 0.4F + 0.8F)); + entityhuman.b(StatisticList.ITEM_USED.b(this)); + entityhuman.getCooldownTracker().setCooldown(this, 20); + } else { + // Paper end - if (entityhuman instanceof EntityPlayer) { - ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { + ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); } -- return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); -+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); +- return InteractionResultWrapper.fail(itemstack); ++ return new InteractionResultWrapper(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); } } @@ -112,11 +112,11 @@ index aa7356e6a18c0bf72314e92809a4eab320d3695f..0e154ee2976694dacf8d41fcd831f21f return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemExpBottle.java b/src/main/java/net/minecraft/server/ItemExpBottle.java -index 07e12714d064a2ccc7a3a50fbb88517f9a3b8b78..10abf20e907f1ea25797ff33d181de7eaed9a9da 100644 ---- a/src/main/java/net/minecraft/server/ItemExpBottle.java -+++ b/src/main/java/net/minecraft/server/ItemExpBottle.java -@@ -15,19 +15,38 @@ public class ItemExpBottle extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemExpBottle.java b/src/main/java/net/minecraft/world/item/ItemExpBottle.java +index 3f41fe5bf1a0cc283d6a72824779026fdad75708..6a12b87847f9d5a37299c81f8082cf9eceb4e5c4 100644 +--- a/src/main/java/net/minecraft/world/item/ItemExpBottle.java ++++ b/src/main/java/net/minecraft/world/item/ItemExpBottle.java +@@ -24,19 +24,38 @@ public class ItemExpBottle extends Item { public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { ItemStack itemstack = entityhuman.b(enumhand); @@ -157,11 +157,11 @@ index 07e12714d064a2ccc7a3a50fbb88517f9a3b8b78..10abf20e907f1ea25797ff33d181de7e return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemFireworks.java b/src/main/java/net/minecraft/server/ItemFireworks.java -index 885c03f62da3b14bf7aeb31f1ae6a95bc9f86de1..e775fe69ee7e555721bc73e7cb0dd3136736bc9c 100644 ---- a/src/main/java/net/minecraft/server/ItemFireworks.java -+++ b/src/main/java/net/minecraft/server/ItemFireworks.java -@@ -20,8 +20,12 @@ public class ItemFireworks extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemFireworks.java b/src/main/java/net/minecraft/world/item/ItemFireworks.java +index 79e9be800385b94c4493bd8970620d76bfbd65ae..3cb52eb8c76c5d9aeed90798156cb2710773185a 100644 +--- a/src/main/java/net/minecraft/world/item/ItemFireworks.java ++++ b/src/main/java/net/minecraft/world/item/ItemFireworks.java +@@ -29,8 +29,12 @@ public class ItemFireworks extends Item { EntityFireworks entityfireworks = new EntityFireworks(world, itemactioncontext.getEntity(), vec3d.x + (double) enumdirection.getAdjacentX() * 0.15D, vec3d.y + (double) enumdirection.getAdjacentY() * 0.15D, vec3d.z + (double) enumdirection.getAdjacentZ() * 0.15D, itemstack); entityfireworks.spawningEntity = itemactioncontext.getEntity().getUniqueID(); // Paper @@ -176,11 +176,11 @@ index 885c03f62da3b14bf7aeb31f1ae6a95bc9f86de1..e775fe69ee7e555721bc73e7cb0dd313 } return EnumInteractionResult.a(world.isClientSide); -diff --git a/src/main/java/net/minecraft/server/ItemLingeringPotion.java b/src/main/java/net/minecraft/server/ItemLingeringPotion.java -index 685d958994bc35ad5eceba629e6743b41e2cc04b..58f7191a6980265e8fab17cf39769bbbca0ee105 100644 ---- a/src/main/java/net/minecraft/server/ItemLingeringPotion.java -+++ b/src/main/java/net/minecraft/server/ItemLingeringPotion.java -@@ -8,7 +8,12 @@ public class ItemLingeringPotion extends ItemPotionThrowable { +diff --git a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java +index a75f374f0639e8143772aa863666afe25d2020cf..5ac094d7cb7bd5f376b6aabbc09b2f024f8bfb18 100644 +--- a/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java ++++ b/src/main/java/net/minecraft/world/item/ItemLingeringPotion.java +@@ -15,7 +15,12 @@ public class ItemLingeringPotion extends ItemPotionThrowable { @Override public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { @@ -195,11 +195,11 @@ index 685d958994bc35ad5eceba629e6743b41e2cc04b..58f7191a6980265e8fab17cf39769bbb + // Paper end } } -diff --git a/src/main/java/net/minecraft/server/ItemPotionThrowable.java b/src/main/java/net/minecraft/server/ItemPotionThrowable.java -index dee3d4042b0cd1ace86fe1d80d894d0cc48cf941..9c84de77df7e32915a633b92c842cfb69e30e0d0 100644 ---- a/src/main/java/net/minecraft/server/ItemPotionThrowable.java -+++ b/src/main/java/net/minecraft/server/ItemPotionThrowable.java -@@ -15,13 +15,31 @@ public class ItemPotionThrowable extends ItemPotion { +diff --git a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java +index d050243946ad7023d5dd3958d7056cddcaf185a4..2b795ee9cfb98addc7fabe3363284bf6a493237e 100644 +--- a/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java ++++ b/src/main/java/net/minecraft/world/item/ItemPotionThrowable.java +@@ -22,13 +22,31 @@ public class ItemPotionThrowable extends ItemPotion { entitypotion.setItem(itemstack); entitypotion.a(entityhuman, entityhuman.pitch, entityhuman.yaw, -20.0F, 0.5F, 1.0F); @@ -232,11 +232,11 @@ index dee3d4042b0cd1ace86fe1d80d894d0cc48cf941..9c84de77df7e32915a633b92c842cfb6 return InteractionResultWrapper.a(itemstack, world.s_()); } -diff --git a/src/main/java/net/minecraft/server/ItemSnowball.java b/src/main/java/net/minecraft/server/ItemSnowball.java -index 19ac8cc57d6400e7574dd475dd21f2f48a954324..4242b5c4ed1e7d546fee7e2b3892b7b25e1259ff 100644 ---- a/src/main/java/net/minecraft/server/ItemSnowball.java -+++ b/src/main/java/net/minecraft/server/ItemSnowball.java -@@ -17,14 +17,20 @@ public class ItemSnowball extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemSnowball.java b/src/main/java/net/minecraft/world/item/ItemSnowball.java +index e5200b2a7d6d5c2d549e585ed157ec5217edae8e..8a1d59cb1ea5a8959c52272aa762ec35307246d7 100644 +--- a/src/main/java/net/minecraft/world/item/ItemSnowball.java ++++ b/src/main/java/net/minecraft/world/item/ItemSnowball.java +@@ -26,14 +26,20 @@ public class ItemSnowball extends Item { entitysnowball.setItem(itemstack); entitysnowball.a(entityhuman, entityhuman.pitch, entityhuman.yaw, 0.0F, 1.5F, 1.0F); @@ -248,24 +248,24 @@ index 19ac8cc57d6400e7574dd475dd21f2f48a954324..4242b5c4ed1e7d546fee7e2b3892b7b2 + if (event.shouldConsume() && !entityhuman.abilities.canInstantlyBuild) { + // Paper end itemstack.subtract(1); -+ } else if (entityhuman instanceof EntityPlayer) { // Paper -+ ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper ++ } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { // Paper ++ ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper } world.playSound((EntityHuman) null, entityhuman.locX(), entityhuman.locY(), entityhuman.locZ(), SoundEffects.ENTITY_SNOWBALL_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (ItemSnowball.RANDOM.nextFloat() * 0.4F + 0.8F)); -- } else if (entityhuman instanceof EntityPlayer) { -- ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); +- } else if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) { +- ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); + } else { // Paper -+ if (entityhuman instanceof EntityPlayer) ((EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper -+ return new InteractionResultWrapper(EnumInteractionResult.FAIL, itemstack); // Paper ++ if (entityhuman instanceof net.minecraft.server.level.EntityPlayer) ((net.minecraft.server.level.EntityPlayer) entityhuman).getBukkitEntity().updateInventory(); // Paper ++ return new InteractionResultWrapper(net.minecraft.world.EnumInteractionResult.FAIL, itemstack); // Paper } } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/ItemSplashPotion.java b/src/main/java/net/minecraft/server/ItemSplashPotion.java -index 3574cf875c6284687c10637159ec96a823ade2dc..c919a402e80a5c6b17fdbd99e110be1abefda747 100644 ---- a/src/main/java/net/minecraft/server/ItemSplashPotion.java -+++ b/src/main/java/net/minecraft/server/ItemSplashPotion.java -@@ -8,7 +8,12 @@ public class ItemSplashPotion extends ItemPotionThrowable { +diff --git a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java +index 98f29fac4bf087ad15f1cc7e85b408e22ec07efd..052e7056271bc21fceaf4fa78e9e833ac5c0cad9 100644 +--- a/src/main/java/net/minecraft/world/item/ItemSplashPotion.java ++++ b/src/main/java/net/minecraft/world/item/ItemSplashPotion.java +@@ -15,7 +15,12 @@ public class ItemSplashPotion extends ItemPotionThrowable { @Override public InteractionResultWrapper a(World world, EntityHuman entityhuman, EnumHand enumhand) { diff --git a/Spigot-Server-Patches/0388-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch b/Spigot-Server-Patches/0388-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch index bbb6cb4aa8..0188a5ae7f 100644 --- a/Spigot-Server-Patches/0388-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch +++ b/Spigot-Server-Patches/0388-Prevent-sync-chunk-loads-when-villagers-try-to-find-.patch @@ -4,11 +4,11 @@ Date: Mon, 13 Jan 2020 23:47:28 -0600 Subject: [PATCH] Prevent sync chunk loads when villagers try to find beds -diff --git a/src/main/java/net/minecraft/server/BehaviorSleep.java b/src/main/java/net/minecraft/server/BehaviorSleep.java -index 98ea2478898643a5744760b2d2adfacfa0bd5956..aadc27ddebbcc00d19d3d87593f130cf309e10ef 100644 ---- a/src/main/java/net/minecraft/server/BehaviorSleep.java -+++ b/src/main/java/net/minecraft/server/BehaviorSleep.java -@@ -32,7 +32,8 @@ public class BehaviorSleep extends Behavior { +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java +index 84eba4c91e8e608b84623d6c71233e2512b77a54..ce86301723d20e79f95207cce1084bac091742fe 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorSleep.java +@@ -46,7 +46,8 @@ public class BehaviorSleep extends Behavior { } } diff --git a/Spigot-Server-Patches/0389-MC-145656-Fix-Follow-Range-Initial-Target.patch b/Spigot-Server-Patches/0389-MC-145656-Fix-Follow-Range-Initial-Target.patch index e14f9ddfec..2fec6fc79d 100644 --- a/Spigot-Server-Patches/0389-MC-145656-Fix-Follow-Range-Initial-Target.patch +++ b/Spigot-Server-Patches/0389-MC-145656-Fix-Follow-Range-Initial-Target.patch @@ -18,11 +18,11 @@ index e726b6213cf2e8f5b326f05c0438b8f1ee2b73c5..edda2121f8c1046478beaa77030ebb36 + entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); + } } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -index 25a67f91e487d80d3996cc8b2544fece55059590..c0721c7fe479c8f753b8f48197a70dcd1ecfef5f 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java -@@ -25,6 +25,7 @@ public class PathfinderGoalNearestAttackableTarget exten +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java +index 4f0a2cbdd6d42e3e4721345e21bf0ef33ec48e1e..44f21c3f7af17e9d39777a48c6715a22fc085da6 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/target/PathfinderGoalNearestAttackableTarget.java +@@ -32,6 +32,7 @@ public class PathfinderGoalNearestAttackableTarget exten this.b = i; this.a(EnumSet.of(PathfinderGoal.Type.TARGET)); this.d = (new PathfinderTargetCondition()).a(this.k()).a(predicate); @@ -30,11 +30,11 @@ index 25a67f91e487d80d3996cc8b2544fece55059590..c0721c7fe479c8f753b8f48197a70dcd } @Override -diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java -index 174464273d1069ea07f12aaea116206366bad89f..253377c6238594de1f76cafcbf8223592e4d3f6b 100644 ---- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java -+++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java -@@ -80,7 +80,7 @@ public class PathfinderTargetCondition { +diff --git a/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java b/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java +index 0de32bcf24a94efe5af922b877d4cdc3578e0cbd..3853eaee9c2447f0e5e414a6f01ef6d207acd479 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java ++++ b/src/main/java/net/minecraft/world/entity/ai/targeting/PathfinderTargetCondition.java +@@ -82,7 +82,7 @@ public class PathfinderTargetCondition { if (this.b > 0.0D) { double d0 = this.g ? entityliving1.A(entityliving) : 1.0D; @@ -43,7 +43,7 @@ index 174464273d1069ea07f12aaea116206366bad89f..253377c6238594de1f76cafcbf822359 double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ()); if (d2 > d1 * d1) { -@@ -96,4 +96,18 @@ public class PathfinderTargetCondition { +@@ -98,4 +98,18 @@ public class PathfinderTargetCondition { return true; } } diff --git a/Spigot-Server-Patches/0390-Optimize-Hoppers.patch b/Spigot-Server-Patches/0390-Optimize-Hoppers.patch index 88c3349b49..6a6905b5e0 100644 --- a/Spigot-Server-Patches/0390-Optimize-Hoppers.patch +++ b/Spigot-Server-Patches/0390-Optimize-Hoppers.patch @@ -30,11 +30,58 @@ index edda2121f8c1046478beaa77030ebb36d403b334..7fbd501d70dccf869a4454e2789a5d68 + log("Hopper Move Item Events: " + (disableHopperMoveEvents ? "disabled" : "enabled")); + } } -diff --git a/src/main/java/net/minecraft/server/IHopper.java b/src/main/java/net/minecraft/server/IHopper.java -index b548ab8b7eb7e3c8a455f4653c30ea1610f268e8..187000f1e49f6609267b00f69fe2d266ea6b9255 100644 ---- a/src/main/java/net/minecraft/server/IHopper.java -+++ b/src/main/java/net/minecraft/server/IHopper.java -@@ -12,12 +12,13 @@ public interface IHopper extends IInventory { +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index ede36b4c4d806bee62fd46d2e1ba595c9cd515ce..ef6559190c336822149560d2f2748b2c90dfad86 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -1350,6 +1350,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper ++ TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + + this.methodProfiler.a(() -> { + return worldserver + " " + worldserver.getDimensionKey().a(); +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 5da20483ed352ac6d9695287f840ed643a2bf302..8a2ff2ef17aba806a63be3aaebfa779dac96831d 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -540,11 +540,12 @@ public final class ItemStack { + return this.getItem().a(this, entityhuman, entityliving, enumhand); + } + +- public ItemStack cloneItemStack() { +- if (this.isEmpty()) { ++ public ItemStack cloneItemStack() { return cloneItemStack(false); } // Paper ++ public ItemStack cloneItemStack(boolean origItem) { // Paper ++ if (!origItem && this.isEmpty()) { // Paper + return ItemStack.b; + } else { +- ItemStack itemstack = new ItemStack(this.getItem(), this.count); ++ ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper + + itemstack.d(this.D()); + if (this.tag != null) { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 3c66c1920119fdf6208e0d545f6b8bbd4e5d9a6d..03d521444178aa6d3291f4177cdca993c8a251fc 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -1154,8 +1154,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return list; + } + +- @Override +- public List a(Class oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { ++ public List getEntities(Class oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { return a(oclass, axisalignedbb, predicate); } // Paper - OBFHELPER ++ @Override public List a(Class oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { + this.getMethodProfiler().c("getEntities"); + int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); + int j = MathHelper.f((axisalignedbb.maxX + 2.0D) / 16.0D); +diff --git a/src/main/java/net/minecraft/world/level/block/entity/IHopper.java b/src/main/java/net/minecraft/world/level/block/entity/IHopper.java +index d0943ae1f372784716195666212ff83e6ee4873e..885ca0a12d3514212bd03392c7da6891efc05b0b 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/IHopper.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/IHopper.java +@@ -17,12 +17,13 @@ public interface IHopper extends IInventory { return IHopper.c; } @@ -52,43 +99,11 @@ index b548ab8b7eb7e3c8a455f4653c30ea1610f268e8..187000f1e49f6609267b00f69fe2d266 - double A(); + double A(); default double getZ() { return this.A(); } // Paper - OBFHELPER } -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index 7ad595d5d7e090c523aa45a10d0f84b609ea86df..e3e2ecfcc6dabf02844551d94138e6c6ae18358a 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -486,11 +486,12 @@ public final class ItemStack { - return this.getItem().a(this, entityhuman, entityliving, enumhand); - } - -- public ItemStack cloneItemStack() { -- if (this.isEmpty()) { -+ public ItemStack cloneItemStack() { return cloneItemStack(false); } // Paper -+ public ItemStack cloneItemStack(boolean origItem) { // Paper -+ if (!origItem && this.isEmpty()) { // Paper - return ItemStack.b; - } else { -- ItemStack itemstack = new ItemStack(this.getItem(), this.count); -+ ItemStack itemstack = new ItemStack(origItem ? this.item : this.getItem(), this.count); // Paper - - itemstack.d(this.D()); - if (this.tag != null) { -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5c1f4ceb02908893b44e9e6120d3b278847141d4..0176fdd76ad1f3c281319d07c3ff463bde0e8b47 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1243,6 +1243,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper -+ TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - - this.methodProfiler.a(() -> { - return worldserver + " " + worldserver.getDimensionKey().a(); -diff --git a/src/main/java/net/minecraft/server/TileEntity.java b/src/main/java/net/minecraft/server/TileEntity.java -index c6ae3d3f9d7957d4bbe0b4e2613558e5cd9dd9ec..060c1206e4b5da6be50fff605894fb2a46f57c1b 100644 ---- a/src/main/java/net/minecraft/server/TileEntity.java -+++ b/src/main/java/net/minecraft/server/TileEntity.java -@@ -66,6 +66,7 @@ public abstract class TileEntity implements KeyedObject { // Paper +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +index 642ed6e5788a79f7bc7d6185564bdf0df07e492c..a497d23de7ff0dba9e0ac10a63e77fc514599d51 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntity.java +@@ -76,6 +76,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public void setCurrentChunk(Chunk chunk) { this.currentChunk = chunk != null ? new java.lang.ref.WeakReference<>(chunk) : null; } @@ -96,7 +111,7 @@ index c6ae3d3f9d7957d4bbe0b4e2613558e5cd9dd9ec..060c1206e4b5da6be50fff605894fb2a // Paper end @Nullable -@@ -144,6 +145,7 @@ public abstract class TileEntity implements KeyedObject { // Paper +@@ -154,6 +155,7 @@ public abstract class TileEntity implements net.minecraft.server.KeyedObject { / public void update() { if (this.world != null) { @@ -104,11 +119,11 @@ index c6ae3d3f9d7957d4bbe0b4e2613558e5cd9dd9ec..060c1206e4b5da6be50fff605894fb2a this.c = this.world.getType(this.position); this.world.b(this.position, this); if (!this.c.isAir()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityHopper.java b/src/main/java/net/minecraft/server/TileEntityHopper.java -index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d2033acd0ea 100644 ---- a/src/main/java/net/minecraft/server/TileEntityHopper.java -+++ b/src/main/java/net/minecraft/server/TileEntityHopper.java -@@ -168,6 +168,160 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java +index 5fe715e8dbe9d925170acce6e0f18312d9f998f2..66cbb46088c6938ebe1d3771b3312112dd1a7160 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityHopper.java +@@ -196,6 +196,160 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi return false; } @@ -269,7 +284,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 private boolean k() { IInventory iinventory = this.l(); -@@ -179,6 +333,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -207,6 +361,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi if (this.b(iinventory, enumdirection)) { return false; } else { @@ -277,7 +292,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 for (int i = 0; i < this.getSize(); ++i) { if (!this.getItem(i).isEmpty()) { ItemStack itemstack = this.getItem(i).cloneItemStack(); -@@ -216,7 +371,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -244,7 +399,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } } @@ -286,7 +301,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 } } } -@@ -225,18 +380,54 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -253,18 +408,54 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi return iinventory instanceof IWorldInventory ? IntStream.of(((IWorldInventory) iinventory).getSlotsForFace(enumdirection)) : IntStream.range(0, iinventory.getSize()); } @@ -349,7 +364,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 } public static boolean a(IHopper ihopper) { -@@ -245,9 +436,17 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -273,9 +464,17 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi if (iinventory != null) { EnumDirection enumdirection = EnumDirection.DOWN; @@ -369,7 +384,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 } else { Iterator iterator = c(ihopper).iterator(); -@@ -265,10 +464,11 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -293,10 +492,11 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } } @@ -383,7 +398,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 ItemStack itemstack1 = itemstack.cloneItemStack(); // ItemStack itemstack2 = addItem(iinventory, ihopper, iinventory.splitStack(i, 1), (EnumDirection) null); // CraftBukkit start - Call event on collection of items from inventories into the hopper -@@ -305,7 +505,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -333,7 +533,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } itemstack1.subtract(origCount - itemstack2.getCount()); // Spigot @@ -392,7 +407,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 } return false; -@@ -314,7 +514,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -342,7 +542,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi public static boolean a(IInventory iinventory, EntityItem entityitem) { boolean flag = false; // CraftBukkit start @@ -401,7 +416,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 entityitem.world.getServer().getPluginManager().callEvent(event); if (event.isCancelled()) { return false; -@@ -356,6 +556,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -384,6 +584,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi return !iinventory.b(i, itemstack) ? false : !(iinventory instanceof IWorldInventory) || ((IWorldInventory) iinventory).canPlaceItemThroughFace(i, itemstack, enumdirection); } @@ -409,7 +424,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 private static boolean b(IInventory iinventory, ItemStack itemstack, int i, EnumDirection enumdirection) { return !(iinventory instanceof IWorldInventory) || ((IWorldInventory) iinventory).canTakeItemThroughFace(i, itemstack, enumdirection); } -@@ -368,7 +569,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -396,7 +597,9 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi boolean flag1 = iinventory1.isEmpty(); if (itemstack1.isEmpty()) { @@ -419,7 +434,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 itemstack = ItemStack.b; flag = true; } else if (a(itemstack1, itemstack)) { -@@ -419,18 +622,24 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -447,18 +650,24 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } public static List c(IHopper ihopper) { @@ -449,7 +464,7 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 Object object = null; BlockPosition blockposition = new BlockPosition(d0, d1, d2); if ( !world.isLoaded( blockposition ) ) return null; // Spigot -@@ -450,7 +659,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi +@@ -478,7 +687,7 @@ public class TileEntityHopper extends TileEntityLootable implements IHopper, ITi } } @@ -458,11 +473,11 @@ index 4398f452c52182694c5e2c0945fe70ca32cb0dfd..d432de40eba2767f4ced4d9c642c9d20 List list = world.getEntities((Entity) null, new AxisAlignedBB(d0 - 0.5D, d1 - 0.5D, d2 - 0.5D, d0 + 0.5D, d1 + 0.5D, d2 + 0.5D), IEntitySelector.d); if (!list.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityLootable.java b/src/main/java/net/minecraft/server/TileEntityLootable.java -index d9be182a574daaedcc7a106c759c2bde2e4eb19a..c6df2318762dc6542e73f18ed9a3172ee31d96ee 100644 ---- a/src/main/java/net/minecraft/server/TileEntityLootable.java -+++ b/src/main/java/net/minecraft/server/TileEntityLootable.java -@@ -78,12 +78,19 @@ public abstract class TileEntityLootable extends TileEntityContainer { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java +index 1508e267a38555820e2d31f3075adca185fbd4b6..f0da819627035bed83561128a11059424d2b7e30 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityLootable.java +@@ -97,12 +97,19 @@ public abstract class TileEntityLootable extends TileEntityContainer { @Override public boolean isEmpty() { this.d((EntityHuman) null); @@ -484,18 +499,3 @@ index d9be182a574daaedcc7a106c759c2bde2e4eb19a..c6df2318762dc6542e73f18ed9a3172e return (ItemStack) this.f().get(i); } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index dcca5257a03b6fe32ffcd6528e505762b7b4a3e7..1dca840322990c996ed6eac49792529f60058a6f 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1102,8 +1102,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return list; - } - -- @Override -- public List a(Class oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { -+ public List getEntities(Class oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { return a(oclass, axisalignedbb, predicate); } // Paper - OBFHELPER -+ @Override public List a(Class oclass, AxisAlignedBB axisalignedbb, @Nullable Predicate predicate) { - this.getMethodProfiler().c("getEntities"); - int i = MathHelper.floor((axisalignedbb.minX - 2.0D) / 16.0D); - int j = MathHelper.f((axisalignedbb.maxX + 2.0D) / 16.0D); diff --git a/Spigot-Server-Patches/0391-PlayerDeathEvent-shouldDropExperience.patch b/Spigot-Server-Patches/0391-PlayerDeathEvent-shouldDropExperience.patch index c8df8361b5..c9081f7cbb 100644 --- a/Spigot-Server-Patches/0391-PlayerDeathEvent-shouldDropExperience.patch +++ b/Spigot-Server-Patches/0391-PlayerDeathEvent-shouldDropExperience.patch @@ -4,11 +4,11 @@ Date: Tue, 24 Dec 2019 00:35:42 +0000 Subject: [PATCH] PlayerDeathEvent#shouldDropExperience -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index c71a2264438317d1d36ddf56813ccd1cabd32c79..f87cfd0de55808c6d93e2e80772c122cf7a279b8 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -693,7 +693,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 77f1a2a5b1c172c5bc991d27aaa3e19a53de72c0..a3195ab0c447d5532642b430411434abaa168306 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -820,7 +820,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.eW(); } // SPIGOT-5478 must be called manually now diff --git a/Spigot-Server-Patches/0392-Prevent-bees-loading-chunks-checking-hive-position.patch b/Spigot-Server-Patches/0392-Prevent-bees-loading-chunks-checking-hive-position.patch index f3e453be4f..224000580d 100644 --- a/Spigot-Server-Patches/0392-Prevent-bees-loading-chunks-checking-hive-position.patch +++ b/Spigot-Server-Patches/0392-Prevent-bees-loading-chunks-checking-hive-position.patch @@ -4,11 +4,11 @@ Date: Sun, 5 Jan 2020 17:24:34 -0600 Subject: [PATCH] Prevent bees loading chunks checking hive position -diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index 0cf22e90fe0fdb4079e0ad74e5c3edfa82af4f9e..882c430f645a1addb24f83bc5f592cbe19daade8 100644 ---- a/src/main/java/net/minecraft/server/EntityBee.java -+++ b/src/main/java/net/minecraft/server/EntityBee.java -@@ -368,6 +368,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java +index 1554f1d1d35084c283b573b3e58e48c6747fe7d6..1ecf73f874f404f58a99316ae027f76db6b557db 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java +@@ -442,6 +442,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB if (!this.hasHivePos()) { return false; } else { diff --git a/Spigot-Server-Patches/0393-Don-t-load-Chunks-from-Hoppers-and-other-things.patch b/Spigot-Server-Patches/0393-Don-t-load-Chunks-from-Hoppers-and-other-things.patch index 83a4f9a58f..34cdbbb716 100644 --- a/Spigot-Server-Patches/0393-Don-t-load-Chunks-from-Hoppers-and-other-things.patch +++ b/Spigot-Server-Patches/0393-Don-t-load-Chunks-from-Hoppers-and-other-things.patch @@ -12,11 +12,11 @@ only to be reloaded again the next tick. This of course is undesirable, so just return the loaded side as "primary" and treat it as a single chest if the other sides are unloaded -diff --git a/src/main/java/net/minecraft/server/DoubleBlockFinder.java b/src/main/java/net/minecraft/server/DoubleBlockFinder.java -index ac46a68f7b0f13b9d936ae872306a229ec4f1a61..89b2b11bf00b656bb23be855b25697e6ac93a0a2 100644 ---- a/src/main/java/net/minecraft/server/DoubleBlockFinder.java -+++ b/src/main/java/net/minecraft/server/DoubleBlockFinder.java -@@ -21,7 +21,12 @@ public class DoubleBlockFinder { +diff --git a/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java b/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java +index d51f89fed6129c4b37ef63971f8f61dc14e8032d..efa98e87eead036246348f3915b401f0f52f2242 100644 +--- a/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java ++++ b/src/main/java/net/minecraft/world/level/block/DoubleBlockFinder.java +@@ -29,7 +29,12 @@ public class DoubleBlockFinder { return new DoubleBlockFinder.Result.Single<>(s0); } else { BlockPosition blockposition1 = blockposition.shift((EnumDirection) function1.apply(iblockdata)); diff --git a/Spigot-Server-Patches/0394-Guard-against-serializing-mismatching-chunk-coordina.patch b/Spigot-Server-Patches/0394-Guard-against-serializing-mismatching-chunk-coordina.patch index 539336faab..51438f77a4 100644 --- a/Spigot-Server-Patches/0394-Guard-against-serializing-mismatching-chunk-coordina.patch +++ b/Spigot-Server-Patches/0394-Guard-against-serializing-mismatching-chunk-coordina.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Guard against serializing mismatching chunk coordinate Should help if something dumb happens -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index b09d9436d17159edd6733ab4856be44578353e3e..20388f4305957a83a678119dcda0249105125ab1 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -24,6 +24,13 @@ public class ChunkRegionLoader { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 42dc430d948dbab38ad1a1788aaff840f28bc8e8..358b3c396e8201fa5f82778179e8a300b4aed908 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -66,6 +66,13 @@ public class ChunkRegionLoader { private static final Logger LOGGER = LogManager.getLogger(); @@ -23,7 +23,7 @@ index b09d9436d17159edd6733ab4856be44578353e3e..20388f4305957a83a678119dcda02491 // Paper start public static final class InProgressChunkHolder { -@@ -49,8 +56,8 @@ public class ChunkRegionLoader { +@@ -91,8 +98,8 @@ public class ChunkRegionLoader { // Paper end ChunkGenerator chunkgenerator = worldserver.getChunkProvider().getChunkGenerator(); WorldChunkManager worldchunkmanager = chunkgenerator.getWorldChunkManager(); @@ -34,11 +34,11 @@ index b09d9436d17159edd6733ab4856be44578353e3e..20388f4305957a83a678119dcda02491 if (!Objects.equals(chunkcoordintpair, chunkcoordintpair1)) { ChunkRegionLoader.LOGGER.error("Chunk file at {} is in the wrong location; relocating. (Expected {}, got {})", chunkcoordintpair, chunkcoordintpair, chunkcoordintpair1); -diff --git a/src/main/java/net/minecraft/server/IChunkLoader.java b/src/main/java/net/minecraft/server/IChunkLoader.java -index c0d2df8ef3b4d0224ede2b7a4ef4e3f930590209..582a5695bac7d078e3022b8ee70c512c0680d992 100644 ---- a/src/main/java/net/minecraft/server/IChunkLoader.java -+++ b/src/main/java/net/minecraft/server/IChunkLoader.java -@@ -106,6 +106,13 @@ public class IChunkLoader implements AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +index 65c2bbeb4d77b9accbfa0e26504fdec3f581fa6a..2de8ac694296f78a0e1dea716f52f50b0de6487e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/IChunkLoader.java +@@ -123,6 +123,13 @@ public class IChunkLoader implements AutoCloseable { public void a(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { write(chunkcoordintpair, nbttagcompound); } // Paper OBFHELPER public void write(ChunkCoordIntPair chunkcoordintpair, NBTTagCompound nbttagcompound) throws IOException { // Paper - OBFHELPER - (Switched around for safety) diff --git a/Spigot-Server-Patches/0395-Optimise-IEntityAccess-getPlayerByUUID.patch b/Spigot-Server-Patches/0395-Optimise-IEntityAccess-getPlayerByUUID.patch index fab63ee2e1..325f5cedf4 100644 --- a/Spigot-Server-Patches/0395-Optimise-IEntityAccess-getPlayerByUUID.patch +++ b/Spigot-Server-Patches/0395-Optimise-IEntityAccess-getPlayerByUUID.patch @@ -5,28 +5,11 @@ Subject: [PATCH] Optimise IEntityAccess#getPlayerByUUID Use the world entity map instead of iterating over all players -diff --git a/src/main/java/net/minecraft/server/IEntityAccess.java b/src/main/java/net/minecraft/server/IEntityAccess.java -index 90c94729edf8d18f33d72e872f7969abef0067a0..2639c17b7f6100533f33124f9e49990cd303d161 100644 ---- a/src/main/java/net/minecraft/server/IEntityAccess.java -+++ b/src/main/java/net/minecraft/server/IEntityAccess.java -@@ -268,6 +268,12 @@ public interface IEntityAccess { - - @Nullable - default EntityHuman b(UUID uuid) { -+ // Paper start - allow WorldServer to override -+ return this.getPlayerByUUID(uuid); -+ } -+ @Nullable -+ default EntityHuman getPlayerByUUID(UUID uuid) { -+ // Paper end - for (int i = 0; i < this.getPlayers().size(); ++i) { - EntityHuman entityhuman = (EntityHuman) this.getPlayers().get(i); - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 0d8ef258422c0aaba31afbecf4bee6da7678259a..15d68e08a51ae83ae4a8031f47d512b7c89deae0 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -177,6 +177,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 04cbcb6a872c0b595a691f705131100341e0ec63..7eec1b181ed99e78cfd43a6f48327133fdfbeee7 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -286,6 +286,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end @@ -42,3 +25,20 @@ index 0d8ef258422c0aaba31afbecf4bee6da7678259a..15d68e08a51ae83ae4a8031f47d512b7 // Add env and gen to constructor, WorldData -> WorldDataServer public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +diff --git a/src/main/java/net/minecraft/world/level/IEntityAccess.java b/src/main/java/net/minecraft/world/level/IEntityAccess.java +index 8fdc4b22e8c99d653bd213fe64339c133b46b4e9..1ff9e771788a4ab52129070e355ca48df2949470 100644 +--- a/src/main/java/net/minecraft/world/level/IEntityAccess.java ++++ b/src/main/java/net/minecraft/world/level/IEntityAccess.java +@@ -277,6 +277,12 @@ public interface IEntityAccess { + + @Nullable + default EntityHuman b(UUID uuid) { ++ // Paper start - allow WorldServer to override ++ return this.getPlayerByUUID(uuid); ++ } ++ @Nullable ++ default EntityHuman getPlayerByUUID(UUID uuid) { ++ // Paper end + for (int i = 0; i < this.getPlayers().size(); ++i) { + EntityHuman entityhuman = (EntityHuman) this.getPlayers().get(i); + diff --git a/Spigot-Server-Patches/0396-Fix-items-not-falling-correctly.patch b/Spigot-Server-Patches/0396-Fix-items-not-falling-correctly.patch index 6677195c08..f9047f957b 100644 --- a/Spigot-Server-Patches/0396-Fix-items-not-falling-correctly.patch +++ b/Spigot-Server-Patches/0396-Fix-items-not-falling-correctly.patch @@ -14,11 +14,11 @@ due to its move method never being called. This patch resolves the conflict by offsetting checking an item's move method from Spigot's entity activation range check. -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 4a20ceaf649f91860047017028809cd8040c9e58..0e75d97254c73b2525380024b41a42f56d87b3a5 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -90,7 +90,7 @@ public class EntityItem extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 0b2e6e72a85e05f239d56afb6785c91da5b25d55..11e029f6f97f1dd9c32e311d1a3800f2fa54b91f 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -116,7 +116,7 @@ public class EntityItem extends Entity { } } diff --git a/Spigot-Server-Patches/0397-Lag-compensate-eating.patch b/Spigot-Server-Patches/0397-Lag-compensate-eating.patch index a2828a7ae6..e1bb679444 100644 --- a/Spigot-Server-Patches/0397-Lag-compensate-eating.patch +++ b/Spigot-Server-Patches/0397-Lag-compensate-eating.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Lag compensate eating When the server is lagging, players will wait longer when eating. Change to also use a time check instead if it passes. -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 11a1fad5450ec94aeb4b135d7efc72718297c9cd..cfc4422aaaf79a7b198f7991d422f887574f59e0 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -120,7 +120,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 1102659557ea9f0ab4fe6225cbf1dc1006661caf..e1d8217e48e7c5e7870e46f43074c79efc298ccc 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -213,7 +213,7 @@ public abstract class EntityLiving extends Entity { private int jumpTicks; private float bw; public ItemStack activeItem; // Paper - public @@ -19,7 +19,7 @@ index 11a1fad5450ec94aeb4b135d7efc72718297c9cd..cfc4422aaaf79a7b198f7991d422f887 protected int be; private BlockPosition bx; private Optional by; -@@ -3057,6 +3057,11 @@ public abstract class EntityLiving extends Entity { +@@ -3150,6 +3150,11 @@ public abstract class EntityLiving extends Entity { return ((Byte) this.datawatcher.get(EntityLiving.ag) & 2) > 0 ? EnumHand.OFF_HAND : EnumHand.MAIN_HAND; } @@ -31,7 +31,7 @@ index 11a1fad5450ec94aeb4b135d7efc72718297c9cd..cfc4422aaaf79a7b198f7991d422f887 private void t() { if (this.isHandRaised()) { if (ItemStack.d(this.b(this.getRaisedHand()), this.activeItem)) { -@@ -3066,7 +3071,12 @@ public abstract class EntityLiving extends Entity { +@@ -3159,7 +3164,12 @@ public abstract class EntityLiving extends Entity { this.b(this.activeItem, 5); } @@ -45,7 +45,7 @@ index 11a1fad5450ec94aeb4b135d7efc72718297c9cd..cfc4422aaaf79a7b198f7991d422f887 this.s(); } } else { -@@ -3116,7 +3126,10 @@ public abstract class EntityLiving extends Entity { +@@ -3209,7 +3219,10 @@ public abstract class EntityLiving extends Entity { if (!itemstack.isEmpty() && !this.isHandRaised() || forceUpdate) { // Paper use override flag this.activeItem = itemstack; @@ -57,7 +57,7 @@ index 11a1fad5450ec94aeb4b135d7efc72718297c9cd..cfc4422aaaf79a7b198f7991d422f887 if (!this.world.isClientSide) { this.c(1, true); this.c(2, enumhand == EnumHand.OFF_HAND); -@@ -3140,7 +3153,10 @@ public abstract class EntityLiving extends Entity { +@@ -3233,7 +3246,10 @@ public abstract class EntityLiving extends Entity { } } else if (!this.isHandRaised() && !this.activeItem.isEmpty()) { this.activeItem = ItemStack.b; @@ -69,7 +69,7 @@ index 11a1fad5450ec94aeb4b135d7efc72718297c9cd..cfc4422aaaf79a7b198f7991d422f887 } } -@@ -3268,7 +3284,10 @@ public abstract class EntityLiving extends Entity { +@@ -3361,7 +3377,10 @@ public abstract class EntityLiving extends Entity { } this.activeItem = ItemStack.b; diff --git a/Spigot-Server-Patches/0398-Optimize-call-to-getFluid-for-explosions.patch b/Spigot-Server-Patches/0398-Optimize-call-to-getFluid-for-explosions.patch index 90307d7fa3..aa68e86bd8 100644 --- a/Spigot-Server-Patches/0398-Optimize-call-to-getFluid-for-explosions.patch +++ b/Spigot-Server-Patches/0398-Optimize-call-to-getFluid-for-explosions.patch @@ -4,11 +4,11 @@ Date: Tue, 14 Jan 2020 17:49:03 -0500 Subject: [PATCH] Optimize call to getFluid for explosions -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 471b48a52d564cb4989d211188f5c5b561ac7827..a552cc5bebb1a70db2e679a514769d0ad791ad68 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -125,7 +125,7 @@ public class Explosion { +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index 618cf4e0d71b4b04085807314e79a02785f8a498..a9ecc2b4da587ca3d3c99f8c8af38092a02fb572 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -153,7 +153,7 @@ public class Explosion { for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { BlockPosition blockposition = new BlockPosition(d4, d5, d6); IBlockData iblockdata = this.world.getType(blockposition); diff --git a/Spigot-Server-Patches/0399-Fix-last-firework-in-stack-not-having-effects-when-d.patch b/Spigot-Server-Patches/0399-Fix-last-firework-in-stack-not-having-effects-when-d.patch index 83028d184d..67a2dd383f 100644 --- a/Spigot-Server-Patches/0399-Fix-last-firework-in-stack-not-having-effects-when-d.patch +++ b/Spigot-Server-Patches/0399-Fix-last-firework-in-stack-not-having-effects-when-d.patch @@ -8,11 +8,11 @@ CB used the resulting item in the dispenser rather than the item dispensed. The resulting item would have size == 0 and therefore be convertered to air, hence why the effects disappeared. -diff --git a/src/main/java/net/minecraft/server/IDispenseBehavior.java b/src/main/java/net/minecraft/server/IDispenseBehavior.java -index ce7ab95c95eba7f1c49096a88d9a1b2110ae473b..7b8a470d97ccf0fdcdb8eef9368195486e09913b 100644 ---- a/src/main/java/net/minecraft/server/IDispenseBehavior.java -+++ b/src/main/java/net/minecraft/server/IDispenseBehavior.java -@@ -352,7 +352,7 @@ public interface IDispenseBehavior { +diff --git a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java +index d8a8a57c2228376347d46de8821ae0e8321861e3..879a7e9310855084fe011f30135e6bfa4de98a1e 100644 +--- a/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java ++++ b/src/main/java/net/minecraft/core/dispenser/IDispenseBehavior.java +@@ -425,7 +425,7 @@ public interface IDispenseBehavior { } itemstack1 = CraftItemStack.asNMSCopy(event.getItem()); diff --git a/Spigot-Server-Patches/0400-Add-effect-to-block-break-naturally.patch b/Spigot-Server-Patches/0400-Add-effect-to-block-break-naturally.patch index 31d77bcfce..d3c3b0c4af 100644 --- a/Spigot-Server-Patches/0400-Add-effect-to-block-break-naturally.patch +++ b/Spigot-Server-Patches/0400-Add-effect-to-block-break-naturally.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Add effect to block break naturally diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 41bd71a55626b933c948e5c7e7b8af534eb896c4..f787238575ed7ac9108a2fd9782af55056219767 100644 +index 38122a0ae08667e69cf2eb78d36208bb19441554..ffa94d23675c6c7b6b005860c99c730aacb94924 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -632,6 +632,13 @@ public class CraftBlock implements Block { @@ -20,13 +20,13 @@ index 41bd71a55626b933c948e5c7e7b8af534eb896c4..f787238575ed7ac9108a2fd9782af550 + public boolean breakNaturally(ItemStack item, boolean triggerEffect) { + // Paper end // Order matters here, need to drop before setting to air so skulls can get their data - net.minecraft.server.IBlockData iblockdata = this.getNMS(); - net.minecraft.server.Block block = iblockdata.getBlock(); + net.minecraft.world.level.block.state.IBlockData iblockdata = this.getNMS(); + net.minecraft.world.level.block.Block block = iblockdata.getBlock(); @@ -641,6 +648,7 @@ public class CraftBlock implements Block { // Modelled off EntityHuman#hasBlock if (block != Blocks.AIR && (item == null || !iblockdata.isRequiresSpecialTool() || nmsItem.canDestroySpecialBlock(iblockdata))) { - net.minecraft.server.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); -+ if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.server.Block.getCombinedId(block.getBlockData())); // Paper + net.minecraft.world.level.block.Block.dropItems(iblockdata, world.getMinecraftWorld(), position, world.getTileEntity(position), null, nmsItem); ++ if (triggerEffect) world.triggerEffect(org.bukkit.Effect.STEP_SOUND.getId(), position, net.minecraft.world.level.block.Block.getCombinedId(block.getBlockData())); // Paper result = true; } diff --git a/Spigot-Server-Patches/0401-Tracking-Range-Improvements.patch b/Spigot-Server-Patches/0401-Tracking-Range-Improvements.patch index 351e9b0ea3..0861ffab17 100644 --- a/Spigot-Server-Patches/0401-Tracking-Range-Improvements.patch +++ b/Spigot-Server-Patches/0401-Tracking-Range-Improvements.patch @@ -7,11 +7,11 @@ Sets tracking range of watermobs to animals instead of misc and simplifies code Also ignores Enderdragon, defaulting it to Mojang's setting -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 938439d22f47fb18b36c145c4f4ea355f8405673..08eaaabb712c7a6c9b6631d62874a72e96bf73d5 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1741,6 +1741,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 207c8343815991c687c411cb374081fb485dd0b7..faec8a9a535d6b122c57cda8be3e4f8f3e52852b 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -1785,6 +1785,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); int j = entity.getEntityType().getChunkRange() * 16; @@ -20,19 +20,10 @@ index 938439d22f47fb18b36c145c4f4ea355f8405673..08eaaabb712c7a6c9b6631d62874a72e if (j > i) { i = j; diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java -index 646811932e9703510679080dd93586a3389aace9..03990231a8b6bc6925f054e9033825316abfafcc 100644 +index 0449451142d59e828a32fe237751c7d8484894a2..3277a8aaffb6a25624967aa0c62f61309a517739 100644 --- a/src/main/java/org/spigotmc/TrackingRange.java +++ b/src/main/java/org/spigotmc/TrackingRange.java -@@ -1,6 +1,8 @@ - package org.spigotmc; - - import net.minecraft.server.Entity; -+import net.minecraft.server.EntityEnderDragon; // Paper -+import net.minecraft.server.WorldServer; // Paper - import net.minecraft.server.EntityExperienceOrb; - import net.minecraft.server.EntityGhast; - import net.minecraft.server.EntityItem; -@@ -25,26 +27,26 @@ public class TrackingRange +@@ -25,26 +25,26 @@ public class TrackingRange if ( entity instanceof EntityPlayer ) { return config.playerTrackingRange; @@ -70,7 +61,7 @@ index 646811932e9703510679080dd93586a3389aace9..03990231a8b6bc6925f054e903382531 return config.miscTrackingRange; } else { -+ if (entity instanceof EntityEnderDragon) return ((WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt ++ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return ((net.minecraft.server.level.WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt return config.otherTrackingRange; } } diff --git a/Spigot-Server-Patches/0402-Entity-Activation-Range-2.0.patch b/Spigot-Server-Patches/0402-Entity-Activation-Range-2.0.patch index 49cac7beb8..ebb8a0eb6a 100644 --- a/Spigot-Server-Patches/0402-Entity-Activation-Range-2.0.patch +++ b/Spigot-Server-Patches/0402-Entity-Activation-Range-2.0.patch @@ -13,11 +13,102 @@ Adds water Mobs to activation range config and nerfs fish Adds flying monsters to control ghast and phantoms Adds villagers as separate config -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e9d6d9928 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -163,7 +163,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 7eec1b181ed99e78cfd43a6f48327133fdfbeee7..270d45c017e835cc6f13be01352925b42e08f66e 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -856,17 +856,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { + ++TimingHistory.entityTicks; // Paper - timings + // Spigot start + co.aikar.timings.Timing timer; // Paper +- if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { ++ /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below + entity.ticksLived++; + timer = entity.getEntityType().inactiveTickTimer.startTiming(); try { // Paper - timings + entity.inactiveTick(); + } finally { timer.stopTiming(); } // Paper + return; +- } ++ }*/ // Paper - comment out EAR 2 + // Spigot end + // Paper start- timings +- TimingHistory.activatedEntityTicks++; +- timer = entity.getVehicle() != null ? entity.getEntityType().passengerTickTimer.startTiming() : entity.getEntityType().tickTimer.startTiming(); ++ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); ++ timer = isActive ? entity.getEntityType().tickTimer.startTiming() : entity.getEntityType().inactiveTickTimer.startTiming(); // Paper + try { + // Paper end - timings + entity.g(entity.locX(), entity.locY(), entity.locZ()); +@@ -880,12 +880,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString(); + }); + gameprofilerfiller.c("tickNonPassenger"); ++ if (isActive) { // Paper - EAR 2 ++ TimingHistory.activatedEntityTicks++; // Paper + entity.tick(); + entity.postTick(); // CraftBukkit ++ } else { entity.inactiveTick(); } // Paper - EAR 2 + gameprofilerfiller.exit(); + } + + this.chunkCheck(entity); ++ } finally { timer.stopTiming(); } // Paper - timings + if (entity.inChunk) { + Iterator iterator = entity.getPassengers().iterator(); + +@@ -895,7 +899,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + this.a(entity, entity1); + } + } +- } finally { timer.stopTiming(); } // Paper - timings ++ //} finally { timer.stopTiming(); } // Paper - timings - move up + + } + } +@@ -903,6 +907,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public void a(Entity entity, Entity entity1) { + if (!entity1.dead && entity1.getVehicle() == entity) { + if (entity1 instanceof EntityHuman || this.getChunkProvider().a(entity1)) { ++ // Paper - EAR 2 ++ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity1); ++ co.aikar.timings.Timing timer = isActive ? entity1.getEntityType().passengerTickTimer.startTiming() : entity1.getEntityType().passengerInactiveTickTimer.startTiming(); // Paper ++ try { ++ // Paper end + entity1.g(entity1.locX(), entity1.locY(), entity1.locZ()); + entity1.lastYaw = entity1.yaw; + entity1.lastPitch = entity1.pitch; +@@ -914,8 +923,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { + return IRegistry.ENTITY_TYPE.getKey(entity1.getEntityType()).toString(); + }); + gameprofilerfiller.c("tickPassenger"); ++ // Paper start - EAR 2 ++ if (isActive) { + entity1.passengerTick(); + entity1.postTick(); // CraftBukkit ++ } else { ++ entity1.setMot(Vec3D.ORIGIN); ++ entity1.inactiveTick(); ++ // copied from inside of if (isPassenger()) of passengerTick, but that ifPassenger is unnecessary ++ entity.syncPositionOf(entity1); ++ } ++ // Paper end - EAR 2 + gameprofilerfiller.exit(); + } + +@@ -928,7 +946,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + + this.a(entity1, entity2); + } +- } ++ } } finally { timer.stopTiming(); } // Paper - EAR2 timings + + } + } else { +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index abfda88ab1d0353bbb14ae99dea212941ab2e899..02a39915e8aa1e04066f92f32479e9c161124a64 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -248,7 +248,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public boolean Y; public boolean impulse; public int portalCooldown; @@ -26,7 +117,7 @@ index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e protected int portalTicks; protected BlockPosition ac; private boolean invulnerable; -@@ -187,6 +187,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -272,6 +272,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this); public final boolean defaultActivationState; public long activatedTick = Integer.MIN_VALUE; @@ -34,7 +125,7 @@ index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one protected int numCollisions = 0; // Paper public void inactiveTick() { } -@@ -577,6 +578,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -662,6 +663,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.recalcPosition(); } else { if (enummovetype == EnumMoveType.PISTON) { @@ -42,7 +133,7 @@ index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e vec3d = this.b(vec3d); if (vec3d.equals(Vec3D.ORIGIN)) { return; -@@ -589,6 +591,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -674,6 +676,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne this.x = Vec3D.ORIGIN; this.setMot(Vec3D.ORIGIN); } @@ -56,7 +147,7 @@ index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e vec3d = this.a(vec3d, enummovetype); Vec3D vec3d1 = this.g(vec3d); -@@ -1919,6 +1928,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2004,6 +2013,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } } @@ -64,7 +155,7 @@ index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e public void k(Entity entity) { this.a(entity, Entity::setPosition); } -@@ -2729,6 +2739,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2814,6 +2824,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.ae; } @@ -72,11 +163,11 @@ index 595adbeb253529720e72f695667d5bf9584ebaf0..09e33261f4fe7ed1b68f6954202b359e public boolean bV() { // Paper start return this.pushedByWater(); -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 68f1a101174f4a2f7ab5556a5b733f75f3a7802f..4757e5a92c9cf04fa52d62bac6dae782e08ddab1 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java -@@ -7,6 +7,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java +index a9322e7cd8e07a2d5578c861991d53ec85fbfbcc..bbf0f345bfdd8a3a1f7fe902a42b2b18cdcf07a5 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java +@@ -14,6 +14,7 @@ import org.bukkit.event.entity.EntityUnleashEvent; public abstract class EntityCreature extends EntityInsentient { public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper @@ -84,11 +175,11 @@ index 68f1a101174f4a2f7ab5556a5b733f75f3a7802f..4757e5a92c9cf04fa52d62bac6dae782 protected EntityCreature(EntityTypes entitytypes, World world) { super(entitytypes, world); -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 800a8dd2543f0b83eec67e780510427467649d5d..73ceb0f14610fe1d4d55542dad957b1fdf9f8e04 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -47,7 +47,7 @@ public abstract class EntityInsentient extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index a0857de5a14db5580bc047c401a006c9466c49b2..54d72f211b964a42009eb4d07060a35e3b91017a 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -112,7 +112,7 @@ public abstract class EntityInsentient extends EntityLiving { public MinecraftKey lootTableKey; public long lootTableSeed; @Nullable @@ -97,7 +188,7 @@ index 800a8dd2543f0b83eec67e780510427467649d5d..73ceb0f14610fe1d4d55542dad957b1f private int bx; @Nullable private NBTTagCompound by; -@@ -128,6 +128,19 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -193,6 +193,19 @@ public abstract class EntityInsentient extends EntityLiving { return this.lookController; } @@ -117,11 +208,11 @@ index 800a8dd2543f0b83eec67e780510427467649d5d..73ceb0f14610fe1d4d55542dad957b1f public ControllerMove getControllerMove() { if (this.isPassenger() && this.getVehicle() instanceof EntityInsentient) { EntityInsentient entityinsentient = (EntityInsentient) this.getVehicle(); -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 9bb211e8cf32e8741566a8d7580d559a112c3d76..fe02b3c02bb6ad47646e6abd4b35d0a6d7510952 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -98,7 +98,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index e1d8217e48e7c5e7870e46f43074c79efc298ccc..61dc6cdd4e692319d2a82646b92bf625d1a3f87d 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -191,7 +191,7 @@ public abstract class EntityLiving extends Entity { protected float aN; protected int aO;protected int getKillCount() { return this.aO; } // Paper - OBFHELPER public float lastDamage; @@ -130,11 +221,120 @@ index 9bb211e8cf32e8741566a8d7580d559a112c3d76..fe02b3c02bb6ad47646e6abd4b35d0a6 public float aR; public float aS; public float aT; -diff --git a/src/main/java/net/minecraft/server/EntityLlama.java b/src/main/java/net/minecraft/server/EntityLlama.java -index 65cbe073da6a035f1ac539908a3fa8dbf0f42808..d9e1b43283bee15c659dd3a99e45d9412aedd0bc 100644 ---- a/src/main/java/net/minecraft/server/EntityLlama.java -+++ b/src/main/java/net/minecraft/server/EntityLlama.java -@@ -404,6 +404,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +index 5e599d88a150c907f50acbb58ad1725c3fe361e4..b505c23c57a4b84faf5906c6295455b4720c4426 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +@@ -20,7 +20,10 @@ public abstract class PathfinderGoal { + + public void c() {} + +- public void d() {} ++ public void d() { ++ onTaskReset(); // Paper ++ } ++ public void onTaskReset() {} // Paper + + public void e() {} + +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +index 6a156a488bc073b3b60f4d1081e3f2ab65ba9e96..8a0515ae03c9081b03e9c2a312826345038b8fa7 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalGotoTarget.java +@@ -9,12 +9,12 @@ import net.minecraft.world.level.IWorldReader; + + public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + +- protected final EntityCreature a; ++ protected final EntityCreature a;public EntityCreature getEntity() { return a; } // Paper - OBFHELPER + public final double b; + protected int c; + protected int d; + private int g; +- protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER ++ protected BlockPosition e; public final BlockPosition getTargetPosition() { return this.e; } public void setTargetPosition(BlockPosition pos) { this.e = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER + private boolean h; + private final int i; + private final int j; +@@ -23,6 +23,13 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i) { + this(entitycreature, d0, i, 1); + } ++ // Paper start - activation range improvements ++ @Override ++ public void onTaskReset() { ++ super.onTaskReset(); ++ setTargetPosition(BlockPosition.ZERO); ++ } ++ // Paper end + + public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i, int j) { + this.e = BlockPosition.ZERO; +@@ -111,6 +118,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { + blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, i1, k - 1, j1); + if (this.a.a((BlockPosition) blockposition_mutableblockposition) && this.a(this.a.world, blockposition_mutableblockposition)) { + this.e = blockposition_mutableblockposition; ++ setTargetPosition(blockposition_mutableblockposition.immutableCopy()); // Paper + return true; + } + } +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +index c9aaa63fcb0abe5628798827003c677c883c2a18..8c234c09a4d9ada83e36e3cdbcc1f2f5c6202f28 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +@@ -26,10 +26,11 @@ public class PathfinderGoalSelector { + } + }; + private final Map c = new EnumMap(PathfinderGoal.Type.class); +- private final Set d = Sets.newLinkedHashSet(); ++ private final Set d = Sets.newLinkedHashSet(); private Set getTasks() { return d; }// Paper - OBFHELPER + private final Supplier e; + private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); +- private int g = 3; ++ private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER ++ private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO + + public PathfinderGoalSelector(Supplier supplier) { + this.e = supplier; +@@ -39,6 +40,21 @@ public class PathfinderGoalSelector { + this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); + } + ++ // Paper start ++ public boolean inactiveTick() { ++ incRate(); ++ return getCurRate() % getTickRate() == 0; ++ } ++ public boolean hasTasks() { ++ for (PathfinderGoalWrapped task : getTasks()) { ++ if (task.isRunning()) { ++ return true; ++ } ++ } ++ return false; ++ } ++ // Paper end ++ + public void a(PathfinderGoal pathfindergoal) { + this.d.stream().filter((pathfindergoalwrapped) -> { + return pathfindergoalwrapped.j() == pathfindergoal; +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java +index 7395335ee97237376d34e315ea1d7d46766b278a..7bb531e47668cf445083c4dedb03ccafe6a9c96b 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java +@@ -64,6 +64,7 @@ public class PathfinderGoalWrapped extends PathfinderGoal { + return this.a.i(); + } + ++ public boolean isRunning() { return this.g(); } // Paper - OBFHELPER + public boolean g() { + return this.c; + } +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java +index 8b09aaa30dd753fd34bea155890bdd9e5cb180f5..2005cb484ba6b5929ad81d3d120521f247f3d4cf 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityLlama.java +@@ -454,6 +454,7 @@ public class EntityLlama extends EntityHorseChestedAbstract implements IRangedEn return this.bC != null; } @@ -142,11 +342,11 @@ index 65cbe073da6a035f1ac539908a3fa8dbf0f42808..d9e1b43283bee15c659dd3a99e45d941 public boolean fC() { return this.bB != null; } -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 3a6992a5763238996847a8e59b650606a384e4ff..ee9b1736be7c8fa3324871faa0007fb4781082b8 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -142,17 +142,29 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index d1afbfc4458c76a35b9be124f1e09c3b82501798..02dbb98a1b211d6b3184405ec81f6f58fcef79f3 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -212,17 +212,29 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation @Override public void inactiveTick() { // SPIGOT-3874, SPIGOT-3894, SPIGOT-3846, SPIGOT-5286 :( @@ -180,7 +380,7 @@ index 3a6992a5763238996847a8e59b650606a384e4ff..ee9b1736be7c8fa3324871faa0007fb4 this.world.getMethodProfiler().exit(); if (this.bF) { this.bF = false; -@@ -176,7 +188,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -246,7 +258,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation this.bv = null; } @@ -189,7 +389,7 @@ index 3a6992a5763238996847a8e59b650606a384e4ff..ee9b1736be7c8fa3324871faa0007fb4 Raid raid = ((WorldServer) this.world).b_(this.getChunkCoordinates()); if (raid != null && raid.v() && !raid.a()) { -@@ -187,6 +199,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -257,6 +269,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation if (this.getVillagerData().getProfession() == VillagerProfession.NONE && this.eN()) { this.eT(); } @@ -197,7 +397,7 @@ index 3a6992a5763238996847a8e59b650606a384e4ff..ee9b1736be7c8fa3324871faa0007fb4 super.mobTick(); } -@@ -823,6 +836,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -893,6 +906,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation } } @@ -205,11 +405,11 @@ index 3a6992a5763238996847a8e59b650606a384e4ff..ee9b1736be7c8fa3324871faa0007fb4 private void fw() { long i = this.world.getTime(); -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index d4f43127f02fc67dde4522199ceac45e42b2b25f..f5865052261cb49c3f853e4d65e21831c83c2ea0 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -45,10 +45,12 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +index 190411d6fcee8bed686a2bcfd088aa7c2513fc26..3dd80fcf9237f15bb3bf38d1529340e178f09388 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +@@ -72,10 +72,12 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return super.prepare(worldaccess, difficultydamagescaler, enummobspawn, (GroupDataEntity) groupdataentity, nbttagcompound); } @@ -222,120 +422,11 @@ index d4f43127f02fc67dde4522199ceac45e42b2b25f..f5865052261cb49c3f853e4d65e21831 public void s(int i) { this.datawatcher.set(EntityVillagerAbstract.bp, i); } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index ffc750d0f800d76854388506c5bc4bcdb99fc674..b132cb42da9a733e46fe9059258db7b77f811b3b 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoal.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java -@@ -20,7 +20,10 @@ public abstract class PathfinderGoal { - - public void c() {} - -- public void d() {} -+ public void d() { -+ onTaskReset(); // Paper -+ } -+ public void onTaskReset() {} // Paper - - public void e() {} - -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -index 9b0511e996a5e3952c6f975e7c93299c532a8ea1..8bd75b8243590fcddd0e330a7276c03a71a38b93 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalGotoTarget.java -@@ -4,12 +4,12 @@ import java.util.EnumSet; - - public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - -- protected final EntityCreature a; -+ protected final EntityCreature a;public EntityCreature getEntity() { return a; } // Paper - OBFHELPER - public final double b; - protected int c; - protected int d; - private int g; -- protected BlockPosition e;public final BlockPosition getTargetPosition() { return this.e; } // Paper - OBFHELPER -+ protected BlockPosition e; public final BlockPosition getTargetPosition() { return this.e; } public void setTargetPosition(BlockPosition pos) { this.e = pos; getEntity().movingTarget = pos != BlockPosition.ZERO ? pos : null; } // Paper - OBFHELPER - private boolean h; - private final int i; - private final int j; -@@ -18,6 +18,13 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i) { - this(entitycreature, d0, i, 1); - } -+ // Paper start - activation range improvements -+ @Override -+ public void onTaskReset() { -+ super.onTaskReset(); -+ setTargetPosition(BlockPosition.ZERO); -+ } -+ // Paper end - - public PathfinderGoalGotoTarget(EntityCreature entitycreature, double d0, int i, int j) { - this.e = BlockPosition.ZERO; -@@ -106,6 +113,7 @@ public abstract class PathfinderGoalGotoTarget extends PathfinderGoal { - blockposition_mutableblockposition.a((BaseBlockPosition) blockposition, i1, k - 1, j1); - if (this.a.a((BlockPosition) blockposition_mutableblockposition) && this.a(this.a.world, blockposition_mutableblockposition)) { - this.e = blockposition_mutableblockposition; -+ setTargetPosition(blockposition_mutableblockposition.immutableCopy()); // Paper - return true; - } - } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 482ce2cd8123252110508e8e03aa65afdd533e0a..2926c98d1f94a4879d21ba7b507755b0573fb05a 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -25,10 +25,11 @@ public class PathfinderGoalSelector { - } - }; - private final Map c = new EnumMap(PathfinderGoal.Type.class); -- private final Set d = Sets.newLinkedHashSet(); -+ private final Set d = Sets.newLinkedHashSet(); private Set getTasks() { return d; }// Paper - OBFHELPER - private final Supplier e; - private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); -- private int g = 3; -+ private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER -+ private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO - - public PathfinderGoalSelector(Supplier supplier) { - this.e = supplier; -@@ -38,6 +39,21 @@ public class PathfinderGoalSelector { - this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); - } - -+ // Paper start -+ public boolean inactiveTick() { -+ incRate(); -+ return getCurRate() % getTickRate() == 0; -+ } -+ public boolean hasTasks() { -+ for (PathfinderGoalWrapped task : getTasks()) { -+ if (task.isRunning()) { -+ return true; -+ } -+ } -+ return false; -+ } -+ // Paper end -+ - public void a(PathfinderGoal pathfindergoal) { - this.d.stream().filter((pathfindergoalwrapped) -> { - return pathfindergoalwrapped.j() == pathfindergoal; -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index 182cd7e9110408fff9909ef362d368d055a2b167..f3df10587e652d3a26d15deb09304b97a727cd88 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -@@ -64,6 +64,7 @@ public class PathfinderGoalWrapped extends PathfinderGoal { - return this.a.i(); - } - -+ public boolean isRunning() { return this.g(); } // Paper - OBFHELPER - public boolean g() { - return this.c; - } -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 1dca840322990c996ed6eac49792529f60058a6f..c9c5c0b6f8837001db0b38dabfba7e01bc6de6db 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -82,6 +82,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 03d521444178aa6d3291f4177cdca993c8a251fc..60ad2b638d67ecd023b3a00b3609131b66d150e9 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -134,6 +134,12 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public long ticksPerWaterSpawns; public long ticksPerWaterAmbientSpawns; public long ticksPerAmbientSpawns; @@ -348,153 +439,30 @@ index 1dca840322990c996ed6eac49792529f60058a6f..c9c5c0b6f8837001db0b38dabfba7e01 public boolean populating; public final org.spigotmc.SpigotWorldConfig spigotConfig; // Spigot -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index e6f4b677632f50efa90ebfbb5a04e444f6d9182a..4688b302eaeb42b406a0690f48d97d8cb78e3528 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -747,17 +747,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { - ++TimingHistory.entityTicks; // Paper - timings - // Spigot start - co.aikar.timings.Timing timer; // Paper -- if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { -+ /*if (!org.spigotmc.ActivationRange.checkIfActive(entity)) { // Paper - comment out - EAR 2, reimplement below - entity.ticksLived++; - timer = entity.getEntityType().inactiveTickTimer.startTiming(); try { // Paper - timings - entity.inactiveTick(); - } finally { timer.stopTiming(); } // Paper - return; -- } -+ }*/ // Paper - comment out EAR 2 - // Spigot end - // Paper start- timings -- TimingHistory.activatedEntityTicks++; -- timer = entity.getVehicle() != null ? entity.getEntityType().passengerTickTimer.startTiming() : entity.getEntityType().tickTimer.startTiming(); -+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity); -+ timer = isActive ? entity.getEntityType().tickTimer.startTiming() : entity.getEntityType().inactiveTickTimer.startTiming(); // Paper - try { - // Paper end - timings - entity.g(entity.locX(), entity.locY(), entity.locZ()); -@@ -771,12 +771,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { - return IRegistry.ENTITY_TYPE.getKey(entity.getEntityType()).toString(); - }); - gameprofilerfiller.c("tickNonPassenger"); -+ if (isActive) { // Paper - EAR 2 -+ TimingHistory.activatedEntityTicks++; // Paper - entity.tick(); - entity.postTick(); // CraftBukkit -+ } else { entity.inactiveTick(); } // Paper - EAR 2 - gameprofilerfiller.exit(); - } - - this.chunkCheck(entity); -+ } finally { timer.stopTiming(); } // Paper - timings - if (entity.inChunk) { - Iterator iterator = entity.getPassengers().iterator(); - -@@ -786,7 +790,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - this.a(entity, entity1); - } - } -- } finally { timer.stopTiming(); } // Paper - timings -+ //} finally { timer.stopTiming(); } // Paper - timings - move up - - } - } -@@ -794,6 +798,11 @@ public class WorldServer extends World implements GeneratorAccessSeed { - public void a(Entity entity, Entity entity1) { - if (!entity1.dead && entity1.getVehicle() == entity) { - if (entity1 instanceof EntityHuman || this.getChunkProvider().a(entity1)) { -+ // Paper - EAR 2 -+ final boolean isActive = org.spigotmc.ActivationRange.checkIfActive(entity1); -+ co.aikar.timings.Timing timer = isActive ? entity1.getEntityType().passengerTickTimer.startTiming() : entity1.getEntityType().passengerInactiveTickTimer.startTiming(); // Paper -+ try { -+ // Paper end - entity1.g(entity1.locX(), entity1.locY(), entity1.locZ()); - entity1.lastYaw = entity1.yaw; - entity1.lastPitch = entity1.pitch; -@@ -805,8 +814,17 @@ public class WorldServer extends World implements GeneratorAccessSeed { - return IRegistry.ENTITY_TYPE.getKey(entity1.getEntityType()).toString(); - }); - gameprofilerfiller.c("tickPassenger"); -+ // Paper start - EAR 2 -+ if (isActive) { - entity1.passengerTick(); - entity1.postTick(); // CraftBukkit -+ } else { -+ entity1.setMot(Vec3D.ORIGIN); -+ entity1.inactiveTick(); -+ // copied from inside of if (isPassenger()) of passengerTick, but that ifPassenger is unnecessary -+ entity.syncPositionOf(entity1); -+ } -+ // Paper end - EAR 2 - gameprofilerfiller.exit(); - } - -@@ -819,7 +837,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - - this.a(entity1, entity2); - } -- } -+ } } finally { timer.stopTiming(); } // Paper - EAR2 timings - - } - } else { diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f149cfadd 100644 +index 53d0541aba207b5eaea2e49edbb56df918d30333..663127e6e6ec507959142b18a11a5a4790d4b98b 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -1,24 +1,35 @@ - package org.spigotmc; - - import java.util.Collection; -+import java.util.List; -+ -+import net.minecraft.server.Activity; - import net.minecraft.server.AxisAlignedBB; -+import net.minecraft.server.BehaviorController; -+import net.minecraft.server.BlockPosition; - import net.minecraft.server.Chunk; -+import net.minecraft.server.ChunkProviderServer; // Paper - import net.minecraft.server.Entity; - import net.minecraft.server.EntityAmbient; - import net.minecraft.server.EntityAnimal; - import net.minecraft.server.EntityArrow; -+import net.minecraft.server.EntityBee; - import net.minecraft.server.EntityComplexPart; - import net.minecraft.server.EntityCreature; - import net.minecraft.server.EntityCreeper; - import net.minecraft.server.EntityEnderCrystal; - import net.minecraft.server.EntityEnderDragon; -+import net.minecraft.server.EntityEnderSignal; - import net.minecraft.server.EntityFallingBlock; // Paper - import net.minecraft.server.EntityFireball; - import net.minecraft.server.EntityFireworks; -+import net.minecraft.server.EntityFlying; - import net.minecraft.server.EntityHuman; - import net.minecraft.server.EntityLightning; - import net.minecraft.server.EntityLiving; - import net.minecraft.server.EntityMonster; -+import net.minecraft.server.EntityPillager; -+import net.minecraft.server.EntityPlayer; - import net.minecraft.server.EntityProjectile; - import net.minecraft.server.EntityRaider; - import net.minecraft.server.EntitySheep; -@@ -27,16 +38,26 @@ import net.minecraft.server.EntityTNTPrimed; - import net.minecraft.server.EntityThrownTrident; - import net.minecraft.server.EntityVillager; - import net.minecraft.server.EntityWither; -+import net.minecraft.server.IMonster; - import net.minecraft.server.MathHelper; -+import net.minecraft.server.MemoryModuleType; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.World; +@@ -31,11 +31,30 @@ import net.minecraft.world.level.chunk.Chunk; + import net.minecraft.world.phys.AxisAlignedBB; import co.aikar.timings.MinecraftTimings; -+// Paper start -+import net.minecraft.server.EntityInsentient; -+import net.minecraft.server.EntityLlama; -+import net.minecraft.server.EntityWaterAnimal; -+// Paper end ++// Paper start ++import net.minecraft.core.BlockPosition; ++import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.world.entity.EntityFlying; ++import net.minecraft.world.entity.EntityInsentient; ++import net.minecraft.world.entity.ai.BehaviorController; ++import net.minecraft.world.entity.animal.EntityBee; ++import net.minecraft.world.entity.animal.EntityWaterAnimal; ++import net.minecraft.world.entity.animal.horse.EntityLlama; ++import net.minecraft.world.entity.monster.EntityPillager; ++import net.minecraft.world.entity.monster.IMonster; ++import net.minecraft.world.entity.schedule.Activity; ++import net.minecraft.world.entity.item.EntityFallingBlock; ++import net.minecraft.world.entity.projectile.EntityEnderSignal; ++// Paper end ++ public class ActivationRange { @@ -506,7 +474,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f MONSTER, ANIMAL, RAIDER, -@@ -44,6 +65,43 @@ public class ActivationRange +@@ -43,6 +62,43 @@ public class ActivationRange AxisAlignedBB boundingBox = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); } @@ -550,7 +518,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f static AxisAlignedBB maxBB = new AxisAlignedBB( 0, 0, 0, 0, 0, 0 ); -@@ -56,10 +114,13 @@ public class ActivationRange +@@ -55,10 +111,13 @@ public class ActivationRange */ public static ActivationType initializeEntityActivationType(Entity entity) { @@ -565,7 +533,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f { return ActivationType.MONSTER; } else if ( entity instanceof EntityCreature || entity instanceof EntityAmbient ) -@@ -80,10 +141,14 @@ public class ActivationRange +@@ -79,10 +138,14 @@ public class ActivationRange */ public static boolean initializeEntityActivationState(Entity entity, SpigotWorldConfig config) { @@ -584,7 +552,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f || entity instanceof EntityHuman || entity instanceof EntityProjectile || entity instanceof EntityEnderDragon -@@ -116,10 +181,25 @@ public class ActivationRange +@@ -115,10 +178,25 @@ public class ActivationRange final int raiderActivationRange = world.spigotConfig.raiderActivationRange; final int animalActivationRange = world.spigotConfig.animalActivationRange; final int monsterActivationRange = world.spigotConfig.monsterActivationRange; @@ -610,7 +578,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f maxRange = Math.min( ( world.spigotConfig.viewDistance << 4 ) - 8, maxRange ); for ( EntityHuman player : world.getPlayers() ) -@@ -131,6 +211,11 @@ public class ActivationRange +@@ -130,6 +208,11 @@ public class ActivationRange ActivationType.RAIDER.boundingBox = player.getBoundingBox().grow( raiderActivationRange, 256, raiderActivationRange ); ActivationType.ANIMAL.boundingBox = player.getBoundingBox().grow( animalActivationRange, 256, animalActivationRange ); ActivationType.MONSTER.boundingBox = player.getBoundingBox().grow( monsterActivationRange, 256, monsterActivationRange ); @@ -622,7 +590,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f int i = MathHelper.floor( maxBB.minX / 16.0D ); int j = MathHelper.floor( maxBB.maxX / 16.0D ); -@@ -141,7 +226,7 @@ public class ActivationRange +@@ -140,7 +223,7 @@ public class ActivationRange { for ( int j1 = k; j1 <= l; ++j1 ) { @@ -631,7 +599,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f if ( chunk != null ) { activateChunkEntities( chunk ); -@@ -159,19 +244,15 @@ public class ActivationRange +@@ -158,19 +241,15 @@ public class ActivationRange */ private static void activateChunkEntities(Chunk chunk) { @@ -659,7 +627,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f entity.activatedTick = MinecraftServer.currentTick; } } -@@ -186,56 +267,105 @@ public class ActivationRange +@@ -185,56 +264,105 @@ public class ActivationRange * @param entity * @return */ @@ -742,7 +710,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f + } + } + } -+ if ( entity instanceof EntityLlama && ( (EntityLlama ) entity ).inCaravan() ) ++ if ( entity instanceof EntityLlama && ( (EntityLlama) entity ).inCaravan() ) { - return true; + return 1; @@ -781,7 +749,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f } /** -@@ -250,8 +380,19 @@ public class ActivationRange +@@ -249,8 +377,19 @@ public class ActivationRange if ( !entity.inChunk || entity instanceof EntityFireworks ) { return true; } @@ -802,7 +770,7 @@ index 797e579afdbc77a8dc5fc4cdf5874e546922fbfa..a87cec0b391dfe54f70be9e27723f04f // Should this entity tick? if ( !isActive ) -@@ -259,15 +400,19 @@ public class ActivationRange +@@ -258,15 +397,19 @@ public class ActivationRange if ( ( MinecraftServer.currentTick - entity.activatedTick - 1 ) % 20 == 0 ) { // Check immunities every 20 ticks. diff --git a/Spigot-Server-Patches/0403-Fix-items-vanishing-through-end-portal.patch b/Spigot-Server-Patches/0403-Fix-items-vanishing-through-end-portal.patch index 8737179ac1..a2008e8e44 100644 --- a/Spigot-Server-Patches/0403-Fix-items-vanishing-through-end-portal.patch +++ b/Spigot-Server-Patches/0403-Fix-items-vanishing-through-end-portal.patch @@ -12,11 +12,11 @@ only searching the heightmap if the chunk is loaded. Quickly loading the exact world spawn chunk before searching the heightmap resolves the issue without having to load all spawn chunks. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 2b06163358827e0773969226d8f77e6e0ba0ca3d..2a12dd777d881a9231f8e241aee65db60792a110 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2641,6 +2641,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 02a39915e8aa1e04066f92f32479e9c161124a64..82e025776b0b6a01c35940df63f334b1d1fbdeb1 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2726,6 +2726,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne BlockPosition blockposition1; if (flag1) { diff --git a/Spigot-Server-Patches/0404-Bees-get-gravity-in-void.-Fixes-MC-167279.patch b/Spigot-Server-Patches/0404-Bees-get-gravity-in-void.-Fixes-MC-167279.patch index a2cd4166fb..7fbf667ed7 100644 --- a/Spigot-Server-Patches/0404-Bees-get-gravity-in-void.-Fixes-MC-167279.patch +++ b/Spigot-Server-Patches/0404-Bees-get-gravity-in-void.-Fixes-MC-167279.patch @@ -4,11 +4,11 @@ Date: Sun, 26 Jan 2020 16:30:19 -0600 Subject: [PATCH] Bees get gravity in void. Fixes MC-167279 -diff --git a/src/main/java/net/minecraft/server/ControllerMove.java b/src/main/java/net/minecraft/server/ControllerMove.java -index 558523817e98711cca6d1671af98df6f8c5f0b07..8f9fb058c11ba5c2e887df048025284cd834ffe9 100644 ---- a/src/main/java/net/minecraft/server/ControllerMove.java -+++ b/src/main/java/net/minecraft/server/ControllerMove.java -@@ -2,7 +2,7 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java +index 4044861622294a317fef7e93aa86e96e8474b513..2aa5789437ba7eb20579da238c407a65a25b1d44 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java ++++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMove.java +@@ -16,7 +16,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; public class ControllerMove { @@ -17,11 +17,11 @@ index 558523817e98711cca6d1671af98df6f8c5f0b07..8f9fb058c11ba5c2e887df048025284c protected double b; protected double c; protected double d; -diff --git a/src/main/java/net/minecraft/server/ControllerMoveFlying.java b/src/main/java/net/minecraft/server/ControllerMoveFlying.java -index 2778cb9069ef3ba4049a9a3dc7c788cd50f98c28..2b1db4bf21f7341dbdf27673e123936d9eaa7f95 100644 ---- a/src/main/java/net/minecraft/server/ControllerMoveFlying.java -+++ b/src/main/java/net/minecraft/server/ControllerMoveFlying.java -@@ -12,7 +12,7 @@ public class ControllerMoveFlying extends ControllerMove { +diff --git a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java +index 80cba36bc59e89c40c96ca556594a4285f06fc6f..d0cbc429144b89498a7f4dc6ff64924c5ba54ad8 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java ++++ b/src/main/java/net/minecraft/world/entity/ai/control/ControllerMoveFlying.java +@@ -16,7 +16,7 @@ public class ControllerMoveFlying extends ControllerMove { } @Override @@ -30,11 +30,11 @@ index 2778cb9069ef3ba4049a9a3dc7c788cd50f98c28..2b1db4bf21f7341dbdf27673e123936d if (this.h == ControllerMove.Operation.MOVE_TO) { this.h = ControllerMove.Operation.WAIT; this.a.setNoGravity(true); -diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index 882c430f645a1addb24f83bc5f592cbe19daade8..c14e07f3c3017e5a5355b1770b94ee4dcc8cc017 100644 ---- a/src/main/java/net/minecraft/server/EntityBee.java -+++ b/src/main/java/net/minecraft/server/EntityBee.java -@@ -37,7 +37,17 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java +index 1ecf73f874f404f58a99316ae027f76db6b557db..7ce8eaeb9af3547869f467910b6a458118c63c1f 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java +@@ -111,7 +111,17 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB public EntityBee(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/Spigot-Server-Patches/0405-Optimise-getChunkAt-calls-for-loaded-chunks.patch b/Spigot-Server-Patches/0405-Optimise-getChunkAt-calls-for-loaded-chunks.patch index 9c88237f66..f001e5d5a3 100644 --- a/Spigot-Server-Patches/0405-Optimise-getChunkAt-calls-for-loaded-chunks.patch +++ b/Spigot-Server-Patches/0405-Optimise-getChunkAt-calls-for-loaded-chunks.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Optimise getChunkAt calls for loaded chunks bypass the need to get a player chunk, then get the either, then unwrap it... -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1eb201695cd118616fb404a0c7ed8cedee77db89..e0296920a794157d89bb314b162de706d69a5459 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -447,6 +447,12 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index a20c1df6d0cc7b869bcd4094c1627a16c33604d7..d6f897bf045ad00792e57adfe233548e9bd54877 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -469,6 +469,12 @@ public class ChunkProviderServer extends IChunkProvider { return this.getChunkAt(i, j, chunkstatus, flag); }, this.serverThreadQueue).join(); } else { @@ -23,7 +23,7 @@ index 1eb201695cd118616fb404a0c7ed8cedee77db89..e0296920a794157d89bb314b162de706 GameProfilerFiller gameprofilerfiller = this.world.getMethodProfiler(); gameprofilerfiller.c("getChunk"); -@@ -497,39 +503,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -519,39 +525,7 @@ public class ChunkProviderServer extends IChunkProvider { if (Thread.currentThread() != this.serverThread) { return null; } else { diff --git a/Spigot-Server-Patches/0407-Add-ThrownEggHatchEvent.patch b/Spigot-Server-Patches/0407-Add-ThrownEggHatchEvent.patch index 5edd2e992d..60a1317040 100644 --- a/Spigot-Server-Patches/0407-Add-ThrownEggHatchEvent.patch +++ b/Spigot-Server-Patches/0407-Add-ThrownEggHatchEvent.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Add ThrownEggHatchEvent Adds a new event similar to PlayerEggThrowEvent, but without the Player requirement (dispensers can throw eggs to hatch them, too). -diff --git a/src/main/java/net/minecraft/server/EntityEgg.java b/src/main/java/net/minecraft/server/EntityEgg.java -index 0d5e91a4204c394efcc510d34011f32f2e313ab1..edce89169b3ca2894852087b83a6bf035ba43c3f 100644 ---- a/src/main/java/net/minecraft/server/EntityEgg.java -+++ b/src/main/java/net/minecraft/server/EntityEgg.java -@@ -55,6 +55,16 @@ public class EntityEgg extends EntityProjectileThrowable { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java b/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java +index 01cee6599f5d21a29310c30a8b1e505023d1a260..dc2e51718395494f60b0376d65d496daf2f76e71 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityEgg.java +@@ -67,6 +67,16 @@ public class EntityEgg extends EntityProjectileThrowable { hatchingType = event.getHatchingType(); } diff --git a/Spigot-Server-Patches/0408-Optimise-random-block-ticking.patch b/Spigot-Server-Patches/0408-Optimise-random-block-ticking.patch index b70a2b64e6..59ab9d936b 100644 --- a/Spigot-Server-Patches/0408-Optimise-random-block-ticking.patch +++ b/Spigot-Server-Patches/0408-Optimise-random-block-ticking.patch @@ -70,11 +70,11 @@ index 0000000000000000000000000000000000000000..3edc8e52e06a62ce9f8cc734fd7458b3 + return fastRandomBounded(this.next(32) & 0xFFFFFFFFL, bound); + } +} -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index f068436960c96b0df427bcdf337a4dcc6a9f66f5..253423acc3c3697a5e47136f34da92617e719753 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -462,6 +462,7 @@ public class BlockPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index 4c9ec211470f95d538d1d95c74796190edf99b87..8c0aeb51f5e230fd6109e750732eb54559bc9637 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -468,6 +468,7 @@ public class BlockPosition extends BaseBlockPosition { return this.d(MathHelper.floor(d0), MathHelper.floor(d1), MathHelper.floor(d2)); } @@ -82,195 +82,11 @@ index f068436960c96b0df427bcdf337a4dcc6a9f66f5..253423acc3c3697a5e47136f34da9261 public BlockPosition.MutableBlockPosition g(BaseBlockPosition baseblockposition) { return this.d(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0601e9cdeb33dec82642ee9fbfaac1712bd0fae9..49bcd959206eeb21ff743f827a076b0c4cd3c722 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -599,8 +599,8 @@ public class Chunk implements IChunkAccess { - this.entities.remove(entity); // Paper - } - -- @Override -- public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { -+ public final int getHighestBlockY(HeightMap.Type heightmap_type, int i, int j) { return this.getHighestBlock(heightmap_type, i, j) + 1; } // Paper - sort of an obfhelper, but without -1 -+ @Override public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { // Paper - return ((HeightMap) this.heightMap.get(heightmap_type)).a(i & 15, j & 15) - 1; - } - -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 90bb2f7ad9f82818d58de9be918f1299c6725070..668942c629732b8d46b7f2646df8e7827baae240 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -7,12 +7,14 @@ import javax.annotation.Nullable; - public class ChunkSection { - - public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); -- private final int yPos; -+ final int yPos; // Paper - private -> package-private - short nonEmptyBlockCount; // Paper - package-private -- private short tickingBlockCount; -+ short tickingBlockCount; // Paper - private -> package-private - private short e; - final DataPaletteBlock blockIds; // Paper - package-private - -+ final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper -+ - // Paper start - Anti-Xray - Add parameters - @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere - public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { -@@ -67,6 +69,9 @@ public class ChunkSection { - --this.nonEmptyBlockCount; - if (iblockdata1.isTicking()) { - --this.tickingBlockCount; -+ // Paper start -+ this.tickingList.remove(i, j, k); -+ // Paper end - } - } - -@@ -78,6 +83,9 @@ public class ChunkSection { - ++this.nonEmptyBlockCount; - if (iblockdata.isTicking()) { - ++this.tickingBlockCount; -+ // Paper start -+ this.tickingList.add(i, j, k, iblockdata); -+ // Paper end - } - } - -@@ -113,23 +121,29 @@ public class ChunkSection { - } - - public void recalcBlockCounts() { -+ // Paper start -+ this.tickingList.clear(); -+ // Paper end - this.nonEmptyBlockCount = 0; - this.tickingBlockCount = 0; - this.e = 0; -- this.blockIds.a((iblockdata, i) -> { -+ this.blockIds.forEachLocation((iblockdata, location) -> { // Paper - Fluid fluid = iblockdata.getFluid(); - - if (!iblockdata.isAir()) { -- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); - if (iblockdata.isTicking()) { -- this.tickingBlockCount = (short) (this.tickingBlockCount + i); -+ this.tickingBlockCount = (short) (this.tickingBlockCount + 1); -+ // Paper start -+ this.tickingList.add(location, iblockdata); -+ // Paper end - } - } - - if (!fluid.isEmpty()) { -- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); -+ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); - if (fluid.f()) { -- this.e = (short) (this.e + i); -+ this.e = (short) (this.e + 1); - } - } - -diff --git a/src/main/java/net/minecraft/server/DataBits.java b/src/main/java/net/minecraft/server/DataBits.java -index 2a01a48ad347fb123492218a60404b034cfcfbc5..f0c9009fb808ca664a7c3ebaeb8cfa8e2ba7b97e 100644 ---- a/src/main/java/net/minecraft/server/DataBits.java -+++ b/src/main/java/net/minecraft/server/DataBits.java -@@ -111,4 +111,32 @@ public class DataBits { - } - - } -+ -+ // Paper start -+ public final void forEach(DataBitConsumer consumer) { -+ int i = 0; -+ long[] along = this.b; -+ int j = along.length; -+ -+ for (int k = 0; k < j; ++k) { -+ long l = along[k]; -+ -+ for (int i1 = 0; i1 < this.f; ++i1) { -+ consumer.accept(i, (int) (l & this.d)); -+ l >>= this.c; -+ ++i; -+ if (i >= this.e) { -+ return; -+ } -+ } -+ } -+ } -+ -+ @FunctionalInterface -+ static interface DataBitConsumer { -+ -+ void accept(int location, int data); -+ -+ } -+ // Paper end - } -diff --git a/src/main/java/net/minecraft/server/DataPaletteBlock.java b/src/main/java/net/minecraft/server/DataPaletteBlock.java -index ed77117630d54b7ad81f633110c7d2a7c59288e9..95ef96286855624590b72d69514b0fc0e08fddba 100644 ---- a/src/main/java/net/minecraft/server/DataPaletteBlock.java -+++ b/src/main/java/net/minecraft/server/DataPaletteBlock.java -@@ -277,6 +277,14 @@ public class DataPaletteBlock implements DataPaletteExpandable { - }); - } - -+ // Paper start -+ public void forEachLocation(DataPaletteBlock.a datapaletteblock_a) { -+ this.getDataBits().forEach((int location, int data) -> { -+ datapaletteblock_a.accept(this.getDataPalette().getObject(data), location); -+ }); -+ } -+ // Paper end -+ - @FunctionalInterface - public interface a { - -diff --git a/src/main/java/net/minecraft/server/EntityTurtle.java b/src/main/java/net/minecraft/server/EntityTurtle.java -index fa8eab20bb839c53bf7989d02d2274f835002609..4ad393bc99881d813e2b349fb929fc8e69631723 100644 ---- a/src/main/java/net/minecraft/server/EntityTurtle.java -+++ b/src/main/java/net/minecraft/server/EntityTurtle.java -@@ -28,7 +28,7 @@ public class EntityTurtle extends EntityAnimal { - } - - public void setHomePos(BlockPosition blockposition) { -- this.datawatcher.set(EntityTurtle.bp, blockposition); -+ this.datawatcher.set(EntityTurtle.bp, blockposition.immutableCopy()); // Paper - called with mutablepos... - } - - public BlockPosition getHomePos() { // Paper - public -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index c9c5c0b6f8837001db0b38dabfba7e01bc6de6db..4da88ce31cfb8baa6fa68c0115edadac0c5b2fba 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1412,10 +1412,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public abstract ITagRegistry p(); - - public BlockPosition a(int i, int j, int k, int l) { -+ // Paper start - allow use of mutable pos -+ BlockPosition.MutableBlockPosition ret = new BlockPosition.MutableBlockPosition(); -+ this.getRandomBlockPosition(i, j, k, l, ret); -+ return ret.immutableCopy(); -+ } -+ public final BlockPosition.MutableBlockPosition getRandomBlockPosition(int i, int j, int k, int l, BlockPosition.MutableBlockPosition out) { -+ // Paper end - this.n = this.n * 3 + 1013904223; - int i1 = this.n >> 2; - -- return new BlockPosition(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); -+ out.setValues(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); // Paper - change to setValues call -+ return out; // Paper - } - - public boolean isSavingDisabled() { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 4688b302eaeb42b406a0690f48d97d8cb78e3528..640ae46d754f4af09ef3a404860b6b3db7d63a1a 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -561,7 +561,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 270d45c017e835cc6f13be01352925b42e08f66e..2b58f4b80f10b93868a686bc9d2630a02832d1dd 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -670,7 +670,12 @@ public class WorldServer extends World implements GeneratorAccessSeed { }); } @@ -284,7 +100,7 @@ index 4688b302eaeb42b406a0690f48d97d8cb78e3528..640ae46d754f4af09ef3a404860b6b3d ChunkCoordIntPair chunkcoordintpair = chunk.getPos(); boolean flag = this.isRaining(); int j = chunkcoordintpair.d(); -@@ -569,10 +574,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -678,10 +683,10 @@ public class WorldServer extends World implements GeneratorAccessSeed { GameProfilerFiller gameprofilerfiller = this.getMethodProfiler(); gameprofilerfiller.enter("thunder"); @@ -297,7 +113,7 @@ index 4688b302eaeb42b406a0690f48d97d8cb78e3528..640ae46d754f4af09ef3a404860b6b3d if (this.isRainingAt(blockposition)) { DifficultyDamageScaler difficultydamagescaler = this.getDamageScaler(blockposition); boolean flag1 = this.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && this.random.nextDouble() < (double) difficultydamagescaler.b() * paperConfig.skeleHorseSpawnChance; // Paper -@@ -595,59 +600,77 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -704,59 +709,77 @@ public class WorldServer extends World implements GeneratorAccessSeed { } gameprofilerfiller.exitEnter("iceandsnow"); @@ -405,3 +221,187 @@ index 4688b302eaeb42b406a0690f48d97d8cb78e3528..640ae46d754f4af09ef3a404860b6b3d } protected BlockPosition a(BlockPosition blockposition) { +diff --git a/src/main/java/net/minecraft/util/DataBits.java b/src/main/java/net/minecraft/util/DataBits.java +index c4f3b680512fb15cea01ad12d0a00c6e60bf34b7..679abdd669206e1984ef8e1b43312d2fe3121931 100644 +--- a/src/main/java/net/minecraft/util/DataBits.java ++++ b/src/main/java/net/minecraft/util/DataBits.java +@@ -112,4 +112,32 @@ public class DataBits { + } + + } ++ ++ // Paper start ++ public final void forEach(DataBitConsumer consumer) { ++ int i = 0; ++ long[] along = this.b; ++ int j = along.length; ++ ++ for (int k = 0; k < j; ++k) { ++ long l = along[k]; ++ ++ for (int i1 = 0; i1 < this.f; ++i1) { ++ consumer.accept(i, (int) (l & this.d)); ++ l >>= this.c; ++ ++i; ++ if (i >= this.e) { ++ return; ++ } ++ } ++ } ++ } ++ ++ @FunctionalInterface ++ static interface DataBitConsumer { ++ ++ void accept(int location, int data); ++ ++ } ++ // Paper end + } +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +index 38588e59f26dd1f3a43fc229195e4fb8484e3705..6fa8176530af23903f8e6ad33ab63f1bc9e2e302 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityTurtle.java +@@ -90,7 +90,7 @@ public class EntityTurtle extends EntityAnimal { + } + + public void setHomePos(BlockPosition blockposition) { +- this.datawatcher.set(EntityTurtle.bp, blockposition); ++ this.datawatcher.set(EntityTurtle.bp, blockposition.immutableCopy()); // Paper - called with mutablepos... + } + + public BlockPosition getHomePos() { // Paper - public +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 60ad2b638d67ecd023b3a00b3609131b66d150e9..0fd8550ebcb2c1b8ef5132155528ac32c75741bb 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -1464,10 +1464,18 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public abstract ITagRegistry p(); + + public BlockPosition a(int i, int j, int k, int l) { ++ // Paper start - allow use of mutable pos ++ BlockPosition.MutableBlockPosition ret = new BlockPosition.MutableBlockPosition(); ++ this.getRandomBlockPosition(i, j, k, l, ret); ++ return ret.immutableCopy(); ++ } ++ public final BlockPosition.MutableBlockPosition getRandomBlockPosition(int i, int j, int k, int l, BlockPosition.MutableBlockPosition out) { ++ // Paper end + this.n = this.n * 3 + 1013904223; + int i1 = this.n >> 2; + +- return new BlockPosition(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); ++ out.setValues(i + (i1 & 15), j + (i1 >> 16 & l), k + (i1 >> 8 & 15)); // Paper - change to setValues call ++ return out; // Paper + } + + public boolean isSavingDisabled() { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 46467230aac994e2b3864b7a1eddc701c4ade91c..09d157bd2795b7e4374778cbd1e554de70f397bd 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -633,8 +633,8 @@ public class Chunk implements IChunkAccess { + this.entities.remove(entity); // Paper + } + +- @Override +- public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { ++ public final int getHighestBlockY(HeightMap.Type heightmap_type, int i, int j) { return this.getHighestBlock(heightmap_type, i, j) + 1; } // Paper - sort of an obfhelper, but without -1 ++ @Override public int getHighestBlock(HeightMap.Type heightmap_type, int i, int j) { // Paper + return ((HeightMap) this.heightMap.get(heightmap_type)).a(i & 15, j & 15) - 1; + } + +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index 00658974083a97d74e3336d9c719892f25aa22a9..c89905b7fc30988dc3624270eac96bc1f06cd0cb 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -13,12 +13,14 @@ import net.minecraft.world.level.material.Fluid; + public class ChunkSection { + + public static final DataPalette GLOBAL_PALETTE = new DataPaletteGlobal<>(Block.REGISTRY_ID, Blocks.AIR.getBlockData()); +- private final int yPos; ++ final int yPos; // Paper - private -> package-private + short nonEmptyBlockCount; // Paper - package-private +- private short tickingBlockCount; ++ short tickingBlockCount; // Paper - private -> package-private + private short e; + final DataPaletteBlock blockIds; // Paper - package-private + ++ final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper ++ + // Paper start - Anti-Xray - Add parameters + @Deprecated public ChunkSection(int i) { this(i, null, null, true); } // Notice for updates: Please make sure this constructor isn't used anywhere + public ChunkSection(int i, IChunkAccess chunk, World world, boolean initializeBlocks) { +@@ -73,6 +75,9 @@ public class ChunkSection { + --this.nonEmptyBlockCount; + if (iblockdata1.isTicking()) { + --this.tickingBlockCount; ++ // Paper start ++ this.tickingList.remove(i, j, k); ++ // Paper end + } + } + +@@ -84,6 +89,9 @@ public class ChunkSection { + ++this.nonEmptyBlockCount; + if (iblockdata.isTicking()) { + ++this.tickingBlockCount; ++ // Paper start ++ this.tickingList.add(i, j, k, iblockdata); ++ // Paper end + } + } + +@@ -119,23 +127,29 @@ public class ChunkSection { + } + + public void recalcBlockCounts() { ++ // Paper start ++ this.tickingList.clear(); ++ // Paper end + this.nonEmptyBlockCount = 0; + this.tickingBlockCount = 0; + this.e = 0; +- this.blockIds.a((iblockdata, i) -> { ++ this.blockIds.forEachLocation((iblockdata, location) -> { // Paper + Fluid fluid = iblockdata.getFluid(); + + if (!iblockdata.isAir()) { +- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); + if (iblockdata.isTicking()) { +- this.tickingBlockCount = (short) (this.tickingBlockCount + i); ++ this.tickingBlockCount = (short) (this.tickingBlockCount + 1); ++ // Paper start ++ this.tickingList.add(location, iblockdata); ++ // Paper end + } + } + + if (!fluid.isEmpty()) { +- this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + i); ++ this.nonEmptyBlockCount = (short) (this.nonEmptyBlockCount + 1); + if (fluid.f()) { +- this.e = (short) (this.e + i); ++ this.e = (short) (this.e + 1); + } + } + +diff --git a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +index 68d53a51acc9790b9cda20ec4d2ec6edd1baac1a..86dfab740883c138a0df8a3da9dfb4eb9acefaa3 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java ++++ b/src/main/java/net/minecraft/world/level/chunk/DataPaletteBlock.java +@@ -286,6 +286,14 @@ public class DataPaletteBlock implements DataPaletteExpandable { + }); + } + ++ // Paper start ++ public void forEachLocation(DataPaletteBlock.a datapaletteblock_a) { ++ this.getDataBits().forEach((int location, int data) -> { ++ datapaletteblock_a.accept(this.getDataPalette().getObject(data), location); ++ }); ++ } ++ // Paper end ++ + @FunctionalInterface + public interface a { + diff --git a/Spigot-Server-Patches/0409-Entity-Jump-API.patch b/Spigot-Server-Patches/0409-Entity-Jump-API.patch index 03714a26da..b6fe855fbd 100644 --- a/Spigot-Server-Patches/0409-Entity-Jump-API.patch +++ b/Spigot-Server-Patches/0409-Entity-Jump-API.patch @@ -4,11 +4,11 @@ Date: Sat, 8 Feb 2020 23:26:11 -0600 Subject: [PATCH] Entity Jump API -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 5d8c2f2b002945f5d6c26d61d2c3cffe4c84ec81..ae3787bbdeacbac83b238eac098fcfe1e3b6e448 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2782,8 +2782,10 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 61dc6cdd4e692319d2a82646b92bf625d1a3f87d..21952ce66729946fb306fd15e9da4a3311551bec 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -2875,8 +2875,10 @@ public abstract class EntityLiving extends Entity { } else if (this.aQ() && (!this.onGround || d7 > d8)) { this.c((Tag) TagsFluid.LAVA); } else if ((this.onGround || flag && d7 <= d8) && this.jumpTicks == 0) { @@ -19,11 +19,11 @@ index 5d8c2f2b002945f5d6c26d61d2c3cffe4c84ec81..ae3787bbdeacbac83b238eac098fcfe1 } } else { this.jumpTicks = 0; -diff --git a/src/main/java/net/minecraft/server/EntityPanda.java b/src/main/java/net/minecraft/server/EntityPanda.java -index 7de157388922c4d3ff52866d5c0ac20189a9ccf8..b36cc95168c6e6fbf668ebe15c1fa10b54e570d3 100644 ---- a/src/main/java/net/minecraft/server/EntityPanda.java -+++ b/src/main/java/net/minecraft/server/EntityPanda.java -@@ -435,7 +435,9 @@ public class EntityPanda extends EntityAnimal { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java b/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java +index f755607872920caae1410d38c431c16b5238c00f..711b322007a0973ff0aebf3c25efbae8fc7741d0 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityPanda.java +@@ -490,7 +490,9 @@ public class EntityPanda extends EntityAnimal { EntityPanda entitypanda = (EntityPanda) iterator.next(); if (!entitypanda.isBaby() && entitypanda.onGround && !entitypanda.isInWater() && entitypanda.fh()) { @@ -34,7 +34,7 @@ index 7de157388922c4d3ff52866d5c0ac20189a9ccf8..b36cc95168c6e6fbf668ebe15c1fa10b } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 2fccc6a8a3dcf96e8ec714c2f7fa2f62af60cb76..b8e29172a17ad7e30134ff8c63815c71ff1d19d1 100644 +index aa08ca83a105627b7e257ac664c29d899b557e9e..f0fb9954c9fc7ccf31e3c4bc633ce48c85ba49dd 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -789,5 +789,20 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0410-Add-option-to-nerf-pigmen-from-nether-portals.patch b/Spigot-Server-Patches/0410-Add-option-to-nerf-pigmen-from-nether-portals.patch index 341cae8e73..2100a66b07 100644 --- a/Spigot-Server-Patches/0410-Add-option-to-nerf-pigmen-from-nether-portals.patch +++ b/Spigot-Server-Patches/0410-Add-option-to-nerf-pigmen-from-nether-portals.patch @@ -18,24 +18,11 @@ index 7fbd501d70dccf869a4454e2789a5d68f2e15754..9e4591ddc4b755f4ff5a6f1078b51cb1 + nerfNetherPortalPigmen = getBoolean("game-mechanics.nerf-pigmen-from-nether-portals", nerfNetherPortalPigmen); + } } -diff --git a/src/main/java/net/minecraft/server/BlockPortal.java b/src/main/java/net/minecraft/server/BlockPortal.java -index 17e5961e4a1f41f7ad07a4bf2cdfa796758046e0..bd78d55ee94f1359739a9d790092d07c613eac0f 100644 ---- a/src/main/java/net/minecraft/server/BlockPortal.java -+++ b/src/main/java/net/minecraft/server/BlockPortal.java -@@ -41,6 +41,8 @@ public class BlockPortal extends Block { - - if (entity != null) { - entity.resetPortalCooldown(); -+ entity.fromNetherPortal = true; // Paper -+ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper - } - } - } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 1f23d9d1e0054e55f410c1d901c33db708c0b621..f124527c4f727383c6da4eaa503b69112b583e32 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -189,6 +189,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 82e025776b0b6a01c35940df63f334b1d1fbdeb1..c89c56a6d116526e11f4ba9ad3333d8cceafc3e8 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -274,6 +274,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public long activatedTick = Integer.MIN_VALUE; public boolean isTemporarilyActive = false; // Paper public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one @@ -43,7 +30,7 @@ index 1f23d9d1e0054e55f410c1d901c33db708c0b621..f124527c4f727383c6da4eaa503b6911 protected int numCollisions = 0; // Paper public void inactiveTick() { } // Spigot end -@@ -1604,6 +1605,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1689,6 +1690,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne if (spawnedViaMobSpawner) { nbttagcompound.setBoolean("Paper.FromMobSpawner", true); } @@ -53,7 +40,7 @@ index 1f23d9d1e0054e55f410c1d901c33db708c0b621..f124527c4f727383c6da4eaa503b6911 // Paper end return nbttagcompound; } catch (Throwable throwable) { -@@ -1734,6 +1738,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1819,6 +1823,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status @@ -61,3 +48,16 @@ index 1f23d9d1e0054e55f410c1d901c33db708c0b621..f124527c4f727383c6da4eaa503b6911 if (nbttagcompound.hasKey("Paper.SpawnReason")) { String spawnReasonName = nbttagcompound.getString("Paper.SpawnReason"); try { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPortal.java b/src/main/java/net/minecraft/world/level/block/BlockPortal.java +index e115ff86987c69f5e3571af5d7f034f24a3f6bba..4cfa3108996eb879d39337a7b23307a6dbcb97a7 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockPortal.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPortal.java +@@ -62,6 +62,8 @@ public class BlockPortal extends Block { + + if (entity != null) { + entity.resetPortalCooldown(); ++ entity.fromNetherPortal = true; // Paper ++ if (worldserver.paperConfig.nerfNetherPortalPigmen) ((EntityInsentient) entity).aware = false; // Paper + } + } + } diff --git a/Spigot-Server-Patches/0411-Make-the-GUI-graph-fancier.patch b/Spigot-Server-Patches/0411-Make-the-GUI-graph-fancier.patch index 9d857a9b24..9877b30ce6 100644 --- a/Spigot-Server-Patches/0411-Make-the-GUI-graph-fancier.patch +++ b/Spigot-Server-Patches/0411-Make-the-GUI-graph-fancier.patch @@ -384,24 +384,11 @@ index 0000000000000000000000000000000000000000..c3e54da4ab6440811aab2f9dd1e21880 + timer.stop(); + } +} -diff --git a/src/main/java/net/minecraft/server/GuiStatsComponent.java b/src/main/java/net/minecraft/server/GuiStatsComponent.java -index d4d5bc19e167a5271f8eb8d010f8a52b23b942df..859e31c63f94bdc7729c6d475990750b76e24b9c 100644 ---- a/src/main/java/net/minecraft/server/GuiStatsComponent.java -+++ b/src/main/java/net/minecraft/server/GuiStatsComponent.java -@@ -11,7 +11,7 @@ import javax.swing.Timer; - - public class GuiStatsComponent extends JComponent { - -- private static final DecimalFormat a = (DecimalFormat) SystemUtils.a((Object) (new DecimalFormat("########0.000")), (decimalformat) -> { -+ private static final DecimalFormat a = (DecimalFormat) SystemUtils.a(new DecimalFormat("########0.000"), (decimalformat) -> { // Paper - decompile error - decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); - }); - private final int[] b = new int[256]; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0176fdd76ad1f3c281319d07c3ff463bde0e8b47..f625ed0ac4a1740c2b0fdf2a7e6b92fdcfdb1dce 100644 +index ef6559190c336822149560d2f2748b2c90dfad86..928a801493003e3ab034f65ac501f5b7e1cb6c75 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -108,7 +108,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { ++ private static final DecimalFormat a = (DecimalFormat) SystemUtils.a(new DecimalFormat("########0.000"), (decimalformat) -> { // Paper - decompile error + decimalformat.setDecimalFormatSymbols(DecimalFormatSymbols.getInstance(Locale.ROOT)); + }); + private final int[] b = new int[256]; +diff --git a/src/main/java/net/minecraft/server/gui/ServerGUI.java b/src/main/java/net/minecraft/server/gui/ServerGUI.java +index dc2a36f6dbc83ba25bcd59d981f75499adbd22e5..c2c075b9e3b70f863b6c450e4f31d6fde2935be6 100644 +--- a/src/main/java/net/minecraft/server/gui/ServerGUI.java ++++ b/src/main/java/net/minecraft/server/gui/ServerGUI.java +@@ -91,7 +91,7 @@ public class ServerGUI extends JComponent { private JComponent c() { JPanel jpanel = new JPanel(new BorderLayout()); diff --git a/Spigot-Server-Patches/0413-Prevent-teleporting-dead-entities.patch b/Spigot-Server-Patches/0413-Prevent-teleporting-dead-entities.patch index c0c713a34f..53573636c8 100644 --- a/Spigot-Server-Patches/0413-Prevent-teleporting-dead-entities.patch +++ b/Spigot-Server-Patches/0413-Prevent-teleporting-dead-entities.patch @@ -4,11 +4,11 @@ Date: Tue, 3 Mar 2020 05:26:40 +0000 Subject: [PATCH] Prevent teleporting dead entities -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 33112515865b6c2d357c0560637c0aa995ca6d0f..8fbafc6057a6062cbc222239e542a1bffc4fc09e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1323,6 +1323,10 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index fef5b401a168c5b2be26c834e03b014d6231daf9..31fb6eda544568b14255aede0a981d065bdf3aee 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1467,6 +1467,10 @@ public class PlayerConnection implements PacketListenerPlayIn { } private void internalTeleport(double d0, double d1, double d2, float f, float f1, Set set) { diff --git a/Spigot-Server-Patches/0414-Validate-tripwire-hook-placement-before-update.patch b/Spigot-Server-Patches/0414-Validate-tripwire-hook-placement-before-update.patch index 6ea67bd8e8..75c8efe983 100644 --- a/Spigot-Server-Patches/0414-Validate-tripwire-hook-placement-before-update.patch +++ b/Spigot-Server-Patches/0414-Validate-tripwire-hook-placement-before-update.patch @@ -4,11 +4,11 @@ Date: Sat, 7 Mar 2020 00:07:51 +0000 Subject: [PATCH] Validate tripwire hook placement before update -diff --git a/src/main/java/net/minecraft/server/BlockTripwireHook.java b/src/main/java/net/minecraft/server/BlockTripwireHook.java -index 26d801c231c6e9e31d0bdfea59e6027c77f488e4..dd30810569325096d35a367c4348e09f1463b2a9 100644 ---- a/src/main/java/net/minecraft/server/BlockTripwireHook.java -+++ b/src/main/java/net/minecraft/server/BlockTripwireHook.java -@@ -149,6 +149,7 @@ public class BlockTripwireHook extends Block { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java b/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java +index 8b24978cb54f2102d61f27038dedc5e3dc392dbc..5e3cf96b813d2871adf7a7f870af6c6a5dd878c1 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTripwireHook.java +@@ -170,6 +170,7 @@ public class BlockTripwireHook extends Block { this.a(world, blockposition, flag4, flag5, flag2, flag3); if (!flag) { diff --git a/Spigot-Server-Patches/0415-Add-option-to-allow-iron-golems-to-spawn-in-air.patch b/Spigot-Server-Patches/0415-Add-option-to-allow-iron-golems-to-spawn-in-air.patch index 90475a9fd2..bc4517ce5b 100644 --- a/Spigot-Server-Patches/0415-Add-option-to-allow-iron-golems-to-spawn-in-air.patch +++ b/Spigot-Server-Patches/0415-Add-option-to-allow-iron-golems-to-spawn-in-air.patch @@ -20,11 +20,11 @@ index 9e4591ddc4b755f4ff5a6f1078b51cb13db80480..fe1c9dd8258ec8c3fdf343d4a44de2be public boolean armorStandEntityLookups = true; private void armorStandEntityLookups() { armorStandEntityLookups = getBoolean("armor-stands-do-collision-entity-lookups", true); -diff --git a/src/main/java/net/minecraft/server/EntityIronGolem.java b/src/main/java/net/minecraft/server/EntityIronGolem.java -index 09c88c1079d1169b76b19eea235d5ee7805c6b83..0a5c27e732540e03c87e6da0fbdc6e3c2e382810 100644 ---- a/src/main/java/net/minecraft/server/EntityIronGolem.java -+++ b/src/main/java/net/minecraft/server/EntityIronGolem.java -@@ -251,7 +251,7 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java b/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java +index 49495cfbcf9b7742583536b87fc7cbd7c7c4c867..5e2b49d120b724cb5a7ae00940ded4f4875ea8a1 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityIronGolem.java +@@ -297,7 +297,7 @@ public class EntityIronGolem extends EntityGolem implements IEntityAngerable { BlockPosition blockposition1 = blockposition.down(); IBlockData iblockdata = iworldreader.getType(blockposition1); diff --git a/Spigot-Server-Patches/0416-Configurable-chance-of-villager-zombie-infection.patch b/Spigot-Server-Patches/0416-Configurable-chance-of-villager-zombie-infection.patch index 7cb8c8c505..0a2c05d50a 100644 --- a/Spigot-Server-Patches/0416-Configurable-chance-of-villager-zombie-infection.patch +++ b/Spigot-Server-Patches/0416-Configurable-chance-of-villager-zombie-infection.patch @@ -21,11 +21,11 @@ index fe1c9dd8258ec8c3fdf343d4a44de2be2ae3d35f..525d702d78a609af987ebd2c32169b87 + zombieVillagerInfectionChance = getDouble("zombie-villager-infection-chance", zombieVillagerInfectionChance); + } } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index ab678bfa024ac3e963d5ca85a01c6df91dd6bc42..555c74feb0d678d8f05d89e274f4736fc35ffebf 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -388,10 +388,14 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index f406826945dd752e6528743a0c8cad3cfdfc4a95..3d8d4a43e6cd554b6f1eeafa1c8d43cef877139a 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -450,10 +450,14 @@ public class EntityZombie extends EntityMonster { @Override public void a(WorldServer worldserver, EntityLiving entityliving) { super.a(worldserver, entityliving); diff --git a/Spigot-Server-Patches/0417-Optimise-Chunk-getFluid.patch b/Spigot-Server-Patches/0417-Optimise-Chunk-getFluid.patch index 6102a2a441..be0772fe92 100644 --- a/Spigot-Server-Patches/0417-Optimise-Chunk-getFluid.patch +++ b/Spigot-Server-Patches/0417-Optimise-Chunk-getFluid.patch @@ -7,11 +7,11 @@ Removing the try catch and generally reducing ops should make it faster on its own, however removing the try catch makes it easier to inline due to code size -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 81504bfbbd4a987c95f35d0f25754dbf8b2487e4..8e91a0270a7a72f09dfc86331a788765de1f9f5e 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -390,17 +390,20 @@ public class Chunk implements IChunkAccess { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 09d157bd2795b7e4374778cbd1e554de70f397bd..bd56cac7ce01942704d566c2cd8c1775fe643e25 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -424,17 +424,20 @@ public class Chunk implements IChunkAccess { } public Fluid a(int i, int j, int k) { @@ -39,7 +39,7 @@ index 81504bfbbd4a987c95f35d0f25754dbf8b2487e4..8e91a0270a7a72f09dfc86331a788765 CrashReport crashreport = CrashReport.a(throwable, "Getting fluid state"); CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Block being got"); -@@ -409,6 +412,7 @@ public class Chunk implements IChunkAccess { +@@ -443,6 +446,7 @@ public class Chunk implements IChunkAccess { }); throw new ReportedException(crashreport); } @@ -47,11 +47,11 @@ index 81504bfbbd4a987c95f35d0f25754dbf8b2487e4..8e91a0270a7a72f09dfc86331a788765 } // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 668942c629732b8d46b7f2646df8e7827baae240..39572cdce691a459cb9df0cc064fbf7bde83a99e 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -38,7 +38,7 @@ public class ChunkSection { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index c89905b7fc30988dc3624270eac96bc1f06cd0cb..506b79c67454e41d32ad18003f066681d47e50f5 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -44,7 +44,7 @@ public class ChunkSection { } public Fluid b(int i, int j, int k) { diff --git a/Spigot-Server-Patches/0418-Optimise-TickListServer-by-rewriting-it.patch b/Spigot-Server-Patches/0418-Optimise-TickListServer-by-rewriting-it.patch index 4a61134e65..fc53a4b879 100644 --- a/Spigot-Server-Patches/0418-Optimise-TickListServer-by-rewriting-it.patch +++ b/Spigot-Server-Patches/0418-Optimise-TickListServer-by-rewriting-it.patch @@ -888,11 +888,11 @@ index 0000000000000000000000000000000000000000..118988c39e58f28e8a2851792b9c014f + } + } +} -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 253423acc3c3697a5e47136f34da92617e719753..52ae74571b0d671a294900caedaa400b62d4ea34 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -105,6 +105,7 @@ public class BlockPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index 8c0aeb51f5e230fd6109e750732eb54559bc9637..1fb931d4c0720a5e496030e25c865771aea3ec70 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -111,6 +111,7 @@ public class BlockPosition extends BaseBlockPosition { return i == 0 && j == 0 && k == 0 ? this : new BlockPosition(this.getX() + i, this.getY() + j, this.getZ() + k); } @@ -900,11 +900,11 @@ index 253423acc3c3697a5e47136f34da92617e719753..52ae74571b0d671a294900caedaa400b public BlockPosition a(BaseBlockPosition baseblockposition) { return this.b(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index e0296920a794157d89bb314b162de706d69a5459..1f4776f6f2debb4e000440ed8e47e3e063202850 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -194,6 +194,13 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index d6f897bf045ad00792e57adfe233548e9bd54877..071151b774564f25ad08f47a8ffd67434d5bf940 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -216,6 +216,13 @@ public class ChunkProviderServer extends IChunkProvider { } // Paper end @@ -918,11 +918,85 @@ index e0296920a794157d89bb314b162de706d69a5459..1f4776f6f2debb4e000440ed8e47e3e0 public ChunkProviderServer(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, ChunkGenerator chunkgenerator, int i, boolean flag, WorldLoadListener worldloadlistener, Supplier supplier) { this.world = worldserver; this.serverThreadQueue = new ChunkProviderServer.a(worldserver); -diff --git a/src/main/java/net/minecraft/server/NextTickListEntry.java b/src/main/java/net/minecraft/server/NextTickListEntry.java -index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c70589141192 100644 ---- a/src/main/java/net/minecraft/server/NextTickListEntry.java -+++ b/src/main/java/net/minecraft/server/NextTickListEntry.java -@@ -5,11 +5,13 @@ import java.util.Comparator; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 6433463938d8bb717840c8f57fe6e7079e1030f2..445dba8ed210407664904b707c36c78a76f25510 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -496,7 +496,9 @@ public class PlayerChunk { + PlayerChunk.this.isTickingReady = true; + + +- ++ // Paper start - rewrite ticklistserver ++ PlayerChunk.this.chunkMap.world.onChunkSetTicking(PlayerChunk.this.location.x, PlayerChunk.this.location.z); ++ // Paper end - rewrite ticklistserver + + } + }); +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 2b58f4b80f10b93868a686bc9d2630a02832d1dd..bb66597eb882d6937c02982dd252951f1f37bb42 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -295,6 +295,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + // Paper end + ++ // Paper start - rewrite ticklistserver ++ void onChunkSetTicking(int chunkX, int chunkZ) { ++ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { ++ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListBlock).onChunkSetTicking(chunkX, chunkZ); ++ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListFluid).onChunkSetTicking(chunkX, chunkZ); ++ } ++ } ++ // Paper end - rewrite ticklistserver ++ + // Add env and gen to constructor, WorldData -> WorldDataServer + public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { + super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor +@@ -302,12 +311,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { + convertable = convertable_conversionsession; + uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); + // CraftBukkit end +- this.nextTickListBlock = new TickListServer<>(this, (block) -> { +- return block == null || block.getBlockData().isAir(); +- }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings +- this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { +- return fluidtype == null || fluidtype == FluidTypes.EMPTY; +- }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings ++ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { ++ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { ++ return block == null || block.getBlockData().isAir(); ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings ++ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { ++ return fluidtype == null || fluidtype == FluidTypes.EMPTY; ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings ++ } else { ++ this.nextTickListBlock = new TickListServer<>(this, (block) -> { ++ return block == null || block.getBlockData().isAir(); ++ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings ++ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { ++ return fluidtype == null || fluidtype == FluidTypes.EMPTY; ++ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings ++ } + this.navigators = Sets.newHashSet(); + this.L = new ObjectLinkedOpenHashSet(); + this.Q = flag1; +@@ -640,7 +658,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { + if (this.Q) { + long i = this.worldData.getTime() + 1L; + +- this.worldDataServer.setTime(i); ++ this.worldDataServer.setTime(i); // Paper - diff on change, we want the below to be ran right after this ++ this.nextTickListBlock.nextTick(); // Paper ++ this.nextTickListFluid.nextTick(); // Paper + this.worldDataServer.u().a(this.server, i); + if (this.worldData.q().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { + this.setDayTime(this.worldData.getDayTime() + 1L); +diff --git a/src/main/java/net/minecraft/world/level/NextTickListEntry.java b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +index 37b7dd82a227a88b720c13a813dd7e8caf803e03..8eb3084def3aa8776d32f8a3c942c95d24ccea3f 100644 +--- a/src/main/java/net/minecraft/world/level/NextTickListEntry.java ++++ b/src/main/java/net/minecraft/world/level/NextTickListEntry.java +@@ -6,11 +6,13 @@ import net.minecraft.core.BlockPosition; public class NextTickListEntry { private static final java.util.concurrent.atomic.AtomicLong COUNTER = new java.util.concurrent.atomic.AtomicLong(); // Paper - async chunk loading @@ -941,7 +1015,7 @@ index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c705 public NextTickListEntry(BlockPosition blockposition, T t0) { this(blockposition, t0, 0L, TickListPriority.NORMAL); -@@ -21,6 +23,7 @@ public class NextTickListEntry { +@@ -22,6 +24,7 @@ public class NextTickListEntry { this.e = t0; this.b = i; this.c = ticklistpriority; @@ -949,7 +1023,7 @@ index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c705 } public boolean equals(Object object) { -@@ -33,19 +36,31 @@ public class NextTickListEntry { +@@ -34,19 +37,31 @@ public class NextTickListEntry { } } @@ -989,65 +1063,11 @@ index 33cfeabdee03195a294f303f28044a313cb1c4ed..2287e47d1b891135a5f2579ec324c705 public String toString() { return this.e + ": " + this.a + ", " + this.b + ", " + this.c + ", " + this.f; -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 25f8febe63167349460e32c831088bb80b6b77ad..5305da4c7253c7e259d7b08e9722145188adc513 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -471,7 +471,9 @@ public class PlayerChunk { - PlayerChunk.this.isTickingReady = true; - - -- -+ // Paper start - rewrite ticklistserver -+ PlayerChunk.this.chunkMap.world.onChunkSetTicking(PlayerChunk.this.location.x, PlayerChunk.this.location.z); -+ // Paper end - rewrite ticklistserver - - } - }); -diff --git a/src/main/java/net/minecraft/server/StructureBoundingBox.java b/src/main/java/net/minecraft/server/StructureBoundingBox.java -index 7873db26b336c97f909e5391e58ee53feaf59b9a..447eb2ba84789edf9bac2e2ffb2dec7cb4596cbf 100644 ---- a/src/main/java/net/minecraft/server/StructureBoundingBox.java -+++ b/src/main/java/net/minecraft/server/StructureBoundingBox.java -@@ -4,12 +4,12 @@ import com.google.common.base.MoreObjects; - - public class StructureBoundingBox { - -- public int a; -- public int b; -- public int c; -- public int d; -- public int e; -- public int f; -+ public int a; public final int getMinX() { return this.a; } // Paper - OBFHELPER -+ public int b; public final int getMinY() { return this.b; } // Paper - OBFHELPER -+ public int c; public final int getMinZ() { return this.c; } // Paper - OBFHELPER -+ public int d; public final int getMaxX() { return this.d; } // Paper - OBFHELPER -+ public int e; public final int getMaxY() { return this.e; } // Paper - OBFHELPER -+ public int f; public final int getMaxZ() { return this.f; } // Paper - OBFHELPER - - public StructureBoundingBox() {} - -@@ -88,6 +88,7 @@ public class StructureBoundingBox { - this.e = 512; - } - -+ public final boolean intersects(StructureBoundingBox boundingBox) { return this.b(boundingBox); } // Paper - OBFHELPER - public boolean b(StructureBoundingBox structureboundingbox) { - return this.d >= structureboundingbox.a && this.a <= structureboundingbox.d && this.f >= structureboundingbox.c && this.c <= structureboundingbox.f && this.e >= structureboundingbox.b && this.b <= structureboundingbox.e; - } -@@ -122,6 +123,7 @@ public class StructureBoundingBox { - this.a(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); - } - -+ public final boolean hasPoint(BaseBlockPosition baseblockposition) { return this.b(baseblockposition); } // Paper - OBFHELPER - public boolean b(BaseBlockPosition baseblockposition) { - return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e; - } -diff --git a/src/main/java/net/minecraft/server/TickListChunk.java b/src/main/java/net/minecraft/server/TickListChunk.java -index f94234b0a247e378ff9056d6c418464d619a356b..8af1229c3da63a838b0bec1cafde1e41cf5cf551 100644 ---- a/src/main/java/net/minecraft/server/TickListChunk.java -+++ b/src/main/java/net/minecraft/server/TickListChunk.java -@@ -57,6 +57,8 @@ public class TickListChunk implements TickList { +diff --git a/src/main/java/net/minecraft/world/level/TickListChunk.java b/src/main/java/net/minecraft/world/level/TickListChunk.java +index c3cb513d0d107ecb43e98960b25054626aa6a03f..d7f532388b65161f8dcced02aebba6b0615d57d1 100644 +--- a/src/main/java/net/minecraft/world/level/TickListChunk.java ++++ b/src/main/java/net/minecraft/world/level/TickListChunk.java +@@ -61,6 +61,8 @@ public class TickListChunk implements TickList { return nbttaglist; } @@ -1056,7 +1076,7 @@ index f94234b0a247e378ff9056d6c418464d619a356b..8af1229c3da63a838b0bec1cafde1e41 public static TickListChunk a(NBTTagList nbttaglist, Function function, Function function1) { List> list = Lists.newArrayList(); -@@ -67,7 +69,14 @@ public class TickListChunk implements TickList { +@@ -71,7 +73,14 @@ public class TickListChunk implements TickList { if (t0 != null) { BlockPosition blockposition = new BlockPosition(nbttagcompound.getInt("x"), nbttagcompound.getInt("y"), nbttagcompound.getInt("z")); @@ -1072,11 +1092,11 @@ index f94234b0a247e378ff9056d6c418464d619a356b..8af1229c3da63a838b0bec1cafde1e41 } } -diff --git a/src/main/java/net/minecraft/server/TickListServer.java b/src/main/java/net/minecraft/server/TickListServer.java -index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb914e1ebc8 100644 ---- a/src/main/java/net/minecraft/server/TickListServer.java -+++ b/src/main/java/net/minecraft/server/TickListServer.java -@@ -38,7 +38,16 @@ public class TickListServer implements TickList { +diff --git a/src/main/java/net/minecraft/world/level/TickListServer.java b/src/main/java/net/minecraft/world/level/TickListServer.java +index c221e5caf518b8c588390e438346fa58fa8c5a38..8a78a03ccf5b688ae3fd4616ae9f495f00a7cb30 100644 +--- a/src/main/java/net/minecraft/world/level/TickListServer.java ++++ b/src/main/java/net/minecraft/world/level/TickListServer.java +@@ -50,7 +50,16 @@ public class TickListServer implements TickList { private final co.aikar.timings.Timing timingTicking; // Paper // Paper end @@ -1093,7 +1113,7 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 int i = this.nextTickList.size(); if (false) { // CraftBukkit -@@ -106,10 +115,20 @@ public class TickListServer implements TickList { +@@ -118,10 +127,20 @@ public class TickListServer implements TickList { @Override public boolean b(BlockPosition blockposition, T t0) { @@ -1114,7 +1134,7 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 int i = (chunkcoordintpair.x << 4) - 2; int j = i + 16 + 2; int k = (chunkcoordintpair.z << 4) - 2; -@@ -119,6 +138,11 @@ public class TickListServer implements TickList { +@@ -131,6 +150,11 @@ public class TickListServer implements TickList { } public List> a(StructureBoundingBox structureboundingbox, boolean flag, boolean flag1) { @@ -1126,7 +1146,7 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 List> list = this.a((List) null, this.nextTickList, structureboundingbox, flag); if (flag && list != null) { -@@ -158,6 +182,11 @@ public class TickListServer implements TickList { +@@ -170,6 +194,11 @@ public class TickListServer implements TickList { } public void a(StructureBoundingBox structureboundingbox, BlockPosition blockposition) { @@ -1138,7 +1158,7 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 List> list = this.a(structureboundingbox, false, false); Iterator iterator = list.iterator(); -@@ -175,11 +204,17 @@ public class TickListServer implements TickList { +@@ -187,11 +216,17 @@ public class TickListServer implements TickList { } public NBTTagList a(ChunkCoordIntPair chunkcoordintpair) { @@ -1156,7 +1176,7 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 private static NBTTagList a(Function function, Iterable> iterable, long i) { NBTTagList nbttaglist = new NBTTagList(); Iterator iterator = iterable.iterator(); -@@ -202,11 +237,21 @@ public class TickListServer implements TickList { +@@ -214,11 +249,21 @@ public class TickListServer implements TickList { @Override public boolean a(BlockPosition blockposition, T t0) { @@ -1178,7 +1198,7 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 if (!this.a.test(t0)) { this.a(new NextTickListEntry<>(blockposition, t0, (long) i + this.e.getTime(), ticklistpriority)); } -@@ -222,6 +267,11 @@ public class TickListServer implements TickList { +@@ -234,6 +279,11 @@ public class TickListServer implements TickList { } public int a() { @@ -1190,62 +1210,42 @@ index 3b8f56c0f0507ebdd9ac20be70688b4c0cfe4cf8..3e148b7e99554a1abe257dd3c9acafb9 return this.nextTickListHash.size(); } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 640ae46d754f4af09ef3a404860b6b3db7d63a1a..e0be5975ddeb5116f16696b2ca0d067146b00cf4 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -186,6 +186,15 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java +index b5d6c8163c686c31375fb645d7721af06c01df40..fb4b8d7167ad7f1d24d40bbbda5f52e278f25895 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/structure/StructureBoundingBox.java +@@ -8,12 +8,12 @@ import net.minecraft.nbt.NBTTagIntArray; + + public class StructureBoundingBox { + +- public int a; +- public int b; +- public int c; +- public int d; +- public int e; +- public int f; ++ public int a; public final int getMinX() { return this.a; } // Paper - OBFHELPER ++ public int b; public final int getMinY() { return this.b; } // Paper - OBFHELPER ++ public int c; public final int getMinZ() { return this.c; } // Paper - OBFHELPER ++ public int d; public final int getMaxX() { return this.d; } // Paper - OBFHELPER ++ public int e; public final int getMaxY() { return this.e; } // Paper - OBFHELPER ++ public int f; public final int getMaxZ() { return this.f; } // Paper - OBFHELPER + + public StructureBoundingBox() {} + +@@ -92,6 +92,7 @@ public class StructureBoundingBox { + this.e = 512; } - // Paper end -+ // Paper start - rewrite ticklistserver -+ void onChunkSetTicking(int chunkX, int chunkZ) { -+ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { -+ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListBlock).onChunkSetTicking(chunkX, chunkZ); -+ ((com.destroystokyo.paper.server.ticklist.PaperTickList) this.nextTickListFluid).onChunkSetTicking(chunkX, chunkZ); -+ } -+ } -+ // Paper end - rewrite ticklistserver -+ - // Add env and gen to constructor, WorldData -> WorldDataServer - public WorldServer(MinecraftServer minecraftserver, Executor executor, Convertable.ConversionSession convertable_conversionsession, IWorldDataServer iworlddataserver, ResourceKey resourcekey, DimensionManager dimensionmanager, WorldLoadListener worldloadlistener, ChunkGenerator chunkgenerator, boolean flag, long i, List list, boolean flag1, org.bukkit.World.Environment env, org.bukkit.generator.ChunkGenerator gen) { - super(iworlddataserver, resourcekey, dimensionmanager, minecraftserver::getMethodProfiler, false, flag, i, gen, env, executor); // Paper pass executor -@@ -193,12 +202,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { - convertable = convertable_conversionsession; - uuid = WorldUUID.getUUID(convertable_conversionsession.folder.toFile()); - // CraftBukkit end -- this.nextTickListBlock = new TickListServer<>(this, (block) -> { -- return block == null || block.getBlockData().isAir(); -- }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings -- this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { -- return fluidtype == null || fluidtype == FluidTypes.EMPTY; -- }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings -+ if (com.destroystokyo.paper.PaperConfig.useOptimizedTickList) { -+ this.nextTickListBlock = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (block) -> { -+ return block == null || block.getBlockData().isAir(); -+ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings -+ this.nextTickListFluid = new com.destroystokyo.paper.server.ticklist.PaperTickList<>(this, (fluidtype) -> { -+ return fluidtype == null || fluidtype == FluidTypes.EMPTY; -+ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings -+ } else { -+ this.nextTickListBlock = new TickListServer<>(this, (block) -> { -+ return block == null || block.getBlockData().isAir(); -+ }, IRegistry.BLOCK::getKey, this::b, "Blocks"); // Paper - Timings -+ this.nextTickListFluid = new TickListServer<>(this, (fluidtype) -> { -+ return fluidtype == null || fluidtype == FluidTypes.EMPTY; -+ }, IRegistry.FLUID::getKey, this::a, "Fluids"); // Paper - Timings -+ } - this.navigators = Sets.newHashSet(); - this.L = new ObjectLinkedOpenHashSet(); - this.Q = flag1; -@@ -531,7 +549,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { - if (this.Q) { - long i = this.worldData.getTime() + 1L; ++ public final boolean intersects(StructureBoundingBox boundingBox) { return this.b(boundingBox); } // Paper - OBFHELPER + public boolean b(StructureBoundingBox structureboundingbox) { + return this.d >= structureboundingbox.a && this.a <= structureboundingbox.d && this.f >= structureboundingbox.c && this.c <= structureboundingbox.f && this.e >= structureboundingbox.b && this.b <= structureboundingbox.e; + } +@@ -126,6 +127,7 @@ public class StructureBoundingBox { + this.a(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); + } -- this.worldDataServer.setTime(i); -+ this.worldDataServer.setTime(i); // Paper - diff on change, we want the below to be ran right after this -+ this.nextTickListBlock.nextTick(); // Paper -+ this.nextTickListFluid.nextTick(); // Paper - this.worldDataServer.u().a(this.server, i); - if (this.worldData.q().getBoolean(GameRules.DO_DAYLIGHT_CYCLE)) { - this.setDayTime(this.worldData.getDayTime() + 1L); ++ public final boolean hasPoint(BaseBlockPosition baseblockposition) { return this.b(baseblockposition); } // Paper - OBFHELPER + public boolean b(BaseBlockPosition baseblockposition) { + return baseblockposition.getX() >= this.a && baseblockposition.getX() <= this.d && baseblockposition.getZ() >= this.c && baseblockposition.getZ() <= this.f && baseblockposition.getY() >= this.b && baseblockposition.getY() <= this.e; + } diff --git a/Spigot-Server-Patches/0419-Pillager-patrol-spawn-settings-and-per-player-option.patch b/Spigot-Server-Patches/0419-Pillager-patrol-spawn-settings-and-per-player-option.patch index 47babc6c7c..65cf9fd127 100644 --- a/Spigot-Server-Patches/0419-Pillager-patrol-spawn-settings-and-per-player-option.patch +++ b/Spigot-Server-Patches/0419-Pillager-patrol-spawn-settings-and-per-player-option.patch @@ -35,23 +35,35 @@ index 525d702d78a609af987ebd2c32169b873e5c05ed..6c8e9d498c9a30a1aa88494ba09c3cae public boolean entitiesTargetWithFollowRange = false; private void entitiesTargetWithFollowRange() { entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index f87cfd0de55808c6d93e2e80772c122cf7a279b8..e60dac038e8a414a45f8dab465d722ee3fb5ef54 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -87,6 +87,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index a3195ab0c447d5532642b430411434abaa168306..8c91e44252366445ad393221825ec9c2591a9490 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -214,6 +214,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean viewingCredits; private int containerUpdateDelay; // Paper public long loginTime; // Paper + public int patrolSpawnDelay; // Paper - per player patrol spawns // Paper start - cancellable death event public boolean queueHealthUpdatePacket = false; - public net.minecraft.server.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -index 7ed89bbe465402582c9d28f0a3935758a6b0f7af..13fccedb948ce5ced1678ff338f7eea5d53ee022 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPatrol.java -@@ -4,13 +4,13 @@ import java.util.Random; + public net.minecraft.network.protocol.game.PacketPlayOutUpdateHealth queuedHealthUpdatePacket; +diff --git a/src/main/java/net/minecraft/stats/StatisticWrapper.java b/src/main/java/net/minecraft/stats/StatisticWrapper.java +index c1a694c4a773a41cdefca6b154711f7fc0a7fcaa..00d79ccf9c65acadc030ab1796cff4598392cb6a 100644 +--- a/src/main/java/net/minecraft/stats/StatisticWrapper.java ++++ b/src/main/java/net/minecraft/stats/StatisticWrapper.java +@@ -28,6 +28,7 @@ public class StatisticWrapper implements Iterable> { + return this.b.values().iterator(); + } + ++ public final Statistic get(T t) { return this.b(t); }; // Paper - OBFHELPER + public Statistic b(T t0) { + return this.a(t0, Counter.DEFAULT); + } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java +index cba98adb7f2711fb97c7e4120d962f46a59682e7..d50377425088b98730684c82ae2c6e2fe5b2fd57 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPatrol.java +@@ -20,13 +20,13 @@ import net.minecraft.world.level.block.state.IBlockData; public class MobSpawnerPatrol implements MobSpawner { @@ -67,7 +79,7 @@ index 7ed89bbe465402582c9d28f0a3935758a6b0f7af..13fccedb948ce5ced1678ff338f7eea5 if (!flag) { return 0; } else if (!worldserver.getGameRules().getBoolean(GameRules.DO_PATROL_SPAWNING)) { -@@ -18,23 +18,51 @@ public class MobSpawnerPatrol implements MobSpawner { +@@ -34,23 +34,51 @@ public class MobSpawnerPatrol implements MobSpawner { } else { Random random = worldserver.random; @@ -127,15 +139,3 @@ index 7ed89bbe465402582c9d28f0a3935758a6b0f7af..13fccedb948ce5ced1678ff338f7eea5 if (entityhuman.isSpectator()) { return 0; -diff --git a/src/main/java/net/minecraft/server/StatisticWrapper.java b/src/main/java/net/minecraft/server/StatisticWrapper.java -index 3b6034038a4841ebc980b2392c71025d9b0dde35..795ea6fece2e28645e99f4578e26a6d12b4c1bf8 100644 ---- a/src/main/java/net/minecraft/server/StatisticWrapper.java -+++ b/src/main/java/net/minecraft/server/StatisticWrapper.java -@@ -27,6 +27,7 @@ public class StatisticWrapper implements Iterable> { - return this.b.values().iterator(); - } - -+ public final Statistic get(T t) { return this.b(t); }; // Paper - OBFHELPER - public Statistic b(T t0) { - return this.a(t0, Counter.DEFAULT); - } diff --git a/Spigot-Server-Patches/0420-Ensure-Entity-is-never-double-registered.patch b/Spigot-Server-Patches/0420-Ensure-Entity-is-never-double-registered.patch index 68ff965915..0254d4a95f 100644 --- a/Spigot-Server-Patches/0420-Ensure-Entity-is-never-double-registered.patch +++ b/Spigot-Server-Patches/0420-Ensure-Entity-is-never-double-registered.patch @@ -10,23 +10,11 @@ Vs behavior of non ticking of just overwriting state. We will now simply log a warning when this happens instead of crashing the server. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index cabbc9019d6b6fe174b0be61b7f18a2db4702987..0adeb46e1a82820df8744379829f6f7a68fa6d2d 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -59,6 +59,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - - // Paper start -+ boolean isQueuedForRegister = false; - public static Random SHARED_RANDOM = new Random() { - private boolean locked = false; - @Override -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index fb9c55a864ce3fd646e9576b2feede70ab759bbc..95b25bb17d9d4b025047b01909a880da26e59146 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -535,6 +535,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index bb66597eb882d6937c02982dd252951f1f37bb42..f493dcbe178149084afb5ae8002250c7de111c37 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -644,6 +644,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { Entity entity2; while ((entity2 = (Entity) this.entitiesToAdd.poll()) != null) { @@ -34,7 +22,7 @@ index fb9c55a864ce3fd646e9576b2feede70ab759bbc..95b25bb17d9d4b025047b01909a880da this.registerEntity(entity2); } -@@ -1292,6 +1293,19 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1401,6 +1402,19 @@ public class WorldServer extends World implements GeneratorAccessSeed { public void unregisterEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity unregister"); // Spigot @@ -54,7 +42,7 @@ index fb9c55a864ce3fd646e9576b2feede70ab759bbc..95b25bb17d9d4b025047b01909a880da // Spigot start if ( entity instanceof EntityHuman ) { -@@ -1358,9 +1372,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1467,9 +1481,21 @@ public class WorldServer extends World implements GeneratorAccessSeed { private void registerEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity register"); // Spigot @@ -77,3 +65,15 @@ index fb9c55a864ce3fd646e9576b2feede70ab759bbc..95b25bb17d9d4b025047b01909a880da this.entitiesById.put(entity.getId(), entity); if (entity instanceof EntityEnderDragon) { EntityComplexPart[] aentitycomplexpart = ((EntityEnderDragon) entity).eJ(); +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index c89c56a6d116526e11f4ba9ad3333d8cceafc3e8..bded403c87c2dfe4bcaab21be56e7b120efb112a 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -144,6 +144,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + + // Paper start ++ boolean isQueuedForRegister = false; + public static Random SHARED_RANDOM = new Random() { + private boolean locked = false; + @Override diff --git a/Spigot-Server-Patches/0421-Fix-unregistering-entities-from-unloading-chunks.patch b/Spigot-Server-Patches/0421-Fix-unregistering-entities-from-unloading-chunks.patch index 34a39f5621..4c5c335f71 100644 --- a/Spigot-Server-Patches/0421-Fix-unregistering-entities-from-unloading-chunks.patch +++ b/Spigot-Server-Patches/0421-Fix-unregistering-entities-from-unloading-chunks.patch @@ -14,11 +14,11 @@ This then results in dead entities lingering in the Chunk. Combine that with a buggy detail of the previous implementation of the Dupe UUID patch, then this was the likely source of the "Ghost entities" -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 69060be0daf3fbae2763852209c915be59caac4f..cd04994ed38c7f5d4db6b1ef1796f95ef2c490e1 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1451,9 +1451,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index f493dcbe178149084afb5ae8002250c7de111c37..6f39f1a389b2e310780456bd7685fd9c4da31aae 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1560,9 +1560,9 @@ public class WorldServer extends World implements GeneratorAccessSeed { } private void removeEntityFromChunk(Entity entity) { diff --git a/Spigot-Server-Patches/0422-Remote-Connections-shouldn-t-hold-up-shutdown.patch b/Spigot-Server-Patches/0422-Remote-Connections-shouldn-t-hold-up-shutdown.patch index 3f3401bca0..f765b7f7b5 100644 --- a/Spigot-Server-Patches/0422-Remote-Connections-shouldn-t-hold-up-shutdown.patch +++ b/Spigot-Server-Patches/0422-Remote-Connections-shouldn-t-hold-up-shutdown.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Remote Connections shouldn't hold up shutdown Bugs in the connection logic appears to leave stale connections even, preventing shutdown -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index bec26885108442c8e22cdddf5e764ecab6994dca..a4db2527ff2defcfd25f08dd24722a37794a4a7e 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -361,11 +361,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index 2d42b863b3fd83d1ee0532d1fcb63861641ec47b..557f80accfa36b495c9a8cffdab2e248c1cbb514 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -400,11 +400,11 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer } if (this.remoteControlListener != null) { diff --git a/Spigot-Server-Patches/0423-Do-not-allow-bees-to-load-chunks-for-beehives.patch b/Spigot-Server-Patches/0423-Do-not-allow-bees-to-load-chunks-for-beehives.patch index bfbe183e94..290489e398 100644 --- a/Spigot-Server-Patches/0423-Do-not-allow-bees-to-load-chunks-for-beehives.patch +++ b/Spigot-Server-Patches/0423-Do-not-allow-bees-to-load-chunks-for-beehives.patch @@ -4,11 +4,11 @@ Date: Tue, 17 Mar 2020 14:18:50 -0500 Subject: [PATCH] Do not allow bees to load chunks for beehives -diff --git a/src/main/java/net/minecraft/server/EntityBee.java b/src/main/java/net/minecraft/server/EntityBee.java -index c14e07f3c3017e5a5355b1770b94ee4dcc8cc017..f73641ddb3e82bc653732105ef0a3d41a28e845f 100644 ---- a/src/main/java/net/minecraft/server/EntityBee.java -+++ b/src/main/java/net/minecraft/server/EntityBee.java -@@ -284,6 +284,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java +index 7ce8eaeb9af3547869f467910b6a458118c63c1f..1d1f71a995a99b2101891a7a5bda7bec5d67f118 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityBee.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityBee.java +@@ -358,6 +358,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB if (this.hivePos == null) { return false; } else { @@ -16,7 +16,7 @@ index c14e07f3c3017e5a5355b1770b94ee4dcc8cc017..f73641ddb3e82bc653732105ef0a3d41 TileEntity tileentity = this.world.getTileEntity(this.hivePos); return tileentity instanceof TileEntityBeehive && ((TileEntityBeehive) tileentity).d(); -@@ -316,6 +317,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB +@@ -390,6 +391,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB } private boolean i(BlockPosition blockposition) { @@ -24,7 +24,7 @@ index c14e07f3c3017e5a5355b1770b94ee4dcc8cc017..f73641ddb3e82bc653732105ef0a3d41 TileEntity tileentity = this.world.getTileEntity(blockposition); return tileentity instanceof TileEntityBeehive ? !((TileEntityBeehive) tileentity).isFull() : false; -@@ -558,6 +560,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB +@@ -632,6 +634,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB @Override public boolean g() { if (EntityBee.this.hasHivePos() && EntityBee.this.fd() && EntityBee.this.hivePos.a((IPosition) EntityBee.this.getPositionVector(), 2.0D)) { @@ -32,7 +32,7 @@ index c14e07f3c3017e5a5355b1770b94ee4dcc8cc017..f73641ddb3e82bc653732105ef0a3d41 TileEntity tileentity = EntityBee.this.world.getTileEntity(EntityBee.this.hivePos); if (tileentity instanceof TileEntityBeehive) { -@@ -581,6 +584,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB +@@ -655,6 +658,7 @@ public class EntityBee extends EntityAnimal implements IEntityAngerable, EntityB @Override public void c() { diff --git a/Spigot-Server-Patches/0424-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch b/Spigot-Server-Patches/0424-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch index 149f372a77..714df6fbe3 100644 --- a/Spigot-Server-Patches/0424-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch +++ b/Spigot-Server-Patches/0424-Prevent-Double-PlayerChunkMap-adds-crashing-server.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Prevent Double PlayerChunkMap adds crashing server Suspected case would be around the technique used in .stopRiding Stack will identify any causer of this and warn instead of crashing. -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 08eaaabb712c7a6c9b6631d62874a72e96bf73d5..9600ded94f127da50e05129aa00e5b0979b973a3 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1447,6 +1447,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index faec8a9a535d6b122c57cda8be3e4f8f3e52852b..8d8d2ac73b3e8d5fb59245bfe551a6985870dec9 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -1491,6 +1491,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { protected void addEntity(Entity entity) { org.spigotmc.AsyncCatcher.catchOp("entity track"); // Spigot @@ -25,11 +25,11 @@ index 08eaaabb712c7a6c9b6631d62874a72e96bf73d5..9600ded94f127da50e05129aa00e5b09 if (!(entity instanceof EntityComplexPart)) { EntityTypes entitytypes = entity.getEntityType(); int i = entitytypes.getChunkRange() * 16; -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index cd04994ed38c7f5d4db6b1ef1796f95ef2c490e1..cbfe3cc34922c4dffb3dea5a279970072de1daae 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1417,7 +1417,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 6f39f1a389b2e310780456bd7685fd9c4da31aae..6ebedf392d2e5aad220e403806d4742e18f0428c 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1526,7 +1526,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } @@ -38,7 +38,7 @@ index cd04994ed38c7f5d4db6b1ef1796f95ef2c490e1..cbfe3cc34922c4dffb3dea5a27997007 // CraftBukkit start - SPIGOT-5278 if (entity instanceof EntityDrowned) { this.navigators.add(((EntityDrowned) entity).navigationWater); -@@ -1428,6 +1428,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1537,6 +1537,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.navigators.add(((EntityInsentient) entity).getNavigation()); } entity.valid = true; // CraftBukkit diff --git a/Spigot-Server-Patches/0425-Optimize-Collision-to-not-load-chunks.patch b/Spigot-Server-Patches/0425-Optimize-Collision-to-not-load-chunks.patch index 0ba183cbdb..8a3665e584 100644 --- a/Spigot-Server-Patches/0425-Optimize-Collision-to-not-load-chunks.patch +++ b/Spigot-Server-Patches/0425-Optimize-Collision-to-not-load-chunks.patch @@ -13,11 +13,23 @@ If that serting is not enabled, collisions will be ignored for players, since movement will load only the chunk the player enters anyways and avoids loading massive amounts of surrounding chunks due to large AABB lookups. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 874dddc5d70dc149c272855a98ed858867dd2bb6..7da08dd7c2396ae1048d857bfae4fee2a9f3b4d9 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -80,6 +80,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0c51f90c103600be8881f204bdd18fb12e0ef11c..a1597b45c93a70bb5308985040f2bd19cef5325c 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -807,6 +807,7 @@ public abstract class PlayerList { + entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); + // CraftBukkit end + ++ worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper + while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { + entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index bded403c87c2dfe4bcaab21be56e7b120efb112a..1aaebe236255f19cf4798ab1dce3493e703bcb7e 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -165,6 +165,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne private CraftEntity bukkitEntity; PlayerChunkMap.EntityTracker tracker; // Paper @@ -25,11 +37,11 @@ index 874dddc5d70dc149c272855a98ed858867dd2bb6..7da08dd7c2396ae1048d857bfae4fee2 Throwable addedToWorldStack; // Paper - entity debug public CraftEntity getBukkitEntity() { if (bukkitEntity == null) { -diff --git a/src/main/java/net/minecraft/server/ICollisionAccess.java b/src/main/java/net/minecraft/server/ICollisionAccess.java -index 7bb0843d76864fc10575532745eb63f9ca478354..25e54a1fadc5d31fb250a3f47524b4f345fc8cc6 100644 ---- a/src/main/java/net/minecraft/server/ICollisionAccess.java -+++ b/src/main/java/net/minecraft/server/ICollisionAccess.java -@@ -46,7 +46,9 @@ public interface ICollisionAccess extends IBlockAccess { +diff --git a/src/main/java/net/minecraft/world/level/ICollisionAccess.java b/src/main/java/net/minecraft/world/level/ICollisionAccess.java +index fcf6cc86e3b5d9afe3ab3b3fba2ec13846ed0b4c..fcb3e2f9dea97138e0fd4cd2eb11b54799e1d3b5 100644 +--- a/src/main/java/net/minecraft/world/level/ICollisionAccess.java ++++ b/src/main/java/net/minecraft/world/level/ICollisionAccess.java +@@ -54,7 +54,9 @@ public interface ICollisionAccess extends IBlockAccess { } default boolean b(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate) { @@ -39,23 +51,11 @@ index 7bb0843d76864fc10575532745eb63f9ca478354..25e54a1fadc5d31fb250a3f47524b4f3 } Stream c(@Nullable Entity entity, AxisAlignedBB axisalignedbb, Predicate predicate); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index bd8d2e60a1d0609d03978328b44516a18a0d2553..73a29023767e6452cd263564c9bce3fb52e93312 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -732,6 +732,7 @@ public abstract class PlayerList { - entityplayer1.forceSetPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); - // CraftBukkit end - -+ worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper - while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { - entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); - } -diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -index 4967d1ebd109c462a322e4829d01ff519d1b5366..ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -@@ -9,13 +9,13 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java +index fa3421c9cd8531618827627e9c524a8df77c4c58..1fe6aba0884755be3382d38cebfdd1916bd9180e 100644 +--- a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java +@@ -21,13 +21,13 @@ import net.minecraft.world.phys.shapes.VoxelShapes; public class VoxelShapeSpliterator extends AbstractSpliterator { @Nullable @@ -72,7 +72,7 @@ index 4967d1ebd109c462a322e4829d01ff519d1b5366..ed0f3ddbcb7d6ce8a59ae3829f4cb11a private boolean h; private final BiPredicate i; -@@ -52,23 +52,37 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { +@@ -64,23 +64,37 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { boolean a(Consumer consumer) { while (true) { if (this.d.a()) { @@ -119,11 +119,11 @@ index 4967d1ebd109c462a322e4829d01ff519d1b5366..ed0f3ddbcb7d6ce8a59ae3829f4cb11a if (!this.i.test(iblockdata, this.e) || l == 1 && !iblockdata.d() || l == 2 && !iblockdata.a(Blocks.MOVING_PISTON)) { continue; -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 881cea7c466f29ff4a89db28d104e8500a548b1f..dd91a57f994f1c23464f5e33ca332529d7d9ea19 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -239,7 +239,8 @@ public final class VoxelShapes { +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index cf32a4f63e8e59535c02a3f9c57f98833a2b0e83..24ecac40625629b0bbe460e7fc984b147ede1f1f 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -249,7 +249,8 @@ public final class VoxelShapes { if (k2 < 3) { blockposition_mutableblockposition.a(enumaxiscycle1, i2, j2, l1); diff --git a/Spigot-Server-Patches/0426-Don-t-tick-dead-players.patch b/Spigot-Server-Patches/0426-Don-t-tick-dead-players.patch index cea3c23e61..a40344e8a5 100644 --- a/Spigot-Server-Patches/0426-Don-t-tick-dead-players.patch +++ b/Spigot-Server-Patches/0426-Don-t-tick-dead-players.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Don't tick dead players Causes sync chunk loads and who knows what all else. This is safe because Spectators are skipped in unloaded chunks too in vanilla. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index e60dac038e8a414a45f8dab465d722ee3fb5ef54..cfccab0b33dfa387fdab09ad51d518d42b1b5775 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -480,7 +480,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 8c91e44252366445ad393221825ec9c2591a9490..dace185f5945d05abdb6fa2be361dcb0c6e3d84a 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -607,7 +607,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void playerTick() { try { diff --git a/Spigot-Server-Patches/0427-Dead-Player-s-shouldn-t-be-able-to-move.patch b/Spigot-Server-Patches/0427-Dead-Player-s-shouldn-t-be-able-to-move.patch index 4afd86bbd8..1d6b7f7fe4 100644 --- a/Spigot-Server-Patches/0427-Dead-Player-s-shouldn-t-be-able-to-move.patch +++ b/Spigot-Server-Patches/0427-Dead-Player-s-shouldn-t-be-able-to-move.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Dead Player's shouldn't be able to move This fixes a lot of game state issues where packets were delayed for processing due to 1.15's new queue but processed while dead. -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index eecf72651a1981288eddadfe9ff802cfe2b2e4b6..26f78d0acdd1d6a7914799a96346480df6c66034 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -952,7 +952,7 @@ public abstract class EntityHuman extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 6dc1d03e755cd4c268de71ebba7e771a640938c2..4a2d2c9f4066d9fd1198b21f0d0f1a7a84e50069 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -1046,7 +1046,7 @@ public abstract class EntityHuman extends EntityLiving { @Override protected boolean isFrozen() { diff --git a/Spigot-Server-Patches/0428-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch b/Spigot-Server-Patches/0428-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch index 051fd52f89..8939cff436 100644 --- a/Spigot-Server-Patches/0428-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch +++ b/Spigot-Server-Patches/0428-Optimize-PlayerChunkMap-memory-use-for-visibleChunks.patch @@ -56,24 +56,11 @@ index 0000000000000000000000000000000000000000..f6ff4d8132a95895680f5bc81f8f873e + return clone; + } +} -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1f4776f6f2debb4e000440ed8e47e3e063202850..475e35a5d3f25929e60ef34d7f41e2db193443ef 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -756,7 +756,7 @@ public class ChunkProviderServer extends IChunkProvider { - entityPlayer.playerNaturallySpawnedEvent.callEvent(); - }; - // Paper end -- this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... -+ this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping - Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); - - if (optional.isPresent()) { diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index c470c6527b214026c230feaae0c0875c86dea673..df3150072fd36dac28d83309e50342c9cfa326b3 100644 +index 2489a29e344145f3ce4ff3c9fe08d6ee64a47acb..9999f4efd39668bfd900c7db75a19ff6b95d359c 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -599,7 +599,7 @@ public final class MCUtil { +@@ -606,7 +606,7 @@ public final class MCUtil { WorldServer world = ((org.bukkit.craftbukkit.CraftWorld)bukkitWorld).getHandle(); PlayerChunkMap chunkMap = world.getChunkProvider().playerChunkMap; @@ -82,11 +69,24 @@ index c470c6527b214026c230feaae0c0875c86dea673..df3150072fd36dac28d83309e50342c9 ChunkMapDistance chunkMapDistance = chunkMap.chunkDistanceManager; List allChunks = new ArrayList<>(visibleChunks.values()); List players = world.players; -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3879f520f 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -58,8 +58,33 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 071151b774564f25ad08f47a8ffd67434d5bf940..841c6ef5c7147f32d3fab26e1062a92b05bac355 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -778,7 +778,7 @@ public class ChunkProviderServer extends IChunkProvider { + entityPlayer.playerNaturallySpawnedEvent.callEvent(); + }; + // Paper end +- this.playerChunkMap.f().forEach((playerchunk) -> { // Paper - no... just no... ++ this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping + Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); + + if (optional.isPresent()) { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 8d8d2ac73b3e8d5fb59245bfe551a6985870dec9..a057fb945f9562c52ce5dada26933aefa14e569f 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -102,8 +102,33 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private static final Logger LOGGER = LogManager.getLogger(); public static final int GOLDEN_TICKET = 33 + ChunkStatus.b(); @@ -122,7 +122,7 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 private final Long2ObjectLinkedOpenHashMap pendingUnload; final LongSet loadedChunks; // Paper - private -> package public final WorldServer world; -@@ -132,7 +157,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -176,7 +201,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i, boolean flag) { super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); @@ -131,7 +131,7 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 this.pendingUnload = new Long2ObjectLinkedOpenHashMap(); this.loadedChunks = new LongOpenHashSet(); this.unloadQueue = new LongOpenHashSet(); -@@ -224,9 +249,52 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -268,9 +293,52 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return (PlayerChunk) this.updatingChunks.get(i); } @@ -185,7 +185,7 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 } protected IntSupplier c(long i) { -@@ -414,8 +482,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -458,8 +526,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper end protected void save(boolean flag) { @@ -196,7 +196,7 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 MutableBoolean mutableboolean = new MutableBoolean(); do { -@@ -443,7 +512,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -487,7 +556,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // this.i(); // Paper - nuke IOWorker PlayerChunkMap.LOGGER.info("ThreadedAnvilChunkStorage ({}): All chunks are saved", this.w.getName()); } else { @@ -205,7 +205,7 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 IChunkAccess ichunkaccess = (IChunkAccess) playerchunk.getChunkSave().getNow(null); // CraftBukkit - decompile error if (ichunkaccess instanceof ProtoChunkExtension || ichunkaccess instanceof Chunk) { -@@ -614,7 +683,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -658,7 +727,20 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { if (!this.updatingChunksModified) { return false; } else { @@ -227,7 +227,7 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 this.updatingChunksModified = false; return true; } -@@ -1085,12 +1167,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1129,12 +1211,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } protected Iterable f() { @@ -243,26 +243,18 @@ index 9600ded94f127da50e05129aa00e5b0979b973a3..2622e418cde9f70e38e8d28d7dfde5c3 while (objectbidirectionaliterator.hasNext()) { Entry entry = (Entry) objectbidirectionaliterator.next(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 1d76bf1045cd27e70c115ba490ceb5854b996604..c11f6e647957c353e78f6331de74264079566e1b 100644 +index cc15f27759771c0d839dcc7118ed898cf3617619..da3c7aaf6c2732450ac365c11a1fd7b70db0513d 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -74,6 +74,7 @@ import net.minecraft.server.GroupDataEntity; - import net.minecraft.server.IBlockData; - import net.minecraft.server.IChunkAccess; - import net.minecraft.server.IRegistry; -+import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; - import net.minecraft.server.MinecraftServer; - import net.minecraft.server.MovingObjectPosition; -@@ -295,6 +296,7 @@ public class CraftWorld implements World { +@@ -294,6 +294,7 @@ public class CraftWorld implements World { return ret; } public int getTileEntityCount() { -+ return MCUtil.ensureMain(() -> { ++ return net.minecraft.server.MCUtil.ensureMain(() -> { // We don't use the full world tile entity list, so we must iterate chunks Long2ObjectLinkedOpenHashMap chunks = world.getChunkProvider().playerChunkMap.visibleChunks; int size = 0; -@@ -306,11 +308,13 @@ public class CraftWorld implements World { +@@ -305,11 +306,13 @@ public class CraftWorld implements World { size += chunk.tileEntities.size(); } return size; @@ -272,11 +264,11 @@ index 1d76bf1045cd27e70c115ba490ceb5854b996604..c11f6e647957c353e78f6331de742640 return world.tileEntityListTick.size(); } public int getChunkCount() { -+ return MCUtil.ensureMain(() -> { ++ return net.minecraft.server.MCUtil.ensureMain(() -> { int ret = 0; for (PlayerChunk chunkHolder : world.getChunkProvider().playerChunkMap.visibleChunks.values()) { -@@ -319,7 +323,7 @@ public class CraftWorld implements World { +@@ -318,7 +321,7 @@ public class CraftWorld implements World { } } @@ -285,7 +277,7 @@ index 1d76bf1045cd27e70c115ba490ceb5854b996604..c11f6e647957c353e78f6331de742640 } public int getPlayerCount() { return world.players.size(); -@@ -444,6 +448,14 @@ public class CraftWorld implements World { +@@ -443,6 +446,14 @@ public class CraftWorld implements World { @Override public Chunk[] getLoadedChunks() { @@ -298,5 +290,5 @@ index 1d76bf1045cd27e70c115ba490ceb5854b996604..c11f6e647957c353e78f6331de742640 + } + // Paper end Long2ObjectLinkedOpenHashMap chunks = world.getChunkProvider().playerChunkMap.visibleChunks; - return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.server.Chunk::getBukkitChunk).toArray(Chunk[]::new); + return chunks.values().stream().map(PlayerChunk::getFullChunk).filter(Objects::nonNull).map(net.minecraft.world.level.chunk.Chunk::getBukkitChunk).toArray(Chunk[]::new); } diff --git a/Spigot-Server-Patches/0429-Increase-Light-Queue-Size.patch b/Spigot-Server-Patches/0429-Increase-Light-Queue-Size.patch index cf618562dd..24363b1b20 100644 --- a/Spigot-Server-Patches/0429-Increase-Light-Queue-Size.patch +++ b/Spigot-Server-Patches/0429-Increase-Light-Queue-Size.patch @@ -28,10 +28,10 @@ index 6c8e9d498c9a30a1aa88494ba09c3cae012a8fa1..cd248eb6be663e8be33f2c3c6b06b77b + } } diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f625ed0ac4a1740c2b0fdf2a7e6b92fdcfdb1dce..0f38b3acb8d40bc4753275045db5861945865b35 100644 +index 928a801493003e3ab034f65ac501f5b7e1cb6c75..dcd5a3ec07e2269cb86e7feb706b738bcf1abe56 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -657,7 +657,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { ++ midTickLoadChunks(); // will only do loads since we are still considered !canSleepForTick + return !this.canOversleep(); + }); + isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); +@@ -1307,13 +1326,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); if (optional.isPresent()) { -@@ -780,6 +782,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -802,6 +804,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.timings.chunkTicks.startTiming(); // Spigot // Paper this.world.a(chunk, k); this.world.timings.chunkTicks.stopTiming(); // Spigot // Paper @@ -92,7 +183,7 @@ index 475e35a5d3f25929e60ef34d7f41e2db193443ef..1f63cdd9588a8dda1f04154f4d9de21f } } } -@@ -936,6 +939,41 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -958,6 +961,41 @@ public class ChunkProviderServer extends IChunkProvider { super.executeTask(runnable); } @@ -134,102 +225,11 @@ index 475e35a5d3f25929e60ef34d7f41e2db193443ef..1f63cdd9588a8dda1f04154f4d9de21f @Override protected boolean executeNext() { // CraftBukkit start - process pending Chunk loadCallback() and unloadCallback() after each run task -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 0f38b3acb8d40bc4753275045db5861945865b35..2438a50ca1923b028c4848c80248bac61b80d1af 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -937,6 +937,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { -+ midTickLoadChunks(); // will only do loads since we are still considered !canSleepForTick - return !this.canOversleep(); - }); - isOversleep = false;MinecraftTimings.serverOversleep.stopTiming(); -@@ -1200,13 +1219,16 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant(this); // Paper -@@ -177,6 +177,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -304,6 +304,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } // CraftBukkit end @@ -30,7 +30,7 @@ index cb9009aecb76abcf6442fa3b5fc6c3d6e776dfa0..a2f364fb61c4a0a691e1617446c1dfcf private void c(WorldServer worldserver) { BlockPosition blockposition = worldserver.getSpawn(); -@@ -354,7 +355,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -481,7 +482,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { position = Vec3D.a(((WorldServer) world).getSpawn()); } this.world = world; @@ -39,11 +39,11 @@ index cb9009aecb76abcf6442fa3b5fc6c3d6e776dfa0..a2f364fb61c4a0a691e1617446c1dfcf } this.playerInteractManager.a((WorldServer) world); } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 73a29023767e6452cd263564c9bce3fb52e93312..118d50997a31c2b5182d7ba1015f73d739def2f3 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -131,6 +131,8 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index a1597b45c93a70bb5308985040f2bd19cef5325c..3477a006102f4dba3579905551e037fff3cbea06 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -204,6 +204,8 @@ public abstract class PlayerList { worldserver1 = worldserver; } diff --git a/Spigot-Server-Patches/0432-Add-tick-times-API-and-mspt-command.patch b/Spigot-Server-Patches/0432-Add-tick-times-API-and-mspt-command.patch index 9683538bd8..612e6729c9 100644 --- a/Spigot-Server-Patches/0432-Add-tick-times-API-and-mspt-command.patch +++ b/Spigot-Server-Patches/0432-Add-tick-times-API-and-mspt-command.patch @@ -87,10 +87,10 @@ index ddbc8cb712c50038922eded75dd6ca85fe851078..78271b400c79578d043b20a5389a37b1 version = getInt("config-version", 20); set("config-version", 20); diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 2438a50ca1923b028c4848c80248bac61b80d1af..2285612851d28c8cae31fc5f99584e6434450d80 100644 +index cbec7410fcbd81bc0958bb3e94d0beacd392e46b..88679e7fa760e242c81466f90950d1f6f088e294 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -109,6 +109,11 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0, "cannot deserialize nothing"); + + try { -+ NBTTagCompound compound = net.minecraft.server.NBTCompressedStreamTools.readNBT( ++ NBTTagCompound compound = net.minecraft.nbt.NBTCompressedStreamTools.readNBT( + new java.io.ByteArrayInputStream(data) + ); + int dataVersion = compound.getInt("DataVersion"); + + Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); + Dynamic converted = DataConverterRegistry.getDataFixer().update(DataConverterTypes.ITEM_STACK, new Dynamic(DynamicOpsNBT.a, compound), dataVersion, getDataVersion()); -+ return CraftItemStack.asCraftMirror(net.minecraft.server.ItemStack.fromCompound((NBTTagCompound) converted.getValue())); ++ return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.fromCompound((NBTTagCompound) converted.getValue())); + } catch (IOException ex) { + com.destroystokyo.paper.util.SneakyThrow.sneaky(ex); + throw new RuntimeException(); diff --git a/Spigot-Server-Patches/0435-Remove-streams-from-Mob-AI-System.patch b/Spigot-Server-Patches/0435-Remove-streams-from-Mob-AI-System.patch index 3df2a800cd..4937798620 100644 --- a/Spigot-Server-Patches/0435-Remove-streams-from-Mob-AI-System.patch +++ b/Spigot-Server-Patches/0435-Remove-streams-from-Mob-AI-System.patch @@ -9,12 +9,12 @@ replace them with the standard iterator. Also optimise the stream.anyMatch statement to move to a bitset where we can replace the call with a single bitwise operation. -diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index b132cb42da9a733e46fe9059258db7b77f811b3b..42b690b9215d82346990d93a5cead727b1fa10ab 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoal.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +index b505c23c57a4b84faf5906c6295455b4720c4426..5c32cbe81c47fcb9ae347faa6fc007c5d28d79bf 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java @@ -1,10 +1,12 @@ - package net.minecraft.server; + package net.minecraft.world.entity.ai.goal; +import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector import java.util.EnumSet; @@ -52,12 +52,12 @@ index b132cb42da9a733e46fe9059258db7b77f811b3b..42b690b9215d82346990d93a5cead727 } public static enum Type { -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 2926c98d1f94a4879d21ba7b507755b0573fb05a..3343e2df9dd8a66fd7678ce13000177d1f3b564b 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +index 8c234c09a4d9ada83e36e3cdbcc1f2f5c6202f28..385cd079e264a7e66e91ab3b70b90afb59688dcd 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java @@ -1,8 +1,10 @@ - package net.minecraft.server; + package net.minecraft.world.entity.ai.goal; +import com.destroystokyo.paper.util.set.OptimizedSmallEnumSet; // Paper - remove streams from pathfindergoalselector import com.google.common.collect.Sets; @@ -67,7 +67,7 @@ index 2926c98d1f94a4879d21ba7b507755b0573fb05a..3343e2df9dd8a66fd7678ce13000177d import java.util.Map; import java.util.Set; import java.util.function.Supplier; -@@ -27,7 +29,8 @@ public class PathfinderGoalSelector { +@@ -28,7 +30,8 @@ public class PathfinderGoalSelector { private final Map c = new EnumMap(PathfinderGoal.Type.class); private final Set d = Sets.newLinkedHashSet(); private Set getTasks() { return d; }// Paper - OBFHELPER private final Supplier e; @@ -77,7 +77,7 @@ index 2926c98d1f94a4879d21ba7b507755b0573fb05a..3343e2df9dd8a66fd7678ce13000177d private int g = 3;private int getTickRate() { return g; } // Paper - OBFHELPER private int curRate;private int getCurRate() { return curRate; } private void incRate() { this.curRate++; } // Paper TODO -@@ -55,35 +58,38 @@ public class PathfinderGoalSelector { +@@ -56,35 +59,38 @@ public class PathfinderGoalSelector { // Paper end public void a(PathfinderGoal pathfindergoal) { @@ -138,7 +138,7 @@ index 2926c98d1f94a4879d21ba7b507755b0573fb05a..3343e2df9dd8a66fd7678ce13000177d this.c.forEach((pathfindergoal_type, pathfindergoalwrapped) -> { if (!pathfindergoalwrapped.g()) { this.c.remove(pathfindergoal_type); -@@ -92,30 +98,58 @@ public class PathfinderGoalSelector { +@@ -93,30 +99,58 @@ public class PathfinderGoalSelector { }); gameprofilerfiller.exit(); gameprofilerfiller.enter("goalUpdate"); @@ -219,7 +219,7 @@ index 2926c98d1f94a4879d21ba7b507755b0573fb05a..3343e2df9dd8a66fd7678ce13000177d gameprofilerfiller.exit(); } -@@ -124,11 +158,11 @@ public class PathfinderGoalSelector { +@@ -125,11 +159,11 @@ public class PathfinderGoalSelector { } public void a(PathfinderGoal.Type pathfindergoal_type) { @@ -233,10 +233,10 @@ index 2926c98d1f94a4879d21ba7b507755b0573fb05a..3343e2df9dd8a66fd7678ce13000177d } public void a(PathfinderGoal.Type pathfindergoal_type, boolean flag) { -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index f3df10587e652d3a26d15deb09304b97a727cd88..22773eca7561d39cd838338efe6d40ab9421feba 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java +index 7bb531e47668cf445083c4dedb03ccafe6a9c96b..8c8e39d35fb56aa6cf7d456adab01dff5d13a60d 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java @@ -59,9 +59,10 @@ public class PathfinderGoalWrapped extends PathfinderGoal { this.a.a(enumset); } diff --git a/Spigot-Server-Patches/0436-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch b/Spigot-Server-Patches/0436-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch index 47061b0b6b..ac75ee4835 100644 --- a/Spigot-Server-Patches/0436-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch +++ b/Spigot-Server-Patches/0436-Delay-unsafe-actions-until-after-entity-ticking-is-d.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Delay unsafe actions until after entity ticking is done This will help prevent many cases of unregistering entities during entity ticking -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1096ecf62127ad92dfed3872dbf6053c13975c94..1c1dceb98413ccb24e3111435119b3b8c1b760c4 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -66,6 +66,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 3825e05025b42a38d6e473b75a90475f0c62585f..2d01ae0fa137ad414a9a9b6c0864a713fed93e17 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -175,6 +175,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { public final List players = Lists.newArrayList(); // Paper - private -> public public final ChunkProviderServer chunkProvider; // Paper - public boolean tickingEntities; @@ -26,7 +26,7 @@ index 1096ecf62127ad92dfed3872dbf6053c13975c94..1c1dceb98413ccb24e3111435119b3b8 private final MinecraftServer server; public final WorldDataServer worldDataServer; // CraftBukkit - type public boolean savingDisabled; -@@ -533,6 +543,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -642,6 +652,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { timings.entityTick.stopTiming(); // Spigot this.tickingEntities = false; diff --git a/Spigot-Server-Patches/0437-Async-command-map-building.patch b/Spigot-Server-Patches/0437-Async-command-map-building.patch index fea0b75504..98feab5870 100644 --- a/Spigot-Server-Patches/0437-Async-command-map-building.patch +++ b/Spigot-Server-Patches/0437-Async-command-map-building.patch @@ -4,11 +4,11 @@ Date: Wed, 8 Apr 2020 02:42:14 -0500 Subject: [PATCH] Async command map building -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 3a91513951f635b82d3d612c29e78f9f1db4860d..4b1ea9bc39191e01f83577c7bad128cf1ab9612f 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -244,6 +244,14 @@ public class CommandDispatcher { +diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java +index ddbd4c43bbe6d6a5b90f4958c4be80520a40beab..ca33ec8da544272ecf708b0cc1b0123eabc48a8b 100644 +--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java ++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java +@@ -327,6 +327,14 @@ public class CommandDispatcher { if ( org.spigotmc.SpigotConfig.tabComplete < 0 ) return; // Spigot // CraftBukkit start // Register Vanilla commands into builtRoot as before @@ -23,7 +23,7 @@ index 3a91513951f635b82d3d612c29e78f9f1db4860d..4b1ea9bc39191e01f83577c7bad128cf Map, CommandNode> map = Maps.newIdentityHashMap(); // Use identity to prevent aliasing issues RootCommandNode vanillaRoot = new RootCommandNode(); -@@ -261,7 +269,14 @@ public class CommandDispatcher { +@@ -344,7 +352,14 @@ public class CommandDispatcher { for (CommandNode node : rootcommandnode.getChildren()) { bukkit.add(node.getName()); } diff --git a/Spigot-Server-Patches/0438-Improved-Watchdog-Support.patch b/Spigot-Server-Patches/0438-Improved-Watchdog-Support.patch index e695c96f13..4c14097e53 100644 --- a/Spigot-Server-Patches/0438-Improved-Watchdog-Support.patch +++ b/Spigot-Server-Patches/0438-Improved-Watchdog-Support.patch @@ -58,10 +58,10 @@ index 0b9e689d57705965721b5c55bc45d36657f360e4..dee00aac05f1acf050f05d4db557a08d // Many servers tend to restart at a fixed time at xx:00 which causes an uneven distribution of requests on the // bStats backend. To circumvent this problem, we introduce some randomness into the initial and second delay. -diff --git a/src/main/java/net/minecraft/server/CrashReport.java b/src/main/java/net/minecraft/server/CrashReport.java -index 95e6a6de7ccfc4445d0ac19c5f874c0d533b1712..cc6e6f245ee5e73bd570cf42381bf55ee0b364d3 100644 ---- a/src/main/java/net/minecraft/server/CrashReport.java -+++ b/src/main/java/net/minecraft/server/CrashReport.java +diff --git a/src/main/java/net/minecraft/CrashReport.java b/src/main/java/net/minecraft/CrashReport.java +index d0fdb9ce57b22a1f582cddec9afcc35b75d58cc6..9b7a51890c667601b195ff15b2bf0d6c76c7f19f 100644 +--- a/src/main/java/net/minecraft/CrashReport.java ++++ b/src/main/java/net/minecraft/CrashReport.java @@ -257,6 +257,7 @@ public class CrashReport { } @@ -70,53 +70,23 @@ index 95e6a6de7ccfc4445d0ac19c5f874c0d533b1712..cc6e6f245ee5e73bd570cf42381bf55e while (throwable instanceof CompletionException && throwable.getCause() != null) { throwable = throwable.getCause(); } -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index a4db2527ff2defcfd25f08dd24722a37794a4a7e..f5792b999ce42acb13ae9a62ceb2ddec39abe209 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -240,7 +240,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - long j = SystemUtils.getMonotonicNanos() - i; - String s = String.format(Locale.ROOT, "%.3fs", (double) j / 1.0E9D); - -- DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); -+ //DedicatedServer.LOGGER.info("Done ({})! For help, type \"help\"", s); // Paper moved to after init - if (dedicatedserverproperties.announcePlayerAchievements != null) { - ((GameRules.GameRuleBoolean) this.getGameRules().get(GameRules.ANNOUNCE_ADVANCEMENTS)).a(dedicatedserverproperties.announcePlayerAchievements, (MinecraftServer) this); - } -@@ -368,6 +368,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - //this.remoteStatusListener.b(); // Paper - don't wait for remote connections - } - -+ hasFullyShutdown = true; // Paper - System.exit(0); // CraftBukkit +diff --git a/src/main/java/net/minecraft/SystemUtils.java b/src/main/java/net/minecraft/SystemUtils.java +index c7cbf132bfcb5c5e49b269ebfe5ef9a049ff327f..5523615d8cb69f1c6d7207a928d9d9702d2aa1f4 100644 +--- a/src/main/java/net/minecraft/SystemUtils.java ++++ b/src/main/java/net/minecraft/SystemUtils.java +@@ -129,6 +129,7 @@ public class SystemUtils { + return SystemUtils.f; } -@@ -701,7 +702,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - @Override - public void stop() { - super.stop(); -- SystemUtils.h(); -+ //SystemUtils.h(); // Paper - moved into super - } - - @Override -diff --git a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -index bc15da4640a4a6107c9c186a01ce76df87511b41..27db247aa40e0516302c74b9bf00c631a8607af5 100644 ---- a/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -+++ b/src/main/java/net/minecraft/server/IAsyncTaskHandler.java -@@ -135,6 +135,7 @@ public abstract class IAsyncTaskHandler implements Mailbox S a(Function function) { AtomicReference atomicreference = new AtomicReference(); Thread thread = new Thread(() -> { -@@ -733,6 +735,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { CompletableFuture completablefuture; -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 118d50997a31c2b5182d7ba1015f73d739def2f3..c7d44b1242943f2d0a78614c7bae4840fb41e8f4 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -428,7 +428,7 @@ public abstract class PlayerList { - cserver.getPluginManager().callEvent(playerQuitEvent); - entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); - -- entityplayer.playerTick(); // SPIGOT-924 -+ if (server.isMainThread()) entityplayer.playerTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog) - // CraftBukkit end - - // Paper start - Remove from collideRule team if needed -diff --git a/src/main/java/net/minecraft/server/SystemUtils.java b/src/main/java/net/minecraft/server/SystemUtils.java -index 1fe1df445ba56b2f176ee25502a774aa0a7bd00b..916a6a1fc1ccc73e4fb974ad77310d16fd8bd7e6 100644 ---- a/src/main/java/net/minecraft/server/SystemUtils.java -+++ b/src/main/java/net/minecraft/server/SystemUtils.java -@@ -123,6 +123,7 @@ public class SystemUtils { - return SystemUtils.f; - } - -+ public static void shutdownServerThreadPool() { h(); } // Paper - OBFHELPER - public static void h() { - a(SystemUtils.e); - a(SystemUtils.f); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 4da88ce31cfb8baa6fa68c0115edadac0c5b2fba..d26fd68b2abd4907138ce77a6e6bb45c9af4af02 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -798,6 +798,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - gameprofilerfiller.exit(); - } catch (Throwable throwable) { -+ if (throwable instanceof ThreadDeath) throw throwable; // Paper - // Paper start - Prevent tile entity and entity crashes - String msg = "TileEntity threw exception at " + tileentity.world.getWorld().getName() + ":" + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ(); - System.err.println(msg); -@@ -872,6 +873,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - try { - consumer.accept(entity); - } catch (Throwable throwable) { -+ if (throwable instanceof ThreadDeath) throw throwable; // Paper - // Paper start - Prevent tile entity and entity crashes - String msg = "Entity threw exception at " + entity.world.getWorld().getName() + ":" + entity.locX() + "," + entity.locY() + "," + entity.locZ(); - System.err.println(msg); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 3c72c156ca488e14604cb0db5f1ac4e068776066..e0f66718f3700f5f4bdb77178e05ca3fc95829e8 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -65,7 +65,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 2d01ae0fa137ad414a9a9b6c0864a713fed93e17..b294337a586193870fcdbfe1697703137f4ae626 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -174,7 +174,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { private final Queue entitiesToAdd = Queues.newArrayDeque(); public final List players = Lists.newArrayList(); // Paper - private -> public public final ChunkProviderServer chunkProvider; // Paper - public @@ -344,8 +299,53 @@ index 3c72c156ca488e14604cb0db5f1ac4e068776066..e0f66718f3700f5f4bdb77178e05ca3f // Paper start List afterEntityTickingTasks = Lists.newArrayList(); public void doIfNotEntityTicking(java.lang.Runnable run) { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 3477a006102f4dba3579905551e037fff3cbea06..53261da8b7f0c7a59cacc48636d6c9d707ce372e 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -503,7 +503,7 @@ public abstract class PlayerList { + cserver.getPluginManager().callEvent(playerQuitEvent); + entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); + +- entityplayer.playerTick(); // SPIGOT-924 ++ if (server.isMainThread()) entityplayer.playerTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog) + // CraftBukkit end + + // Paper start - Remove from collideRule team if needed +diff --git a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +index ca23ca14d8011fc8daa7e20f2eaa550a8ff92c53..158ea6d77698d62ba795aff6c061a80652e42e03 100644 +--- a/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java ++++ b/src/main/java/net/minecraft/util/thread/IAsyncTaskHandler.java +@@ -135,6 +135,7 @@ public abstract class IAsyncTaskHandler implements Mailbox 0 && new File( split[0] ).isFile() ) diff --git a/src/main/java/org/spigotmc/WatchdogThread.java b/src/main/java/org/spigotmc/WatchdogThread.java -index 9c1fc19851817a842779ab89bc9300e1adf3d2a2..ae8903ee1decd22e2ad6138f29fbc757b807e0a7 100644 +index 58e50bf0fb0f309227e1f4c1f6bb11c01d8e08d3..30a665c090f419985e1d0f49df9e8d110c83943a 100644 --- a/src/main/java/org/spigotmc/WatchdogThread.java +++ b/src/main/java/org/spigotmc/WatchdogThread.java @@ -13,6 +13,7 @@ import org.bukkit.Bukkit; diff --git a/Spigot-Server-Patches/0439-Optimize-Pathfinding.patch b/Spigot-Server-Patches/0439-Optimize-Pathfinding.patch index 1da0ea4236..851493eac5 100644 --- a/Spigot-Server-Patches/0439-Optimize-Pathfinding.patch +++ b/Spigot-Server-Patches/0439-Optimize-Pathfinding.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Optimize Pathfinding Prevents pathfinding from spamming failures for things such as arrow attacks. -diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java -index 64b991859f0f3ca7d932b8acc8aeed401e22a388..1558c5f8256f50be6850f1d7f70eee3e8ec76496 100644 ---- a/src/main/java/net/minecraft/server/NavigationAbstract.java -+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java -@@ -11,7 +11,7 @@ public abstract class NavigationAbstract { +diff --git a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +index ab469f1698b4f0e36c0d077472f1adea36f95ce9..795224a31142bebbe1b62ae00c3c098617e21f6c 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/ai/navigation/NavigationAbstract.java +@@ -31,7 +31,7 @@ public abstract class NavigationAbstract { protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER protected final World b; @Nullable @@ -19,7 +19,7 @@ index 64b991859f0f3ca7d932b8acc8aeed401e22a388..1558c5f8256f50be6850f1d7f70eee3e protected double d; protected int e; protected int f; -@@ -163,10 +163,30 @@ public abstract class NavigationAbstract { +@@ -183,10 +183,30 @@ public abstract class NavigationAbstract { return this.a(this.a(d0, d1, d2, 1), d3); } diff --git a/Spigot-Server-Patches/0441-Remove-streams-from-PairedQueue.patch b/Spigot-Server-Patches/0441-Remove-streams-from-PairedQueue.patch index a0ba9fe4c5..f1a9a0128a 100644 --- a/Spigot-Server-Patches/0441-Remove-streams-from-PairedQueue.patch +++ b/Spigot-Server-Patches/0441-Remove-streams-from-PairedQueue.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Remove streams from PairedQueue We shouldn't be doing stream calls just to see if the queue is empty. This creates loads of garbage thanks to how often it's called. -diff --git a/src/main/java/net/minecraft/server/PairedQueue.java b/src/main/java/net/minecraft/server/PairedQueue.java -index 85bb22e4b7376b676139048f2d55684e27a54055..2369afb4f37863c5c59456e46c48ad0d32f9eeb7 100644 ---- a/src/main/java/net/minecraft/server/PairedQueue.java -+++ b/src/main/java/net/minecraft/server/PairedQueue.java +diff --git a/src/main/java/net/minecraft/util/thread/PairedQueue.java b/src/main/java/net/minecraft/util/thread/PairedQueue.java +index 024b414aae32c8ad32bdf031361257fc74b80eb3..56c9efa78ceeac499182eb401e605a60dad12182 100644 +--- a/src/main/java/net/minecraft/util/thread/PairedQueue.java ++++ b/src/main/java/net/minecraft/util/thread/PairedQueue.java @@ -20,32 +20,30 @@ public interface PairedQueue { public static final class a implements PairedQueue { diff --git a/Spigot-Server-Patches/0442-Reduce-memory-footprint-of-NBTTagCompound.patch b/Spigot-Server-Patches/0442-Reduce-memory-footprint-of-NBTTagCompound.patch index 07e5f32b13..2df9f26fb1 100644 --- a/Spigot-Server-Patches/0442-Reduce-memory-footprint-of-NBTTagCompound.patch +++ b/Spigot-Server-Patches/0442-Reduce-memory-footprint-of-NBTTagCompound.patch @@ -7,19 +7,19 @@ Fastutil maps are going to have a lower memory footprint - which is important because we clone chunk data after reading it for safety. So, reduce the impact of the clone on GC. -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 9c445902e6adc05773497bc4444203ca364e4f5c..8dd91ddf9e1489ec035452c590cbd59afa44c18f 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -20,6 +20,7 @@ import java.util.Set; - import java.util.UUID; - import java.util.regex.Pattern; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +index 2e862122fd4596c26318aac3b12165970a1660f8..e37c82c3af7c0fea9c85f7bc8d7a4df648e723ff 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -26,6 +26,7 @@ import net.minecraft.ReportedException; + import net.minecraft.network.chat.ChatComponentText; + import net.minecraft.network.chat.IChatBaseComponent; + import net.minecraft.network.chat.IChatMutableComponent; +import it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap; // Paper import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -41,7 +42,7 @@ public class NBTTagCompound implements NBTBase { +@@ -47,7 +48,7 @@ public class NBTTagCompound implements NBTBase { if (i > 512) { throw new RuntimeException("Tried to read NBT tag with too high complexity, depth > 512"); } else { @@ -28,7 +28,7 @@ index 9c445902e6adc05773497bc4444203ca364e4f5c..8dd91ddf9e1489ec035452c590cbd59a byte b0; -@@ -77,7 +78,7 @@ public class NBTTagCompound implements NBTBase { +@@ -83,7 +84,7 @@ public class NBTTagCompound implements NBTBase { } public NBTTagCompound() { @@ -37,7 +37,7 @@ index 9c445902e6adc05773497bc4444203ca364e4f5c..8dd91ddf9e1489ec035452c590cbd59a } @Override -@@ -409,9 +410,17 @@ public class NBTTagCompound implements NBTBase { +@@ -415,9 +416,17 @@ public class NBTTagCompound implements NBTBase { @Override public NBTTagCompound clone() { diff --git a/Spigot-Server-Patches/0443-Prevent-opening-inventories-when-frozen.patch b/Spigot-Server-Patches/0443-Prevent-opening-inventories-when-frozen.patch index bc839cbf57..a82e1504cf 100644 --- a/Spigot-Server-Patches/0443-Prevent-opening-inventories-when-frozen.patch +++ b/Spigot-Server-Patches/0443-Prevent-opening-inventories-when-frozen.patch @@ -4,11 +4,11 @@ Date: Mon, 13 Apr 2020 07:31:44 +0100 Subject: [PATCH] Prevent opening inventories when frozen -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index a2f364fb61c4a0a691e1617446c1dfcf997753fb..e858a8fe2f4be485dd18f753c30c7d58d4ce93db 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -431,7 +431,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 438b73982ce79732273148985f36c4c531e48389..c9c18fa9dffc3f53213f46cfdf582dccb85d308a 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -558,7 +558,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { containerUpdateDelay = world.paperConfig.containerUpdateTickRate; } // Paper end @@ -17,7 +17,7 @@ index a2f364fb61c4a0a691e1617446c1dfcf997753fb..e858a8fe2f4be485dd18f753c30c7d58 this.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.CANT_USE); // Paper this.activeContainer = this.defaultContainer; } -@@ -1270,7 +1270,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -1397,7 +1397,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } else { // CraftBukkit start this.activeContainer = container; @@ -26,7 +26,7 @@ index a2f364fb61c4a0a691e1617446c1dfcf997753fb..e858a8fe2f4be485dd18f753c30c7d58 // CraftBukkit end container.addSlotListener(this); return OptionalInt.of(this.containerCounter); -@@ -2071,7 +2071,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -2198,7 +2198,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { } @Override @@ -36,7 +36,7 @@ index a2f364fb61c4a0a691e1617446c1dfcf997753fb..e858a8fe2f4be485dd18f753c30c7d58 } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java -index a0c3600f7523d43e4e4eff7a574bf0fd9350899e..a2b0e01529646f7b0feabf9803bcaac5f5508cc3 100644 +index 2ca9d061ec951fb0563959620f0e99590e3038af..35ede7760ee5f0b28f9b52443f663498f8a21c0c 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftHumanEntity.java @@ -321,7 +321,7 @@ public class CraftHumanEntity extends CraftLivingEntity implements HumanEntity { diff --git a/Spigot-Server-Patches/0444-Optimise-ArraySetSorted-removeIf.patch b/Spigot-Server-Patches/0444-Optimise-ArraySetSorted-removeIf.patch index 529f78279c..1ff7b9b2f9 100644 --- a/Spigot-Server-Patches/0444-Optimise-ArraySetSorted-removeIf.patch +++ b/Spigot-Server-Patches/0444-Optimise-ArraySetSorted-removeIf.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Optimise ArraySetSorted#removeIf Remove iterator allocation and ensure the call is always O(n) -diff --git a/src/main/java/net/minecraft/server/ArraySetSorted.java b/src/main/java/net/minecraft/server/ArraySetSorted.java -index 85f799a713db0c822d46b689010f9f6bd43f5280..7db6b5850b91588eb4d91f0d7e8b5dbbcb95b7cb 100644 ---- a/src/main/java/net/minecraft/server/ArraySetSorted.java -+++ b/src/main/java/net/minecraft/server/ArraySetSorted.java +diff --git a/src/main/java/net/minecraft/util/ArraySetSorted.java b/src/main/java/net/minecraft/util/ArraySetSorted.java +index 427daa94322f47b4eaf881d85a01fed239db549a..936a90272579f78832eff93f2a81d673feb669c1 100644 +--- a/src/main/java/net/minecraft/util/ArraySetSorted.java ++++ b/src/main/java/net/minecraft/util/ArraySetSorted.java @@ -10,8 +10,8 @@ import java.util.NoSuchElementException; public class ArraySetSorted extends AbstractSet { diff --git a/Spigot-Server-Patches/0445-Don-t-run-entity-collision-code-if-not-needed.patch b/Spigot-Server-Patches/0445-Don-t-run-entity-collision-code-if-not-needed.patch index 1a3519b875..fa4b894eda 100644 --- a/Spigot-Server-Patches/0445-Don-t-run-entity-collision-code-if-not-needed.patch +++ b/Spigot-Server-Patches/0445-Don-t-run-entity-collision-code-if-not-needed.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Don't run entity collision code if not needed Will not run if max entity craming is disabled and the max collisions per entity is less than or equal to 0 -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index ae3787bbdeacbac83b238eac098fcfe1e3b6e448..976e66ca81fe13b6bfede4da46bd45f0274de57f 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2850,10 +2850,16 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 21952ce66729946fb306fd15e9da4a3311551bec..f0782ad11883feaf6ffa0b7bdff6e43e529e47af 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -2943,10 +2943,16 @@ public abstract class EntityLiving extends Entity { protected void doTick() {} protected void collideNearby() { diff --git a/Spigot-Server-Patches/0446-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch b/Spigot-Server-Patches/0446-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch index f88136b208..88984a860c 100644 --- a/Spigot-Server-Patches/0446-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch +++ b/Spigot-Server-Patches/0446-Optimize-ChunkProviderServer-s-chunk-level-checking-.patch @@ -8,11 +8,11 @@ These can be hot functions (i.e entity ticking and block ticking), so inline where possible, and avoid the abstraction of the Either class. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 1f63cdd9588a8dda1f04154f4d9de21fd8224678..174fc04e8cf5bd481b2f3d4e07031dab9ae66d86 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -618,21 +618,29 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 7ef3778eac779f3042116cfa4b4ac9e3752faa98..cd4e4b957c166c6e82b58da61154542232900cf7 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -640,21 +640,29 @@ public class ChunkProviderServer extends IChunkProvider { public final boolean isInEntityTickingChunk(Entity entity) { return this.a(entity); } // Paper - OBFHELPER @Override public boolean a(Entity entity) { diff --git a/Spigot-Server-Patches/0447-Restrict-vanilla-teleport-command-to-valid-locations.patch b/Spigot-Server-Patches/0447-Restrict-vanilla-teleport-command-to-valid-locations.patch index 254217738a..ed7ce57a14 100644 --- a/Spigot-Server-Patches/0447-Restrict-vanilla-teleport-command-to-valid-locations.patch +++ b/Spigot-Server-Patches/0447-Restrict-vanilla-teleport-command-to-valid-locations.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Restrict vanilla teleport command to valid locations Fixes GH-3165, GH-3575 -diff --git a/src/main/java/net/minecraft/server/CommandTeleport.java b/src/main/java/net/minecraft/server/CommandTeleport.java -index 660704394da82c56b11958664d938ebcc6e23be4..57a23dd7a1196402ddc58e7491ac9ada97f402a4 100644 ---- a/src/main/java/net/minecraft/server/CommandTeleport.java -+++ b/src/main/java/net/minecraft/server/CommandTeleport.java -@@ -120,6 +120,12 @@ public class CommandTeleport { +diff --git a/src/main/java/net/minecraft/server/commands/CommandTeleport.java b/src/main/java/net/minecraft/server/commands/CommandTeleport.java +index b59763643def065cd998fa3005523c37973613fd..dcc92b0c9a7a0214a3e803d714c5e7078c17a039 100644 +--- a/src/main/java/net/minecraft/server/commands/CommandTeleport.java ++++ b/src/main/java/net/minecraft/server/commands/CommandTeleport.java +@@ -142,6 +142,12 @@ public class CommandTeleport { private static void a(CommandListenerWrapper commandlistenerwrapper, Entity entity, WorldServer worldserver, double d0, double d1, double d2, Set set, float f, float f1, @Nullable CommandTeleport.a commandteleport_a) throws CommandSyntaxException { BlockPosition blockposition = new BlockPosition(d0, d1, d2); diff --git a/Spigot-Server-Patches/0448-Implement-Player-Client-Options-API.patch b/Spigot-Server-Patches/0448-Implement-Player-Client-Options-API.patch index f03a70903b..0750c2cc8d 100644 --- a/Spigot-Server-Patches/0448-Implement-Player-Client-Options-API.patch +++ b/Spigot-Server-Patches/0448-Implement-Player-Client-Options-API.patch @@ -84,53 +84,11 @@ index 0000000000000000000000000000000000000000..b6f4400df3d8ec7e06a996de54f8cabb + .toString(); + } +} -diff --git a/src/main/java/net/minecraft/server/EntityHuman.java b/src/main/java/net/minecraft/server/EntityHuman.java -index 26f78d0acdd1d6a7914799a96346480df6c66034..cc2127b26e41182c14fa95afde878e9b5100a117 100644 ---- a/src/main/java/net/minecraft/server/EntityHuman.java -+++ b/src/main/java/net/minecraft/server/EntityHuman.java -@@ -36,7 +36,7 @@ public abstract class EntityHuman extends EntityLiving { - private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); - private static final DataWatcherObject c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); - private static final DataWatcherObject d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); -- protected static final DataWatcherObject bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); -+ protected static final DataWatcherObject bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject getSkinPartsWatcher() { return bi; } // Paper - OBFHELPER - protected static final DataWatcherObject bj = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); - protected static final DataWatcherObject bk = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); - protected static final DataWatcherObject bl = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index e858a8fe2f4be485dd18f753c30c7d58d4ce93db..9030b76ca6b9dd2bf3f6baa003f68d8b43f3741e 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -2,6 +2,7 @@ package net.minecraft.server; - - import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent; - import com.google.common.collect.Lists; -+import com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent; // Paper - import com.mojang.authlib.GameProfile; - import com.mojang.datafixers.util.Either; - import com.mojang.serialization.DataResult; -@@ -62,7 +63,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public int lastSentExp = -99999999; - public int invulnerableTicks = 60; - private EnumChatVisibility bY; -- private boolean bZ = true; -+ private boolean bZ = true; public boolean hasChatColorsEnabled() { return this.bZ; } // Paper - OBFHELPER - private long ca = SystemUtils.getMonotonicMillis(); - private Entity spectatedEntity; - public boolean worldChangeInvuln; -@@ -1672,6 +1673,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null - public java.util.Locale adventure$locale = java.util.Locale.US; // Paper - public void a(PacketPlayInSettings packetplayinsettings) { -+ new PlayerClientOptionsChangeEvent(getBukkitEntity(), packetplayinsettings.locale, packetplayinsettings.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packetplayinsettings.getChatVisibility().name()), packetplayinsettings.hasChatColorsEnabled(), new com.destroystokyo.paper.PaperSkinParts(packetplayinsettings.getSkinParts()), packetplayinsettings.getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT).callEvent(); // Paper - settings event - // CraftBukkit start - if (getMainHand() != packetplayinsettings.getMainHand()) { - PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); -diff --git a/src/main/java/net/minecraft/server/PacketPlayInSettings.java b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -index dbc3552d50c4129e1844c8a379ab5ba396645f52..87ec3987d4b6de836016e91ef90383e3e5bb2d16 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayInSettings.java -+++ b/src/main/java/net/minecraft/server/PacketPlayInSettings.java -@@ -37,14 +37,17 @@ public class PacketPlayInSettings implements Packet { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java +index 90842b27f64afcdd8eb7d0e52df8cfcb418b5b5a..f47cd43f96f61475bd1d5da11bdbc7c5e5f7e1bc 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayInSettings.java +@@ -41,14 +41,17 @@ public class PacketPlayInSettings implements Packet { packetlistenerplayin.a(this); } @@ -148,8 +106,50 @@ index dbc3552d50c4129e1844c8a379ab5ba396645f52..87ec3987d4b6de836016e91ef90383e3 public int f() { return this.e; } +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index c9c18fa9dffc3f53213f46cfdf582dccb85d308a..b3df6032d42ac7f933d3843b7cd758219590b985 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -2,6 +2,7 @@ package net.minecraft.server.level; + + import com.destroystokyo.paper.event.entity.PlayerNaturallySpawnCreaturesEvent; + import com.google.common.collect.Lists; ++import com.destroystokyo.paper.event.player.PlayerClientOptionsChangeEvent; // Paper + import com.mojang.authlib.GameProfile; + import com.mojang.datafixers.util.Either; + import com.mojang.serialization.DataResult; +@@ -189,7 +190,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public int lastSentExp = -99999999; + public int invulnerableTicks = 60; + private EnumChatVisibility bY; +- private boolean bZ = true; ++ private boolean bZ = true; public boolean hasChatColorsEnabled() { return this.bZ; } // Paper - OBFHELPER + private long ca = SystemUtils.getMonotonicMillis(); + private Entity spectatedEntity; + public boolean worldChangeInvuln; +@@ -1799,6 +1800,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + public String locale = null; // CraftBukkit - add, lowercase // Paper - default to null + public java.util.Locale adventure$locale = java.util.Locale.US; // Paper + public void a(PacketPlayInSettings packetplayinsettings) { ++ new PlayerClientOptionsChangeEvent(getBukkitEntity(), packetplayinsettings.locale, packetplayinsettings.viewDistance, com.destroystokyo.paper.ClientOption.ChatVisibility.valueOf(packetplayinsettings.getChatVisibility().name()), packetplayinsettings.hasChatColorsEnabled(), new com.destroystokyo.paper.PaperSkinParts(packetplayinsettings.getSkinParts()), packetplayinsettings.getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT).callEvent(); // Paper - settings event + // CraftBukkit start + if (getMainHand() != packetplayinsettings.getMainHand()) { + PlayerChangedMainHandEvent event = new PlayerChangedMainHandEvent(getBukkitEntity(), getMainHand() == EnumMainHand.LEFT ? MainHand.LEFT : MainHand.RIGHT); +diff --git a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +index 4a2d2c9f4066d9fd1198b21f0d0f1a7a84e50069..6ee896113993bf97593d127c341bd8a728c0e43e 100644 +--- a/src/main/java/net/minecraft/world/entity/player/EntityHuman.java ++++ b/src/main/java/net/minecraft/world/entity/player/EntityHuman.java +@@ -130,7 +130,7 @@ public abstract class EntityHuman extends EntityLiving { + private static final Map b = ImmutableMap.builder().put(EntityPose.STANDING, EntityHuman.bh).put(EntityPose.SLEEPING, EntityHuman.ah).put(EntityPose.FALL_FLYING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SWIMMING, EntitySize.b(0.6F, 0.6F)).put(EntityPose.SPIN_ATTACK, EntitySize.b(0.6F, 0.6F)).put(EntityPose.CROUCHING, EntitySize.b(0.6F, 1.5F)).put(EntityPose.DYING, EntitySize.c(0.2F, 0.2F)).build(); + private static final DataWatcherObject c = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.c); + private static final DataWatcherObject d = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.b); +- protected static final DataWatcherObject bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); ++ protected static final DataWatcherObject bi = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); public static DataWatcherObject getSkinPartsWatcher() { return bi; } // Paper - OBFHELPER + protected static final DataWatcherObject bj = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.a); + protected static final DataWatcherObject bk = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); + protected static final DataWatcherObject bl = DataWatcher.a(EntityHuman.class, DataWatcherRegistry.p); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 24cdf63dfdc222edb9677dbf62f1761a138b2a83..890b5c4ee2a1313d75cf069d660de62af81badcf 100644 +index 3b7be01513f9851b50585fca2e7e2f21e03ca253..ebdb72c7967cd0091a47c1634be011cd81b555f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -1,5 +1,8 @@ diff --git a/Spigot-Server-Patches/0449-Fix-Chunk-Post-Processing-deadlock-risk.patch b/Spigot-Server-Patches/0449-Fix-Chunk-Post-Processing-deadlock-risk.patch index f44d11c439..7ff3e14239 100644 --- a/Spigot-Server-Patches/0449-Fix-Chunk-Post-Processing-deadlock-risk.patch +++ b/Spigot-Server-Patches/0449-Fix-Chunk-Post-Processing-deadlock-risk.patch @@ -24,11 +24,11 @@ the executor so that the mailbox ChunkQueue is now considered empty. This successfully fixed a reoccurring and highly reproduceable crash for heightmaps. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 174fc04e8cf5bd481b2f3d4e07031dab9ae66d86..75500aaae0dc44f0da3b4d5ed94da6fef9f96c38 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -994,6 +994,7 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index cd4e4b957c166c6e82b58da61154542232900cf7..0d093c4babc16493185eac8069ab2cfb4a2d6787 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -1016,6 +1016,7 @@ public class ChunkProviderServer extends IChunkProvider { return super.executeNext() || execChunkTask; // Paper } } finally { @@ -36,11 +36,11 @@ index 174fc04e8cf5bd481b2f3d4e07031dab9ae66d86..75500aaae0dc44f0da3b4d5ed94da6fe playerChunkMap.callbackExecutor.run(); } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index feb0c8f3dec62cd4cdfeede6047ef40bc69ce240..356147a09c4aa027480804d9edcca21dc3d85b78 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -135,6 +135,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index b69caa785b39f6d1aa55b42ab96b0e5740e6b5e5..5b9011fa9cf9fd023c1b64a0d6eecfc424747ef4 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -179,6 +179,8 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; // CraftBukkit end @@ -49,7 +49,7 @@ index feb0c8f3dec62cd4cdfeede6047ef40bc69ce240..356147a09c4aa027480804d9edcca21d // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); -@@ -1000,7 +1002,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1044,7 +1046,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return Either.left(chunk); }); }, (runnable) -> { diff --git a/Spigot-Server-Patches/0450-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/Spigot-Server-Patches/0450-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 7fde62fb0c..83e1af8a9c 100644 --- a/Spigot-Server-Patches/0450-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/Spigot-Server-Patches/0450-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Don't crash if player is attempted to be removed from I suspect it deals with teleporting as it uses players current x/y/z -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 706ef10959df897a4b1889c2e2e7ff41ed924876..52a69edcefb72a3908ecd522ef87e7eb989467a6 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java -@@ -239,8 +239,8 @@ public abstract class ChunkMapDistance { +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +index 961257ebc28a8b4753faf3c2d5b6abaea4ffc0dd..60fcea78bf617559114b1ca1c0bf2d4cd9075a8c 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +@@ -245,8 +245,8 @@ public abstract class ChunkMapDistance { ObjectSet objectset = (ObjectSet) this.c.get(i); if (objectset == null) return; // CraftBukkit - SPIGOT-6208 diff --git a/Spigot-Server-Patches/0451-Broadcast-join-message-to-console.patch b/Spigot-Server-Patches/0451-Broadcast-join-message-to-console.patch index 117e6d6602..51a9411f69 100644 --- a/Spigot-Server-Patches/0451-Broadcast-join-message-to-console.patch +++ b/Spigot-Server-Patches/0451-Broadcast-join-message-to-console.patch @@ -4,11 +4,11 @@ Date: Fri, 17 Apr 2020 00:15:23 +0100 Subject: [PATCH] Broadcast join message to console -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index c7d44b1242943f2d0a78614c7bae4840fb41e8f4..34246ba0f8a50f732f2ff863f8a824f8573fee83 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -209,7 +209,9 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 53261da8b7f0c7a59cacc48636d6c9d707ce372e..d06d31207ce724a6318a87a37d26a7e30372aa22 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -284,7 +284,9 @@ public abstract class PlayerList { if (jm != null && !jm.equals(net.kyori.adventure.text.Component.empty())) { // Paper - Adventure joinMessage = PaperAdventure.asVanilla(jm); // Paper - Adventure diff --git a/Spigot-Server-Patches/0452-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch b/Spigot-Server-Patches/0452-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch index 22bd3d5051..d1bb4a55bf 100644 --- a/Spigot-Server-Patches/0452-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch +++ b/Spigot-Server-Patches/0452-Fix-Longstanding-Broken-behavior-of-PlayerJoinEvent.patch @@ -27,11 +27,11 @@ This was very non deterministic. This change will ensure every plugin receives a deterministic result, and should no longer require 1 tick delays anymore. -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 9030b76ca6b9dd2bf3f6baa003f68d8b43f3741e..50ffd62534793596017368423b11cd5a94950009 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -111,6 +111,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index b3df6032d42ac7f933d3843b7cd758219590b985..9ef603805019a7582f1b8f16a4a85a31ffbd8212 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -238,6 +238,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public double maxHealthCache; public boolean joining = true; public boolean sentListPacket = false; @@ -39,11 +39,11 @@ index 9030b76ca6b9dd2bf3f6baa003f68d8b43f3741e..50ffd62534793596017368423b11cd5a public Integer clientViewDistance; // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 356147a09c4aa027480804d9edcca21dc3d85b78..429355e5790148e2e061f67e44f0c8f96855f7c5 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1539,6 +1539,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 5b9011fa9cf9fd023c1b64a0d6eecfc424747ef4..21cf7390e4564b28a25b2d28932b697bbf7d0e15 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -1583,6 +1583,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { .printStackTrace(); return; } @@ -51,11 +51,11 @@ index 356147a09c4aa027480804d9edcca21dc3d85b78..429355e5790148e2e061f67e44f0c8f9 // Paper end if (!(entity instanceof EntityComplexPart)) { EntityTypes entitytypes = entity.getEntityType(); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 34246ba0f8a50f732f2ff863f8a824f8573fee83..5222382bc572ffa5a9e3274c522f1f956a27e732 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -197,6 +197,12 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index d06d31207ce724a6318a87a37d26a7e30372aa22..12de64d34f5011771a5515710839f60098f56ad8 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -272,6 +272,12 @@ public abstract class PlayerList { this.j.put(entityplayer.getUniqueID(), entityplayer); // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[]{entityplayer})); // CraftBukkit - replaced with loop below @@ -68,7 +68,7 @@ index 34246ba0f8a50f732f2ff863f8a824f8573fee83..5222382bc572ffa5a9e3274c522f1f95 // CraftBukkit start PlayerJoinEvent playerJoinEvent = new org.bukkit.event.player.PlayerJoinEvent(cserver.getPlayer(entityplayer), PaperAdventure.asAdventure(chatmessage)); // Paper - Adventure cserver.getPluginManager().callEvent(playerJoinEvent); -@@ -232,6 +238,8 @@ public abstract class PlayerList { +@@ -307,6 +313,8 @@ public abstract class PlayerList { entityplayer.playerConnection.sendPacket(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.ADD_PLAYER, new EntityPlayer[] { entityplayer1})); } entityplayer.sentListPacket = true; @@ -76,8 +76,8 @@ index 34246ba0f8a50f732f2ff863f8a824f8573fee83..5222382bc572ffa5a9e3274c522f1f95 + ((WorldServer)entityplayer.world).getChunkProvider().playerChunkMap.addEntity(entityplayer); // Paper - track entity now // CraftBukkit end - entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.datawatcher, true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn -@@ -257,6 +265,11 @@ public abstract class PlayerList { + entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityMetadata(entityplayer.getId(), entityplayer.getDataWatcher(), true)); // CraftBukkit - BungeeCord#2321, send complete data to self on spawn +@@ -332,6 +340,11 @@ public abstract class PlayerList { playerconnection.sendPacket(new PacketPlayOutEntityEffect(entityplayer.getId(), mobeffect)); } @@ -89,7 +89,7 @@ index 34246ba0f8a50f732f2ff863f8a824f8573fee83..5222382bc572ffa5a9e3274c522f1f95 if (nbttagcompound != null && nbttagcompound.hasKeyOfType("RootVehicle", 10)) { NBTTagCompound nbttagcompound1 = nbttagcompound.getCompound("RootVehicle"); // CraftBukkit start -@@ -305,6 +318,10 @@ public abstract class PlayerList { +@@ -380,6 +393,10 @@ public abstract class PlayerList { } } diff --git a/Spigot-Server-Patches/0453-Load-Chunks-for-Login-Asynchronously.patch b/Spigot-Server-Patches/0453-Load-Chunks-for-Login-Asynchronously.patch index fb58019fcb..95ae0638c5 100644 --- a/Spigot-Server-Patches/0453-Load-Chunks-for-Login-Asynchronously.patch +++ b/Spigot-Server-Patches/0453-Load-Chunks-for-Login-Asynchronously.patch @@ -4,11 +4,11 @@ Date: Sun, 19 Apr 2020 04:28:29 -0400 Subject: [PATCH] Load Chunks for Login Asynchronously -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 75500aaae0dc44f0da3b4d5ed94da6fef9f96c38..322d0a7d127878ba49362454808b82172acf1600 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -604,7 +604,7 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0d093c4babc16493185eac8069ab2cfb4a2d6787..9e1b2c6466edff3cfeb3bf8172f4589d2cb712ad 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -626,7 +626,7 @@ public class ChunkProviderServer extends IChunkProvider { return this.serverThreadQueue.executeNext(); } @@ -17,24 +17,11 @@ index 75500aaae0dc44f0da3b4d5ed94da6fef9f96c38..322d0a7d127878ba49362454808b8217 boolean flag = this.chunkMapDistance.a(this.playerChunkMap); boolean flag1 = this.playerChunkMap.b(); -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 7da08dd7c2396ae1048d857bfae4fee2a9f3b4d9..1ed26fa55b149e3717cf190abde8f865a4c076eb 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1283,7 +1283,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - this.lastY = d1; - this.lastZ = d4; - this.setPosition(d3, d1, d4); -- world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit -+ if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper - } - - public void d(Vec3D vec3d) { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 50ffd62534793596017368423b11cd5a94950009..05483a9c5b8f77959fb44532f506e268b1676acd 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -46,6 +46,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 9ef603805019a7582f1b8f16a4a85a31ffbd8212..3c75a74292858ccff0357fb11a92673ae6a5129b 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -173,6 +173,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private static final Logger LOGGER = LogManager.getLogger(); public PlayerConnection playerConnection; @@ -42,7 +29,7 @@ index 50ffd62534793596017368423b11cd5a94950009..05483a9c5b8f77959fb44532f506e268 public final MinecraftServer server; public final PlayerInteractManager playerInteractManager; public final Deque removeQueue = new ArrayDeque<>(); // Paper -@@ -112,6 +113,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -239,6 +240,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public boolean joining = true; public boolean sentListPacket = false; public boolean supressTrackerForLogin = false; // Paper @@ -50,11 +37,23 @@ index 50ffd62534793596017368423b11cd5a94950009..05483a9c5b8f77959fb44532f506e268 public Integer clientViewDistance; // CraftBukkit end public PlayerNaturallySpawnCreaturesEvent playerNaturallySpawnedEvent; // Paper -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index e5790c2aeaa380a3acc26434f5de78ac746c6d57..bdd4766976902e11411728e6faa93b7e43a7ba22 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -68,7 +68,7 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index 218dc900e125a11548485887b1918742072c7a77..2c932d36f982e7f8713aabff9a6c631055810366 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -21,6 +21,7 @@ public class TicketType { + public static final TicketType FORCED = a("forced", Comparator.comparingLong(ChunkCoordIntPair::pair)); + public static final TicketType LIGHT = a("light", Comparator.comparingLong(ChunkCoordIntPair::pair)); + public static final TicketType PORTAL = a("portal", BaseBlockPosition::compareTo, 300); ++ public static final TicketType LOGIN = a("login", Long::compareTo, 100); // Paper + public static final TicketType POST_TELEPORT = a("post_teleport", Integer::compareTo, 5); + public static final TicketType UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); + public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 98ae77269b5aaad951b0e26da61e6f5eb7ec2818..6bfb703ffafd707fb83743abc7d1bfbb96f867f1 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -86,7 +86,7 @@ public class LoginListener implements PacketLoginInListener { } // Paper end } else if (this.g == LoginListener.EnumProtocolState.DELAY_ACCEPT) { @@ -63,7 +62,7 @@ index e5790c2aeaa380a3acc26434f5de78ac746c6d57..bdd4766976902e11411728e6faa93b7e if (entityplayer == null) { this.g = LoginListener.EnumProtocolState.READY_TO_ACCEPT; -@@ -167,7 +167,7 @@ public class LoginListener implements PacketLoginInListener { +@@ -185,7 +185,7 @@ public class LoginListener implements PacketLoginInListener { } this.networkManager.sendPacket(new PacketLoginOutSuccess(this.i)); @@ -72,11 +71,11 @@ index e5790c2aeaa380a3acc26434f5de78ac746c6d57..bdd4766976902e11411728e6faa93b7e if (entityplayer != null) { this.g = LoginListener.EnumProtocolState.DELAY_ACCEPT; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 8fbafc6057a6062cbc222239e542a1bffc4fc09e..d525f4b783bc3bff180c9dbc31750f5bc061a7fb 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -76,6 +76,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 31fb6eda544568b14255aede0a981d065bdf3aee..8bfc26eb12cc5523c64a210383c9156aef6883b3 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -220,6 +220,7 @@ public class PlayerConnection implements PacketListenerPlayIn { private static final Logger LOGGER = LogManager.getLogger(); public final NetworkManager networkManager; private final MinecraftServer minecraftServer; @@ -84,7 +83,7 @@ index 8fbafc6057a6062cbc222239e542a1bffc4fc09e..d525f4b783bc3bff180c9dbc31750f5b public EntityPlayer player; private int e; private long lastKeepAlive = SystemUtils.getMonotonicMillis(); private void setLastPing(long lastPing) { this.lastKeepAlive = lastPing;}; private long getLastPing() { return this.lastKeepAlive;}; // Paper - OBFHELPER -@@ -154,6 +155,15 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -298,6 +299,15 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit end public void tick() { @@ -100,7 +99,7 @@ index 8fbafc6057a6062cbc222239e542a1bffc4fc09e..d525f4b783bc3bff180c9dbc31750f5b this.syncPosition(); this.player.lastX = this.player.locX(); this.player.lastY = this.player.locY(); -@@ -195,7 +205,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -339,7 +349,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.r = null; this.D = false; this.E = 0; @@ -109,11 +108,11 @@ index 8fbafc6057a6062cbc222239e542a1bffc4fc09e..d525f4b783bc3bff180c9dbc31750f5b this.minecraftServer.getMethodProfiler().enter("keepAlive"); // Paper Start - give clients a longer time to respond to pings as per pre 1.12.2 timings -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24db542ae91 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -51,11 +51,12 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 12de64d34f5011771a5515710839f60098f56ad8..beb18eb9e7e37020ebd7bb03e9a65e090dcfdb4b 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -124,11 +124,12 @@ public abstract class PlayerList { private static final SimpleDateFormat g = new SimpleDateFormat("yyyy-MM-dd 'at' HH:mm:ss z"); private final MinecraftServer server; public final List players = new java.util.concurrent.CopyOnWriteArrayList(); // CraftBukkit - ArrayList -> CopyOnWriteArrayList: Iterator safety @@ -127,7 +126,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d // CraftBukkit start // private final Map o; // private final Map p; -@@ -94,6 +95,11 @@ public abstract class PlayerList { +@@ -167,6 +168,11 @@ public abstract class PlayerList { } public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { @@ -139,7 +138,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d entityplayer.loginTime = System.currentTimeMillis(); // Paper GameProfile gameprofile = entityplayer.getProfile(); UserCache usercache = this.server.getUserCache(); -@@ -107,7 +113,7 @@ public abstract class PlayerList { +@@ -180,7 +186,7 @@ public abstract class PlayerList { if (nbttagcompound != null && nbttagcompound.hasKey("bukkit")) { NBTTagCompound bukkit = nbttagcompound.getCompound("bukkit"); s = bukkit.hasKeyOfType("lastKnownName", 8) ? bukkit.getString("lastKnownName") : s; @@ -148,7 +147,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d // CraftBukkit end if (nbttagcompound != null) { -@@ -180,6 +186,51 @@ public abstract class PlayerList { +@@ -255,6 +261,51 @@ public abstract class PlayerList { entityplayer.getRecipeBook().a(entityplayer); this.sendScoreboard(worldserver1.getScoreboard(), entityplayer); this.server.invalidatePingSample(); @@ -200,7 +199,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d ChatMessage chatmessage; if (entityplayer.getProfile().getName().equalsIgnoreCase(s)) { -@@ -417,6 +468,7 @@ public abstract class PlayerList { +@@ -492,6 +543,7 @@ public abstract class PlayerList { protected void savePlayerFile(EntityPlayer entityplayer) { if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit @@ -208,7 +207,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d this.playerFileData.save(entityplayer); ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit -@@ -444,7 +496,7 @@ public abstract class PlayerList { +@@ -519,7 +571,7 @@ public abstract class PlayerList { } PlayerQuitEvent playerQuitEvent = new PlayerQuitEvent(cserver.getPlayer(entityplayer), net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, com.destroystokyo.paper.PaperConfig.useDisplayNameInQuit ? entityplayer.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(entityplayer.getName()))); @@ -217,7 +216,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d entityplayer.getBukkitEntity().disconnect(playerQuitEvent.getQuitMessage()); if (server.isMainThread()) entityplayer.playerTick(); // SPIGOT-924 // Paper - don't tick during emergency shutdowns (Watchdog) -@@ -497,6 +549,13 @@ public abstract class PlayerList { +@@ -572,6 +624,13 @@ public abstract class PlayerList { // this.p.remove(uuid); // CraftBukkit end } @@ -231,7 +230,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d // CraftBukkit start // this.sendAll(new PacketPlayOutPlayerInfo(PacketPlayOutPlayerInfo.EnumPlayerInfoAction.REMOVE_PLAYER, new EntityPlayer[]{entityplayer})); -@@ -514,7 +573,7 @@ public abstract class PlayerList { +@@ -589,7 +648,7 @@ public abstract class PlayerList { cserver.getScoreboardManager().removePlayer(entityplayer.getBukkitEntity()); // CraftBukkit end @@ -240,7 +239,7 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d } // CraftBukkit start - Whole method, SocketAddress to LoginListener, added hostname to signature, return EntityPlayer -@@ -533,6 +592,13 @@ public abstract class PlayerList { +@@ -608,6 +667,13 @@ public abstract class PlayerList { list.add(entityplayer); } } @@ -254,15 +253,16 @@ index 5222382bc572ffa5a9e3274c522f1f956a27e732..f1cd31c4ccc1566327041b9b8469f24d Iterator iterator = list.iterator(); -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 8055f5998213ab1c6c10d03d88d2b14d220a5e40..d7b9d9fd3a3b607278a3d72b0b306b0be2aa30ad 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -17,6 +17,7 @@ public class TicketType { - public static final TicketType FORCED = a("forced", Comparator.comparingLong(ChunkCoordIntPair::pair)); - public static final TicketType LIGHT = a("light", Comparator.comparingLong(ChunkCoordIntPair::pair)); - public static final TicketType PORTAL = a("portal", BaseBlockPosition::compareTo, 300); -+ public static final TicketType LOGIN = a("login", Long::compareTo, 100); // Paper - public static final TicketType POST_TELEPORT = a("post_teleport", Integer::compareTo, 5); - public static final TicketType UNKNOWN = a("unknown", Comparator.comparingLong(ChunkCoordIntPair::pair), 1); - public static final TicketType PLUGIN = a("plugin", (a, b) -> 0); // CraftBukkit +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 1aaebe236255f19cf4798ab1dce3493e703bcb7e..84c2488a432f2c306567dd4576dd522efcf073ef 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1368,7 +1368,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + this.lastY = d1; + this.lastZ = d4; + this.setPosition(d3, d1, d4); +- world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit ++ if (valid) world.getChunkAt((int) Math.floor(this.locX()) >> 4, (int) Math.floor(this.locZ()) >> 4); // CraftBukkit // Paper + } + + public void d(Vec3D vec3d) { diff --git a/Spigot-Server-Patches/0454-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch b/Spigot-Server-Patches/0454-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch index 81231cc508..7bafff07e0 100644 --- a/Spigot-Server-Patches/0454-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch +++ b/Spigot-Server-Patches/0454-Move-player-to-spawn-point-if-spawn-in-unloaded-worl.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Move player to spawn point if spawn in unloaded world The code following this has better support for null worlds to move them back to the world spawn. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9fa4425dc0e308f3cce06cb8ca5b02a08e505176..d88470e6dc0316d0a5f5a50a9644d71aedadee6e 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1719,9 +1719,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 84c2488a432f2c306567dd4576dd522efcf073ef..4766bdb3ff915cac2eb38870a5357441bc64b99a 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1804,9 +1804,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne bworld = server.getWorld(worldName); } diff --git a/Spigot-Server-Patches/0455-Add-PlayerAttackEntityCooldownResetEvent.patch b/Spigot-Server-Patches/0455-Add-PlayerAttackEntityCooldownResetEvent.patch index 6b12e1b902..4c7b733d3d 100644 --- a/Spigot-Server-Patches/0455-Add-PlayerAttackEntityCooldownResetEvent.patch +++ b/Spigot-Server-Patches/0455-Add-PlayerAttackEntityCooldownResetEvent.patch @@ -4,11 +4,11 @@ Date: Thu, 26 Mar 2020 19:44:50 -0700 Subject: [PATCH] Add PlayerAttackEntityCooldownResetEvent -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 976e66ca81fe13b6bfede4da46bd45f0274de57f..29baae49888f030d136e99c44a5a55494606e471 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -1837,7 +1837,16 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index f0782ad11883feaf6ffa0b7bdff6e43e529e47af..a0060264c3f31ab499d44d1055403af8eca07fff 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -1930,7 +1930,16 @@ public abstract class EntityLiving extends Entity { EntityDamageEvent event = CraftEventFactory.handleLivingEntityDamageEvent(this, damagesource, originalDamage, hardHatModifier, blockingModifier, armorModifier, resistanceModifier, magicModifier, absorptionModifier, hardHat, blocking, armor, resistance, magic, absorption); if (damagesource.getEntity() instanceof EntityHuman) { diff --git a/Spigot-Server-Patches/0456-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch b/Spigot-Server-Patches/0456-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch index a5569406f5..0bf0d830d8 100644 --- a/Spigot-Server-Patches/0456-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch +++ b/Spigot-Server-Patches/0456-Allow-multiple-callbacks-to-schedule-for-Callback-Ex.patch @@ -13,11 +13,11 @@ Use an ArrayDeque to store this Queue We make sure to also implement a pattern that is recursion safe too. -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 429355e5790148e2e061f67e44f0c8f96855f7c5..06124c8799846fd236f7ac1cad04e79bd30fc44c 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -114,24 +114,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 21cf7390e4564b28a25b2d28932b697bbf7d0e15..c6a66273cc14dbb8c02e96a6eb9ea64e540b4ec5 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -158,24 +158,32 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final CallbackExecutor callbackExecutor = new CallbackExecutor(); public static final class CallbackExecutor implements java.util.concurrent.Executor, Runnable { diff --git a/Spigot-Server-Patches/0457-Don-t-fire-BlockFade-on-worldgen-threads.patch b/Spigot-Server-Patches/0457-Don-t-fire-BlockFade-on-worldgen-threads.patch index 4a08e01665..f8f76985c2 100644 --- a/Spigot-Server-Patches/0457-Don-t-fire-BlockFade-on-worldgen-threads.patch +++ b/Spigot-Server-Patches/0457-Don-t-fire-BlockFade-on-worldgen-threads.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Don't fire BlockFade on worldgen threads Caused a deadlock -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index 4716f366342a3ef70d0ea50e3747786fad1e3573..e5d75a8a93ffe7bc3747b48210eea6189a956d54 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java -@@ -73,6 +73,7 @@ public class BlockFire extends BlockFireAbstract { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java +index d2d59cc1acc7f67de62ac8d765f2b6b491b69053..f940d93c5bceb4b130a40c1cde06ab8d2e82cd74 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java +@@ -93,6 +93,7 @@ public class BlockFire extends BlockFireAbstract { @Override public IBlockData updateState(IBlockData iblockdata, EnumDirection enumdirection, IBlockData iblockdata1, GeneratorAccess generatoraccess, BlockPosition blockposition, BlockPosition blockposition1) { // CraftBukkit start @@ -17,7 +17,7 @@ index 4716f366342a3ef70d0ea50e3747786fad1e3573..e5d75a8a93ffe7bc3747b48210eea618 if (!this.canPlace(iblockdata, generatoraccess, blockposition)) { // Suppress during worldgen if (!(generatoraccess instanceof World)) { -@@ -88,7 +89,7 @@ public class BlockFire extends BlockFireAbstract { +@@ -108,7 +109,7 @@ public class BlockFire extends BlockFireAbstract { return blockState.getHandle(); } } diff --git a/Spigot-Server-Patches/0458-Add-phantom-creative-and-insomniac-controls.patch b/Spigot-Server-Patches/0458-Add-phantom-creative-and-insomniac-controls.patch index 68e7f4dd05..8c1972d3fb 100644 --- a/Spigot-Server-Patches/0458-Add-phantom-creative-and-insomniac-controls.patch +++ b/Spigot-Server-Patches/0458-Add-phantom-creative-and-insomniac-controls.patch @@ -20,23 +20,11 @@ index cd248eb6be663e8be33f2c3c6b06b77b6d5753a4..46ac6d91422423f1e03b86d3efa3241f + phantomOnlyAttackInsomniacs = getBoolean("phantoms-only-attack-insomniacs", phantomOnlyAttackInsomniacs); + } } -diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java -index 1afcf17a8ca4eb17125e2a9d066c5a15a3818417..3a70900c73e3a6c4f40cf74406534f4bfd3eb67b 100644 ---- a/src/main/java/net/minecraft/server/EntityPhantom.java -+++ b/src/main/java/net/minecraft/server/EntityPhantom.java -@@ -225,6 +225,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { - EntityHuman entityhuman = (EntityHuman) iterator.next(); - - if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) { -+ if (!world.paperConfig.phantomOnlyAttackInsomniacs || IEntitySelector.isInsomniac.test(entityhuman)) // Paper - EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason - return true; - } -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 3913af9e27139538114580f7967cbf990d9307f7..56fc1777401ab0fbebbbaf21f33f63c078dc9505 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -26,6 +26,7 @@ public final class IEntitySelector { +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +index 1a6f8aec32af85717f5d56e0b00a02cda88ce028..88ed99d0d08fb5f3fee605f8ed00004b466633bf 100644 +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -31,6 +31,7 @@ public final class IEntitySelector { public static final Predicate g = (entity) -> { return !entity.isSpectator(); }; @@ -44,11 +32,23 @@ index 3913af9e27139538114580f7967cbf990d9307f7..56fc1777401ab0fbebbbaf21f33f63c0 // Paper start public static final Predicate affectsSpawning = (entity) -> { -diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -index 2e3d8d78c7a2b6c9a76c3446f8532137c537c79c..4e3f01bc79b6ed2a322155f29f1d0dcf298c8b82 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java -@@ -32,7 +32,7 @@ public class MobSpawnerPhantom implements MobSpawner { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java +index bdb0a9541b4f167b95578034ec15e7051a7721be..93ea08af4fa221521ae89eaccefac0e3d50f6f5e 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityPhantom.java +@@ -261,6 +261,7 @@ public class EntityPhantom extends EntityFlying implements IMonster { + EntityHuman entityhuman = (EntityHuman) iterator.next(); + + if (EntityPhantom.this.a((EntityLiving) entityhuman, PathfinderTargetCondition.a)) { ++ if (!world.paperConfig.phantomOnlyAttackInsomniacs || IEntitySelector.isInsomniac.test(entityhuman)) // Paper + EntityPhantom.this.setGoalTarget(entityhuman, org.bukkit.event.entity.EntityTargetEvent.TargetReason.CLOSEST_PLAYER, true); // CraftBukkit - reason + return true; + } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java +index afbcabca5180e26e85af820ad4ca2de1163b55a1..24299fab240ae5dfae4ba13c9e98760f9eda634e 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/MobSpawnerPhantom.java +@@ -52,7 +52,7 @@ public class MobSpawnerPhantom implements MobSpawner { while (iterator.hasNext()) { EntityHuman entityhuman = (EntityHuman) iterator.next(); diff --git a/Spigot-Server-Patches/0459-Fix-numerous-item-duplication-issues-and-teleport-is.patch b/Spigot-Server-Patches/0459-Fix-numerous-item-duplication-issues-and-teleport-is.patch index 9921d06790..dc332cd5b4 100644 --- a/Spigot-Server-Patches/0459-Fix-numerous-item-duplication-issues-and-teleport-is.patch +++ b/Spigot-Server-Patches/0459-Fix-numerous-item-duplication-issues-and-teleport-is.patch @@ -15,11 +15,11 @@ clean up stage. So even if something NEW comes up, it would be impossible to drop the same item twice because the source was destroyed. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index e4422d7cd70410e50ee9e86d3c832f7df65197df..894ef285638acbae9b340bd6e4511e7143c6999d 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1880,11 +1880,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 4766bdb3ff915cac2eb38870a5357441bc64b99a..b4bf64610bc595bc3ea36410fd878144ed761740 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1965,11 +1965,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } else { // CraftBukkit start - Capture drops for death event if (this instanceof EntityLiving && !((EntityLiving) this).forceDrops) { @@ -34,7 +34,7 @@ index e4422d7cd70410e50ee9e86d3c832f7df65197df..894ef285638acbae9b340bd6e4511e71 entityitem.defaultPickupDelay(); // CraftBukkit start -@@ -2532,6 +2533,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2617,6 +2618,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne @Nullable public Entity teleportTo(WorldServer worldserver, BlockPosition location) { // CraftBukkit end @@ -47,7 +47,7 @@ index e4422d7cd70410e50ee9e86d3c832f7df65197df..894ef285638acbae9b340bd6e4511e71 if (this.world instanceof WorldServer && !this.dead) { this.world.getMethodProfiler().enter("changeDimension"); // CraftBukkit start -@@ -2552,6 +2559,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2637,6 +2644,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne // CraftBukkit end this.world.getMethodProfiler().exitEnter("reloading"); @@ -59,7 +59,7 @@ index e4422d7cd70410e50ee9e86d3c832f7df65197df..894ef285638acbae9b340bd6e4511e71 Entity entity = this.getEntityType().a((World) worldserver); if (entity != null) { -@@ -2565,10 +2577,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2650,10 +2662,6 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne // CraftBukkit start - Forward the CraftEntity to the new entity this.getBukkitEntity().setHandle(entity); entity.bukkitEntity = this.getBukkitEntity(); @@ -70,7 +70,7 @@ index e4422d7cd70410e50ee9e86d3c832f7df65197df..894ef285638acbae9b340bd6e4511e71 // CraftBukkit end } -@@ -2693,7 +2701,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2778,7 +2786,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean canPortal() { @@ -79,11 +79,11 @@ index e4422d7cd70410e50ee9e86d3c832f7df65197df..894ef285638acbae9b340bd6e4511e71 } public float a(Explosion explosion, IBlockAccess iblockaccess, BlockPosition blockposition, IBlockData iblockdata, Fluid fluid, float f) { -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index cd50fe3616d4b33c7ad76458fb75683541c33ae5..97425f38ac05c24433dc27c5cda74c36871d61a9 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -567,7 +567,7 @@ public class EntityArmorStand extends EntityLiving { +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index b93d04cd23a3a3616d1594c69174ea1271a204fb..6c5dc2ee5e720b574557ffbae539ec42dfbfe6cc 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -601,7 +601,7 @@ public class EntityArmorStand extends EntityLiving { for (i = 0; i < this.handItems.size(); ++i) { itemstack = (ItemStack) this.handItems.get(i); if (!itemstack.isEmpty()) { @@ -92,7 +92,7 @@ index cd50fe3616d4b33c7ad76458fb75683541c33ae5..97425f38ac05c24433dc27c5cda74c36 this.handItems.set(i, ItemStack.b); } } -@@ -575,7 +575,7 @@ public class EntityArmorStand extends EntityLiving { +@@ -609,7 +609,7 @@ public class EntityArmorStand extends EntityLiving { for (i = 0; i < this.armorItems.size(); ++i) { itemstack = (ItemStack) this.armorItems.get(i); if (!itemstack.isEmpty()) { @@ -102,7 +102,7 @@ index cd50fe3616d4b33c7ad76458fb75683541c33ae5..97425f38ac05c24433dc27c5cda74c36 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 9ee00daced670accc379f2b87d930751238172d6..57ade60b17472832f33286b7332ca273d835b138 100644 +index eedfc7839be258750d25d942b26e85a032115448..18fd2b60e0a6b8aeb753bf836e220b09c453b069 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -804,7 +804,8 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0460-Implement-Brigadier-Mojang-API.patch b/Spigot-Server-Patches/0460-Implement-Brigadier-Mojang-API.patch index efb6fb3cd5..08911b53c7 100644 --- a/Spigot-Server-Patches/0460-Implement-Brigadier-Mojang-API.patch +++ b/Spigot-Server-Patches/0460-Implement-Brigadier-Mojang-API.patch @@ -9,11 +9,11 @@ Adds AsyncPlayerSendCommandsEvent Adds CommandRegisteredEvent - Allows manipulating the CommandNode to add more children/metadata for the client -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 4b1ea9bc39191e01f83577c7bad128cf1ab9612f..22d748008d24fd6ed7cd8c4914e2ceb378f32c95 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -270,6 +270,7 @@ public class CommandDispatcher { +diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java +index ca33ec8da544272ecf708b0cc1b0123eabc48a8b..77d3712390125601d964519c3df9928ea3a7caf0 100644 +--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java ++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java +@@ -353,6 +353,7 @@ public class CommandDispatcher { bukkit.add(node.getName()); } // Paper start - Async command map building @@ -21,7 +21,7 @@ index 4b1ea9bc39191e01f83577c7bad128cf1ab9612f..22d748008d24fd6ed7cd8c4914e2ceb3 MinecraftServer.getServer().execute(() -> { runSync(entityplayer, bukkit, rootcommandnode); }); -@@ -277,6 +278,7 @@ public class CommandDispatcher { +@@ -360,6 +361,7 @@ public class CommandDispatcher { private void runSync(EntityPlayer entityplayer, Collection bukkit, RootCommandNode rootcommandnode) { // Paper end - Async command map building @@ -29,11 +29,11 @@ index 4b1ea9bc39191e01f83577c7bad128cf1ab9612f..22d748008d24fd6ed7cd8c4914e2ceb3 PlayerCommandSendEvent event = new PlayerCommandSendEvent(entityplayer.getBukkitEntity(), new LinkedHashSet<>(bukkit)); event.getPlayer().getServer().getPluginManager().callEvent(event); -diff --git a/src/main/java/net/minecraft/server/CommandListenerWrapper.java b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -index 1a5463080bc40b8c9ff67374d03c4eb443682288..efe2391f1648f4f83e9b77fdc6d9d81653cf65b3 100644 ---- a/src/main/java/net/minecraft/server/CommandListenerWrapper.java -+++ b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -@@ -17,7 +17,7 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java +index eb2c9d2248a8647beee9960c5016a83f35aa1247..b5ee789c8dfb7f413ab60902ff3d2ef0cf8273cd 100644 +--- a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java ++++ b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java +@@ -38,7 +38,7 @@ import net.minecraft.world.phys.Vec3D; import com.mojang.brigadier.tree.CommandNode; // CraftBukkit @@ -42,7 +42,7 @@ index 1a5463080bc40b8c9ff67374d03c4eb443682288..efe2391f1648f4f83e9b77fdc6d9d816 public static final SimpleCommandExceptionType a = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.player")); public static final SimpleCommandExceptionType b = new SimpleCommandExceptionType(new ChatMessage("permissions.requires.entity")); -@@ -129,6 +129,25 @@ public class CommandListenerWrapper implements ICompletionProvider { +@@ -150,6 +150,25 @@ public class CommandListenerWrapper implements ICompletionProvider { return this.g; } @@ -68,11 +68,11 @@ index 1a5463080bc40b8c9ff67374d03c4eb443682288..efe2391f1648f4f83e9b77fdc6d9d816 @Override public boolean hasPermission(int i) { // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index d525f4b783bc3bff180c9dbc31750f5bc061a7fb..3e019d18b7c2d76c5d1169c4ada8f0603b8b460e 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -624,8 +624,12 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 8bfc26eb12cc5523c64a210383c9156aef6883b3..de0d37044911b50a91f82d4064520e2ba97ff4fd 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -768,8 +768,12 @@ public class PlayerConnection implements PacketListenerPlayIn { ParseResults parseresults = this.minecraftServer.getCommandDispatcher().a().parse(stringreader, this.player.getCommandListener()); this.minecraftServer.getCommandDispatcher().a().getCompletionSuggestions(parseresults).thenAccept((suggestions) -> { @@ -87,7 +87,7 @@ index d525f4b783bc3bff180c9dbc31750f5bc061a7fb..3e019d18b7c2d76c5d1169c4ada8f060 }); }); } -@@ -634,7 +638,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -778,7 +782,11 @@ public class PlayerConnection implements PacketListenerPlayIn { builder = builder.createOffset(builder.getInput().lastIndexOf(' ') + 1); completions.forEach(builder::suggest); @@ -101,10 +101,10 @@ index d525f4b783bc3bff180c9dbc31750f5bc061a7fb..3e019d18b7c2d76c5d1169c4ada8f060 // Paper end - async tab completion } diff --git a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -index 5f33c9e52ac51486d4b22a6dcbfac7f46e0412bb..e16ecdea7d27424053b3f21378af054b2f808eca 100644 +index 23d922a8baac01144602fd7813e9e76abc5335a3..8ddd246ad69a2e53749d38c369af701c161de54e 100644 --- a/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java +++ b/src/main/java/org/bukkit/craftbukkit/command/BukkitCommandWrapper.java -@@ -17,7 +17,7 @@ import net.minecraft.server.CommandListenerWrapper; +@@ -17,7 +17,7 @@ import net.minecraft.commands.CommandListenerWrapper; import org.bukkit.command.Command; import org.bukkit.craftbukkit.CraftServer; diff --git a/Spigot-Server-Patches/0461-Villager-Restocks-API.patch b/Spigot-Server-Patches/0461-Villager-Restocks-API.patch index eced2f74a1..4ae5b26c3b 100644 --- a/Spigot-Server-Patches/0461-Villager-Restocks-API.patch +++ b/Spigot-Server-Patches/0461-Villager-Restocks-API.patch @@ -4,11 +4,11 @@ Date: Sun, 26 Apr 2020 23:49:01 -0400 Subject: [PATCH] Villager Restocks API -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index ee9b1736be7c8fa3324871faa0007fb4781082b8..419de8176a03acc061436d1f92079b6fafcb0ed6 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -42,7 +42,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 02dbb98a1b211d6b3184405ec81f6f58fcef79f3..035b5320d1246d60000ce4d0dbcde11cb9faa634 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -112,7 +112,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation private long bA; private int bB; private long bC; @@ -18,7 +18,7 @@ index ee9b1736be7c8fa3324871faa0007fb4781082b8..419de8176a03acc061436d1f92079b6f private boolean bF; private static final ImmutableList> bG = ImmutableList.of(MemoryModuleType.HOME, MemoryModuleType.JOB_SITE, MemoryModuleType.POTENTIAL_JOB_SITE, MemoryModuleType.MEETING_POINT, MemoryModuleType.MOBS, MemoryModuleType.VISIBLE_MOBS, MemoryModuleType.VISIBLE_VILLAGER_BABIES, MemoryModuleType.NEAREST_PLAYERS, MemoryModuleType.NEAREST_VISIBLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_TARGETABLE_PLAYER, MemoryModuleType.NEAREST_VISIBLE_WANTED_ITEM, MemoryModuleType.WALK_TARGET, new MemoryModuleType[]{MemoryModuleType.LOOK_TARGET, MemoryModuleType.INTERACTION_TARGET, MemoryModuleType.BREED_TARGET, MemoryModuleType.PATH, MemoryModuleType.DOORS_TO_CLOSE, MemoryModuleType.NEAREST_BED, MemoryModuleType.HURT_BY, MemoryModuleType.HURT_BY_ENTITY, MemoryModuleType.NEAREST_HOSTILE, MemoryModuleType.SECONDARY_JOB_SITE, MemoryModuleType.HIDING_PLACE, MemoryModuleType.HEARD_BELL_TIME, MemoryModuleType.CANT_REACH_WALK_TARGET_SINCE, MemoryModuleType.LAST_SLEPT, MemoryModuleType.LAST_WOKEN, MemoryModuleType.LAST_WORKED_AT_POI, MemoryModuleType.GOLEM_DETECTED_RECENTLY}); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 25a57d94a8cf7705fffcf9302c503207def35c3b..0273cf7e2ec27b094a06e5ad1131585df9a0ae8b 100644 +index b020bc9e78a524b4745844ceb99249949c5ab6a4..4b2451179cdda918808ea7001f5033c7e5a8b9ac 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java @@ -84,6 +84,18 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { diff --git a/Spigot-Server-Patches/0462-Validate-PickItem-Packet-and-kick-for-invalid.patch b/Spigot-Server-Patches/0462-Validate-PickItem-Packet-and-kick-for-invalid.patch index fe470523b9..140cc1f60e 100644 --- a/Spigot-Server-Patches/0462-Validate-PickItem-Packet-and-kick-for-invalid.patch +++ b/Spigot-Server-Patches/0462-Validate-PickItem-Packet-and-kick-for-invalid.patch @@ -4,11 +4,11 @@ Date: Sat, 2 May 2020 03:09:46 -0400 Subject: [PATCH] Validate PickItem Packet and kick for invalid -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 3e019d18b7c2d76c5d1169c4ada8f0603b8b460e..c33d87d9c3ce2c258a5e782768eac491538a2836 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -737,7 +737,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index de0d37044911b50a91f82d4064520e2ba97ff4fd..5cd8ee9a9099cd435735c3d9a2194f86232db45f 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -881,7 +881,14 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInPickItem packetplayinpickitem) { PlayerConnectionUtils.ensureMainThread(packetplayinpickitem, this, this.player.getWorldServer()); diff --git a/Spigot-Server-Patches/0464-Optimize-Voxel-Shape-Merging.patch b/Spigot-Server-Patches/0464-Optimize-Voxel-Shape-Merging.patch index 45a5ea1a45..e817b38737 100644 --- a/Spigot-Server-Patches/0464-Optimize-Voxel-Shape-Merging.patch +++ b/Spigot-Server-Patches/0464-Optimize-Voxel-Shape-Merging.patch @@ -29,10 +29,10 @@ and compute a deterministic result for the MergerList values. Additionally, this lets us avoid even allocating new objects for this too, further reducing memory usage. -diff --git a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -index 71d2ae2a9c5a05351241b5a313e66ca15b0624ef..232b0023773008c19f19ad4658eb40fcd08c0333 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeMergerList.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeMergerList.java +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java +index c58d380b96e81d65d7c254a9e53017e5157769b0..57a4b4fcb6f89aacadcca49b25153157c8d06cc3 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapeMergerList.java @@ -6,10 +6,16 @@ import it.unimi.dsi.fastutil.ints.IntArrayList; public final class VoxelShapeMergerList implements VoxelShapeMerger { @@ -74,11 +74,11 @@ index 71d2ae2a9c5a05351241b5a313e66ca15b0624ef..232b0023773008c19f19ad4658eb40fc this.a = new DoubleArrayList(i1); this.b = new IntArrayList(i1); this.c = new IntArrayList(i1); -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index dd91a57f994f1c23464f5e33ca332529d7d9ea19..450957c41e144ef2b238051c4d5a242ca2b9ae83 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -319,9 +319,21 @@ public final class VoxelShapes { +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index 24ecac40625629b0bbe460e7fc984b147ede1f1f..2d7405d1fa7c8f378bebe86f5d0de57a129ed92d 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -329,9 +329,21 @@ public final class VoxelShapes { } @VisibleForTesting @@ -101,7 +101,7 @@ index dd91a57f994f1c23464f5e33ca332529d7d9ea19..450957c41e144ef2b238051c4d5a242c if (doublelist instanceof VoxelShapeCubePoint && doublelist1 instanceof VoxelShapeCubePoint) { long l = a(j, k); -@@ -331,7 +343,22 @@ public final class VoxelShapes { +@@ -341,7 +353,22 @@ public final class VoxelShapes { } } diff --git a/Spigot-Server-Patches/0466-Implement-Mob-Goal-API.patch b/Spigot-Server-Patches/0466-Implement-Mob-Goal-API.patch index 5fb5832e19..92dfb84125 100644 --- a/Spigot-Server-Patches/0466-Implement-Mob-Goal-API.patch +++ b/Spigot-Server-Patches/0466-Implement-Mob-Goal-API.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Implement Mob Goal API diff --git a/pom.xml b/pom.xml -index 324e51d262ec4dc3224da3e21209c53c37a13644..11b4d56922cae5ba3f76c21a76a8ae40b3719afa 100644 +index 42dd78821c061b0384b5b8feaea7b9590ae39bd4..806832714739d3ae264ba7c3d2ca64a5e73f8b7f 100644 --- a/pom.xml +++ b/pom.xml @@ -142,6 +142,13 @@ @@ -757,10 +757,10 @@ index 9df0006c1a283f77c4d01d9fce9062fc1c9bbb1f..b3329c6fcd6758a781a51f5ba8f5052a + return (this.backingSet & (1L << element.ordinal())) != 0; + } } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoal.java b/src/main/java/net/minecraft/server/PathfinderGoal.java -index 42b690b9215d82346990d93a5cead727b1fa10ab..f103b6630e3d00a4e1a514495c2724111e06f752 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoal.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoal.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java +index 5c32cbe81c47fcb9ae347faa6fc007c5d28d79bf..59ea1432152051ce8a60c0a526db787593f0e744 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoal.java @@ -8,11 +8,17 @@ public abstract class PathfinderGoal { private final EnumSet a = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final OptimizedSmallEnumSet goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector @@ -818,11 +818,11 @@ index 42b690b9215d82346990d93a5cead727b1fa10ab..f103b6630e3d00a4e1a514495c272411 private Type() {} } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -index 3343e2df9dd8a66fd7678ce13000177d1f3b564b..9cad895c7d008487ce885cbcc2c3966645df4c19 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalSelector.java -@@ -27,7 +27,7 @@ public class PathfinderGoalSelector { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +index 385cd079e264a7e66e91ab3b70b90afb59688dcd..637928664f8c7b1c694a234e507c20724294e450 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalSelector.java +@@ -28,7 +28,7 @@ public class PathfinderGoalSelector { } }; private final Map c = new EnumMap(PathfinderGoal.Type.class); @@ -831,7 +831,7 @@ index 3343e2df9dd8a66fd7678ce13000177d1f3b564b..9cad895c7d008487ce885cbcc2c39666 private final Supplier e; private final EnumSet f = EnumSet.noneOf(PathfinderGoal.Type.class); // Paper unused, but dummy to prevent plugins from crashing as hard. Theyll need to support paper in a special case if this is super important, but really doesn't seem like it would be. private final OptimizedSmallEnumSet goalTypes = new OptimizedSmallEnumSet<>(PathfinderGoal.Type.class); // Paper - remove streams from pathfindergoalselector -@@ -38,7 +38,7 @@ public class PathfinderGoalSelector { +@@ -39,7 +39,7 @@ public class PathfinderGoalSelector { this.e = supplier; } @@ -840,7 +840,7 @@ index 3343e2df9dd8a66fd7678ce13000177d1f3b564b..9cad895c7d008487ce885cbcc2c39666 this.d.add(new PathfinderGoalWrapped(i, pathfindergoal)); } -@@ -57,7 +57,7 @@ public class PathfinderGoalSelector { +@@ -58,7 +58,7 @@ public class PathfinderGoalSelector { } // Paper end @@ -849,7 +849,7 @@ index 3343e2df9dd8a66fd7678ce13000177d1f3b564b..9cad895c7d008487ce885cbcc2c39666 // Paper start - remove streams from pathfindergoalselector for (Iterator iterator = this.d.iterator(); iterator.hasNext();) { PathfinderGoalWrapped goalWrapped = iterator.next(); -@@ -153,6 +153,7 @@ public class PathfinderGoalSelector { +@@ -154,6 +154,7 @@ public class PathfinderGoalSelector { gameprofilerfiller.exit(); } @@ -857,10 +857,10 @@ index 3343e2df9dd8a66fd7678ce13000177d1f3b564b..9cad895c7d008487ce885cbcc2c39666 public Stream d() { return this.d.stream().filter(PathfinderGoalWrapped::g); } -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -index 22773eca7561d39cd838338efe6d40ab9421feba..2e56fcc32f914d2b5f4bb9d368f504f4d3e8795c 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalWrapped.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java +index 8c8e39d35fb56aa6cf7d456adab01dff5d13a60d..bcf6c924894f49f1c602b83b501f904e553235fd 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalWrapped.java @@ -5,8 +5,8 @@ import javax.annotation.Nullable; public class PathfinderGoalWrapped extends PathfinderGoal { @@ -873,7 +873,7 @@ index 22773eca7561d39cd838338efe6d40ab9421feba..2e56fcc32f914d2b5f4bb9d368f504f4 public PathfinderGoalWrapped(int i, PathfinderGoal pathfindergoal) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f0b348264455655d203e67f008b67ed7de089047..6728a0f753a457fea485265739ca85ebebbf40bb 100644 +index 96652862531301c08aefa0baa79b1258b5b307ec..3014a5d71de98009bdc121ba690c3653c2eef120 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2385,5 +2385,11 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/0467-Use-distance-map-to-optimise-entity-tracker.patch b/Spigot-Server-Patches/0467-Use-distance-map-to-optimise-entity-tracker.patch index 98ca7a770c..afc40cc5fa 100644 --- a/Spigot-Server-Patches/0467-Use-distance-map-to-optimise-entity-tracker.patch +++ b/Spigot-Server-Patches/0467-Use-distance-map-to-optimise-entity-tracker.patch @@ -5,49 +5,11 @@ Subject: [PATCH] Use distance map to optimise entity tracker Use the distance map to find candidate players for tracking. -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 894ef285638acbae9b340bd6e4511e7143c6999d..53be44fad4db829359ee7541a08f438ebcf2bde1 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -206,6 +206,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke - } - // CraftBukkit end - -+ // Paper start - optimise entity tracking -+ final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); -+ -+ boolean isLegacyTrackingEntity = false; -+ -+ public final void setLegacyTrackingEntity(final boolean isLegacyTrackingEntity) { -+ this.isLegacyTrackingEntity = isLegacyTrackingEntity; -+ } -+ -+ final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getPlayersInTrackRange() { -+ return ((WorldServer)this.world).getChunkProvider().playerChunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()] -+ .getObjectsInRange(MCUtil.getCoordinateKey(this)); -+ } -+ // Paper end - optimise entity tracking -+ - public Entity(EntityTypes entitytypes, World world) { - this.id = Entity.entityCount.incrementAndGet(); - this.passengers = Lists.newArrayList(); -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index d89d53e9990918fb9863a7eed3111ef026c95386..d40d41faae13ee17bbe1c7bd4b64126bcaee5643 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -72,6 +72,7 @@ public class EntityTrackerEntry { - this.r = entity.isOnGround(); - } - -+ public final void tick() { this.a(); } // Paper - OBFHELPER - public void a() { - List list = this.tracker.getPassengers(); - diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 6d7928dc45e373ecd95756b061615255265f03fa..f606ccd7586f6ad70d2426363cfd82d07824008d 100644 +index 2ab3b3d42e08f7594361ab3a7354486aff0878ab..40b52ed64428f59173ee8af4046c1e8d926fcdd5 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1533,6 +1533,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant list = this.tracker.getPassengers(); + +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index c6a66273cc14dbb8c02e96a6eb9ea64e540b4ec5..631f3a8b62a7842bd8d360e98643d6b6efdfcf91 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -191,21 +191,55 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - distance maps private final com.destroystokyo.paper.util.misc.PooledLinkedHashSets pooledLinkedPlayerHashSets = new com.destroystokyo.paper.util.misc.PooledLinkedHashSets<>(); @@ -116,7 +90,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea } // Paper end -@@ -198,6 +232,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -242,6 +276,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); this.playerMobDistanceMap = this.world.paperConfig.perPlayerMobSpawns ? new com.destroystokyo.paper.util.PlayerMobDistanceMap() : null; // Paper @@ -162,7 +136,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea } public void updatePlayerMobTypeMap(Entity entity) { -@@ -1436,17 +1509,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1480,17 +1553,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } public void movePlayer(EntityPlayer entityplayer) { @@ -181,7 +155,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea int i = MathHelper.floor(entityplayer.locX()) >> 4; int j = MathHelper.floor(entityplayer.locZ()) >> 4; -@@ -1562,7 +1625,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1606,7 +1669,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entity.tracker = playerchunkmap_entitytracker; // Paper - Fast access to tracker this.trackedEntities.put(entity.getId(), playerchunkmap_entitytracker); @@ -190,7 +164,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea if (entity instanceof EntityPlayer) { EntityPlayer entityplayer = (EntityPlayer) entity; -@@ -1605,7 +1668,37 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1649,7 +1712,37 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { entity.tracker = null; // Paper - We're no longer tracked } @@ -228,7 +202,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea List list = Lists.newArrayList(); List list1 = this.world.getPlayers(); -@@ -1674,23 +1767,31 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1718,23 +1811,31 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PacketDebug.a(this.world, chunk.getPos()); List list = Lists.newArrayList(); List list1 = Lists.newArrayList(); @@ -272,7 +246,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea Iterator iterator; Entity entity1; -@@ -1728,7 +1829,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1772,7 +1873,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public class EntityTracker { @@ -281,7 +255,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea private final Entity tracker; private final int trackingDistance; private SectionPosition e; -@@ -1745,6 +1846,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1789,6 +1890,42 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.e = SectionPosition.a(entity); } @@ -324,7 +298,7 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea public boolean equals(Object object) { return object instanceof PlayerChunkMap.EntityTracker ? ((PlayerChunkMap.EntityTracker) object).tracker.getId() == this.tracker.getId() : false; } -@@ -1845,7 +1982,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1889,7 +2026,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { int j = entity.getEntityType().getChunkRange() * 16; j = org.spigotmc.TrackingRange.getEntityTrackingRange(entity, j); // Paper @@ -333,23 +307,49 @@ index 06124c8799846fd236f7ac1cad04e79bd30fc44c..c2bade51ed1d42e3850fc3d0b32790ea i = j; } } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index b4bf64610bc595bc3ea36410fd878144ed761740..031b754079dc1944b232014c28c64cdb6bcad2fb 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -291,6 +291,21 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne + } + // CraftBukkit end + ++ // Paper start - optimise entity tracking ++ final org.spigotmc.TrackingRange.TrackingRangeType trackingRangeType = org.spigotmc.TrackingRange.getTrackingRangeType(this); ++ ++ boolean isLegacyTrackingEntity = false; ++ ++ public final void setLegacyTrackingEntity(final boolean isLegacyTrackingEntity) { ++ this.isLegacyTrackingEntity = isLegacyTrackingEntity; ++ } ++ ++ final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet getPlayersInTrackRange() { ++ return ((WorldServer)this.world).getChunkProvider().playerChunkMap.playerEntityTrackerTrackMaps[this.trackingRangeType.ordinal()] ++ .getObjectsInRange(MCUtil.getCoordinateKey(this)); ++ } ++ // Paper end - optimise entity tracking ++ + public Entity(EntityTypes entitytypes, World world) { + this.id = Entity.entityCount.incrementAndGet(); + this.passengers = Lists.newArrayList(); diff --git a/src/main/java/org/spigotmc/TrackingRange.java b/src/main/java/org/spigotmc/TrackingRange.java -index 03990231a8b6bc6925f054e9033825316abfafcc..5cfe16ef8c5a7b4405efa58b8fc532e14353f88d 100644 +index 3277a8aaffb6a25624967aa0c62f61309a517739..cd569ad95176fdd0537459b40dfba5c5127a62df 100644 --- a/src/main/java/org/spigotmc/TrackingRange.java +++ b/src/main/java/org/spigotmc/TrackingRange.java -@@ -23,6 +23,7 @@ public class TrackingRange +@@ -21,6 +21,7 @@ public class TrackingRange */ public static int getEntityTrackingRange(Entity entity, int defaultRange) { -+ if (entity instanceof EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt ++ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return defaultRange; // Paper - enderdragon is exempt SpigotWorldConfig config = entity.world.spigotConfig; if ( entity instanceof EntityPlayer ) { -@@ -46,8 +47,48 @@ public class TrackingRange +@@ -44,8 +45,48 @@ public class TrackingRange return config.miscTrackingRange; } else { -- if (entity instanceof EntityEnderDragon) return ((WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt +- if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return ((net.minecraft.server.level.WorldServer)(entity.getWorld())).getChunkProvider().playerChunkMap.getLoadViewDistance(); // Paper - enderdragon is exempt return config.otherTrackingRange; } } @@ -358,7 +358,7 @@ index 03990231a8b6bc6925f054e9033825316abfafcc..5cfe16ef8c5a7b4405efa58b8fc532e1 + // copied from above, TODO check on update + public static TrackingRangeType getTrackingRangeType(Entity entity) + { -+ if (entity instanceof EntityEnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt ++ if (entity instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon) return TrackingRangeType.ENDERDRAGON; // Paper - enderdragon is exempt + if ( entity instanceof EntityPlayer ) + { + return TrackingRangeType.PLAYER; diff --git a/Spigot-Server-Patches/0468-Optimize-isOutsideRange-to-use-distance-maps.patch b/Spigot-Server-Patches/0468-Optimize-isOutsideRange-to-use-distance-maps.patch index f796a9f4d9..078a0dfb39 100644 --- a/Spigot-Server-Patches/0468-Optimize-isOutsideRange-to-use-distance-maps.patch +++ b/Spigot-Server-Patches/0468-Optimize-isOutsideRange-to-use-distance-maps.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize isOutsideRange to use distance maps Use a distance map to find the players in range quickly -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00fe7e563fe 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java -@@ -31,7 +31,7 @@ public abstract class ChunkMapDistance { +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +index 60fcea78bf617559114b1ca1c0bf2d4cd9075a8c..335666db1854e8aa4b2ba71d5bdc2658305cb70a 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +@@ -37,7 +37,7 @@ public abstract class ChunkMapDistance { private final Long2ObjectMap> c = new Long2ObjectOpenHashMap(); public final Long2ObjectOpenHashMap>> tickets = new Long2ObjectOpenHashMap(); private final ChunkMapDistance.a ticketLevelTracker = new ChunkMapDistance.a(); @@ -18,7 +18,7 @@ index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00f private final ChunkMapDistance.c g = new ChunkMapDistance.c(33); // Paper start use a queue, but still keep unique requirement public final java.util.Queue pendingChunkUpdates = new java.util.ArrayDeque() { -@@ -50,6 +50,8 @@ public abstract class ChunkMapDistance { +@@ -56,6 +56,8 @@ public abstract class ChunkMapDistance { private final Executor m; private long currentTick; @@ -27,7 +27,7 @@ index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00f protected ChunkMapDistance(Executor executor, Executor executor1) { executor1.getClass(); Mailbox mailbox = Mailbox.a("player ticket throttler", executor1::execute); -@@ -94,7 +96,7 @@ public abstract class ChunkMapDistance { +@@ -100,7 +102,7 @@ public abstract class ChunkMapDistance { protected abstract PlayerChunk a(long i, int j, @Nullable PlayerChunk playerchunk, int k); public boolean a(PlayerChunkMap playerchunkmap) { @@ -36,7 +36,7 @@ index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00f this.g.a(); int i = Integer.MAX_VALUE - this.ticketLevelTracker.a(Integer.MAX_VALUE); boolean flag = i != 0; -@@ -230,7 +232,7 @@ public abstract class ChunkMapDistance { +@@ -236,7 +238,7 @@ public abstract class ChunkMapDistance { ((ObjectSet) this.c.computeIfAbsent(i, (j) -> { return new ObjectOpenHashSet(); })).add(entityplayer); @@ -45,7 +45,7 @@ index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00f this.g.update(i, 0, true); } -@@ -242,7 +244,7 @@ public abstract class ChunkMapDistance { +@@ -248,7 +250,7 @@ public abstract class ChunkMapDistance { if (objectset != null) objectset.remove(entityplayer); // Paper - some state corruption happens here, don't crash, clean up gracefully. if (objectset == null || objectset.isEmpty()) { // Paper this.c.remove(i); @@ -54,7 +54,7 @@ index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00f this.g.update(i, Integer.MAX_VALUE, false); } -@@ -266,13 +268,17 @@ public abstract class ChunkMapDistance { +@@ -272,13 +274,17 @@ public abstract class ChunkMapDistance { } public int b() { @@ -76,11 +76,11 @@ index 52a69edcefb72a3908ecd522ef87e7eb989467a6..126eae36dc99c29b0d15be26bd68f00f } public String c() { -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 322d0a7d127878ba49362454808b82172acf1600..5c092243e3e6f069f9ab6799de56dd60499b3b53 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -728,6 +728,37 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 9e1b2c6466edff3cfeb3bf8172f4589d2cb712ad..031979ed14b93f2c5b9567c53c269740ef956de5 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -750,6 +750,37 @@ public class ChunkProviderServer extends IChunkProvider { boolean flag1 = this.world.getGameRules().getBoolean(GameRules.DO_MOB_SPAWNING) && !world.getPlayers().isEmpty(); // CraftBukkit if (!flag) { @@ -118,7 +118,7 @@ index 322d0a7d127878ba49362454808b82172acf1600..5c092243e3e6f069f9ab6799de56dd60 this.world.getMethodProfiler().enter("pollingChunks"); int k = this.world.getGameRules().getInt(GameRules.RANDOM_TICK_SPEED); boolean flag2 = world.ticksPerAnimalSpawns != 0L && worlddata.getTime() % world.ticksPerAnimalSpawns == 0L; // CraftBukkit -@@ -757,15 +788,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -779,15 +810,7 @@ public class ChunkProviderServer extends IChunkProvider { this.world.getMethodProfiler().exit(); //List list = Lists.newArrayList(this.playerChunkMap.f()); // Paper //Collections.shuffle(list); // Paper @@ -135,7 +135,7 @@ index 322d0a7d127878ba49362454808b82172acf1600..5c092243e3e6f069f9ab6799de56dd60 final int[] chunksTicked = {0}; this.playerChunkMap.forEachVisibleChunk((playerchunk) -> { // Paper - safe iterator incase chunk loads, also no wrapping Optional optional = ((Either) playerchunk.a().getNow(PlayerChunk.UNLOADED_CHUNK)).left(); -@@ -781,9 +804,9 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -803,9 +826,9 @@ public class ChunkProviderServer extends IChunkProvider { Chunk chunk = (Chunk) optional1.get(); ChunkCoordIntPair chunkcoordintpair = playerchunk.i(); @@ -147,11 +147,11 @@ index 322d0a7d127878ba49362454808b82172acf1600..5c092243e3e6f069f9ab6799de56dd60 SpawnerCreature.a(this.world, chunk, spawnercreature_d, this.allowAnimals, this.allowMonsters, flag2); } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 05483a9c5b8f77959fb44532f506e268b1676acd..97049fdce7a8d441c0277f8f296bca0ff057db01 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -120,6 +120,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 3c75a74292858ccff0357fb11a92673ae6a5129b..3505215bb46a48823a31f8fce12844859df8e459 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -247,6 +247,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet cachedSingleHashSet; // Paper @@ -160,11 +160,11 @@ index 05483a9c5b8f77959fb44532f506e268b1676acd..97049fdce7a8d441c0277f8f296bca0f public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); this.spawnDimension = World.OVERWORLD; -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 5305da4c7253c7e259d7b08e9722145188adc513..7413e3dbaacc288a29d9499242cb8563b4169fd9 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -45,6 +45,18 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 445dba8ed210407664904b707c36c78a76f25510..25484cac9c62e49de39fbbf506fcb3edc4ba6e65 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -70,6 +70,18 @@ public class PlayerChunk { long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave @@ -183,7 +183,7 @@ index 5305da4c7253c7e259d7b08e9722145188adc513..7413e3dbaacc288a29d9499242cb8563 public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -61,6 +73,7 @@ public class PlayerChunk { +@@ -86,6 +98,7 @@ public class PlayerChunk { this.n = this.oldTicketLevel; this.a(i); this.chunkMap = (PlayerChunkMap)playerchunk_d; // Paper @@ -191,11 +191,11 @@ index 5305da4c7253c7e259d7b08e9722145188adc513..7413e3dbaacc288a29d9499242cb8563 } // Paper start -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -161,6 +161,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 631f3a8b62a7842bd8d360e98643d6b6efdfcf91..7b34241553794f62785cb3ea67e7aad62e2e0dae 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -205,6 +205,17 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return MinecraftServer.getServer().applyTrackingRangeScale(vanilla); } // Paper end - use distance map to optimise tracker @@ -213,7 +213,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d void addPlayerToDistanceMaps(EntityPlayer player) { int chunkX = MCUtil.getChunkCoordinate(player.locX()); -@@ -174,6 +185,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -218,6 +229,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { trackMap.add(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); } // Paper end - use distance map to optimise entity tracker @@ -223,7 +223,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d } void removePlayerFromDistanceMaps(EntityPlayer player) { -@@ -182,6 +196,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -226,6 +240,10 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerEntityTrackerTrackMaps[i].remove(player); } // Paper end - use distance map to optimise tracker @@ -234,7 +234,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d } void updateMaps(EntityPlayer player) { -@@ -196,6 +214,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -240,6 +258,9 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { trackMap.update(player, chunkX, chunkZ, Math.min(trackRange, this.getEffectiveViewDistance())); } // Paper end - use distance map to optimise entity tracker @@ -244,7 +244,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d } // Paper end -@@ -227,7 +248,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -271,7 +292,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.mailboxWorldGen = this.p.a(threadedmailbox, false); this.mailboxMain = this.p.a(mailbox, false); this.lightEngine = new LightEngineThreaded(ilightaccess, this, this.world.getDimensionManager().hasSkyLight(), threadedmailbox1, this.p.a(threadedmailbox1, false)); @@ -253,7 +253,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d this.l = supplier; this.m = new VillagePlace(new File(this.w, "poi"), datafixer, flag, this.world); // Paper this.setViewDistance(i); -@@ -271,6 +292,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -315,6 +336,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerEntityTrackerTrackMaps[ordinal] = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); } // Paper end - use distance map to optimise entity tracker @@ -292,7 +292,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d } public void updatePlayerMobTypeMap(Entity entity) { -@@ -290,6 +343,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -334,6 +387,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return entityPlayer.mobCounts[enumCreatureType.ordinal()]; } @@ -300,7 +300,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d private static double a(ChunkCoordIntPair chunkcoordintpair, Entity entity) { double d0 = (double) (chunkcoordintpair.x * 16 + 8); double d1 = (double) (chunkcoordintpair.z * 16 + 8); -@@ -468,6 +522,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -512,6 +566,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } else { if (playerchunk != null) { playerchunk.a(j); @@ -308,7 +308,7 @@ index c2bade51ed1d42e3850fc3d0b32790ea40250b64..cf83f105c4354fe6fa0c07b8c1bd160d } if (playerchunk != null) { -@@ -1438,30 +1493,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1482,30 +1537,53 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return isOutsideOfRange(chunkcoordintpair, false); } diff --git a/Spigot-Server-Patches/0469-Stop-copy-on-write-operations-for-updating-light-dat.patch b/Spigot-Server-Patches/0469-Stop-copy-on-write-operations-for-updating-light-dat.patch index 99aea0ca9c..ef0648a1f5 100644 --- a/Spigot-Server-Patches/0469-Stop-copy-on-write-operations-for-updating-light-dat.patch +++ b/Spigot-Server-Patches/0469-Stop-copy-on-write-operations-for-updating-light-dat.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Stop copy-on-write operations for updating light data Causes huge memory allocations + gc issues -diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index 916d38cebcbe912153d54a21acbf60bc26db7401..6c7c4e75670a7e08ba10c0231a2510bf985dab6b 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorage.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorage.java -@@ -19,8 +19,8 @@ public abstract class LightEngineStorage> e +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +index 5f3d2c090d098834e38e447d93f1ea8184c8fb3e..5b1ff4ff87591dd4ff0b79e4ac6ff0494fc3d0f8 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +@@ -26,8 +26,8 @@ public abstract class LightEngineStorage> e protected final LongSet b = new LongOpenHashSet(); protected final LongSet c = new LongOpenHashSet(); protected final LongSet d = new LongOpenHashSet(); @@ -20,7 +20,7 @@ index 916d38cebcbe912153d54a21acbf60bc26db7401..6c7c4e75670a7e08ba10c0231a2510bf protected final LongSet g = new LongOpenHashSet(); protected final LongSet h = new LongOpenHashSet(); protected final Long2ObjectMap i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); -@@ -34,8 +34,8 @@ public abstract class LightEngineStorage> e +@@ -41,8 +41,8 @@ public abstract class LightEngineStorage> e this.l = enumskyblock; this.m = ilightaccess; this.f = m0; @@ -31,7 +31,7 @@ index 916d38cebcbe912153d54a21acbf60bc26db7401..6c7c4e75670a7e08ba10c0231a2510bf } protected boolean g(long i) { -@@ -44,7 +44,15 @@ public abstract class LightEngineStorage> e +@@ -51,7 +51,15 @@ public abstract class LightEngineStorage> e @Nullable protected NibbleArray a(long i, boolean flag) { @@ -48,7 +48,7 @@ index 916d38cebcbe912153d54a21acbf60bc26db7401..6c7c4e75670a7e08ba10c0231a2510bf } @Nullable -@@ -357,10 +365,12 @@ public abstract class LightEngineStorage> e +@@ -364,10 +372,12 @@ public abstract class LightEngineStorage> e protected void e() { if (!this.g.isEmpty()) { @@ -62,11 +62,11 @@ index 916d38cebcbe912153d54a21acbf60bc26db7401..6c7c4e75670a7e08ba10c0231a2510bf this.g.clear(); } -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -index b978723a66d001f70325df0c7521025e079d7cfa..53199595da71a25710bd1ff8ee2868ee63edc0e1 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -@@ -8,10 +8,23 @@ public abstract class LightEngineStorageArray { protected LightEngineStorageBlock(ILightAccess ilightaccess) { @@ -161,7 +161,7 @@ index 0f7f4744d9f9e5174fb38ccc72248397a4b064ea..292d8c742d3be41ba8ad7fb7f1251dc7 } @Override -@@ -18,13 +18,13 @@ public class LightEngineStorageBlock extends LightEngineStorage { @@ -178,11 +178,11 @@ index 0f7f4744d9f9e5174fb38ccc72248397a4b064ea..292d8c742d3be41ba8ad7fb7f1251dc7 } } } -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -index 75d9065b32731dc635d9d09c48fb9643172381a9..7cec18fcfc311d20beca244c0affe5d6c1849e46 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -@@ -17,15 +17,16 @@ public class LightEngineStorageSky extends LightEngineStorage j) { ((LightEngineStorageSky.a) this.f).b = j; @@ -228,7 +228,7 @@ index 75d9065b32731dc635d9d09c48fb9643172381a9..7cec18fcfc311d20beca244c0affe5d6 if (this.o.contains(k)) { this.q(i); if (l > ((LightEngineStorageSky.a) this.f).b) { -@@ -101,7 +103,7 @@ public class LightEngineStorageSky extends LightEngineStorage= k; } -@@ -321,18 +323,21 @@ public class LightEngineStorageSky extends LightEngineStorage { private int b; diff --git a/Spigot-Server-Patches/0470-No-Tick-view-distance-implementation.patch b/Spigot-Server-Patches/0470-No-Tick-view-distance-implementation.patch index a134bab6fa..d8ec59d0b1 100644 --- a/Spigot-Server-Patches/0470-No-Tick-view-distance-implementation.patch +++ b/Spigot-Server-Patches/0470-No-Tick-view-distance-implementation.patch @@ -36,111 +36,11 @@ index 46ac6d91422423f1e03b86d3efa3241f2599000d..6463d3e4837d032a35654a035f42b8a8 + this.noTickViewDistance = this.getInt("viewdistances.no-tick-view-distance", -1); + } } -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 63de4bba14df9bc33ce04fff5bc0baede6fad6f7..0347dca5d2e40ba078d3f256e17f69ee7f0265cc 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -202,7 +202,51 @@ public class Chunk implements IChunkAccess { - } - - protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { -+ // Paper start - no-tick view distance -+ ChunkProviderServer chunkProviderServer = ((WorldServer)this.world).getChunkProvider(); -+ PlayerChunkMap chunkMap = chunkProviderServer.playerChunkMap; -+ // this code handles the addition of ticking tickets - the distance map handles the removal -+ if (!areNeighboursLoaded(bitsetBefore, 2) && areNeighboursLoaded(bitsetAfter, 2)) { -+ if (chunkMap.playerViewDistanceTickMap.getObjectsInRange(this.coordinateKey) != null) { -+ // now we're ready for entity ticking -+ chunkProviderServer.serverThreadQueue.execute(() -> { -+ // double check that this condition still holds. -+ if (Chunk.this.areNeighboursLoaded(2) && chunkMap.playerViewDistanceTickMap.getObjectsInRange(Chunk.this.coordinateKey) != null) { -+ chunkProviderServer.addTicketAtLevel(TicketType.PLAYER, Chunk.this.loc, 31, Chunk.this.loc); // 31 -> entity ticking, TODO check on update -+ } -+ }); -+ } -+ } - -+ // this code handles the chunk sending -+ if (!areNeighboursLoaded(bitsetBefore, 1) && areNeighboursLoaded(bitsetAfter, 1)) { -+ if (chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(this.coordinateKey) != null) { -+ // now we're ready to send -+ chunkMap.mailboxMain.a(ChunkTaskQueueSorter.a(chunkMap.getUpdatingChunk(this.coordinateKey), (() -> { // Copied frm PlayerChunkMap -+ // double check that this condition still holds. -+ if (!Chunk.this.areNeighboursLoaded(1)) { -+ return; -+ } -+ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet inRange = chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(Chunk.this.coordinateKey); -+ if (inRange == null) { -+ return; -+ } -+ -+ // broadcast -+ Object[] backingSet = inRange.getBackingSet(); -+ Packet[] chunkPackets = new Packet[2]; -+ for (int index = 0, len = backingSet.length; index < len; ++index) { -+ Object temp = backingSet[index]; -+ if (!(temp instanceof EntityPlayer)) { -+ continue; -+ } -+ EntityPlayer player = (EntityPlayer)temp; -+ chunkMap.sendChunk(player, chunkPackets, Chunk.this); -+ } -+ }))); -+ } -+ } -+ // Paper end - no-tick view distance - } - - public final boolean isAnyNeighborsLoaded() { -@@ -1091,7 +1135,7 @@ public class Chunk implements IChunkAccess { - IBlockData iblockdata = this.getType(blockposition); - IBlockData iblockdata1 = Block.b(iblockdata, (GeneratorAccess) this.world, blockposition); - -- this.world.setTypeAndData(blockposition, iblockdata1, 20); -+ this.world.setTypeAndData(blockposition, iblockdata1, 20 | 2); // Paper - We send chunks before they're ticking ready, so we need to notify here - } - - this.n[i].clear(); -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 126eae36dc99c29b0d15be26bd68f00fe7e563fe..6ebc4a4b5c90d8592a017e7b29dec5ca00827432 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java -@@ -263,7 +263,7 @@ public abstract class ChunkMapDistance { - return s; - } - -- protected void a(int i) { -+ protected void setNoTickViewDistance(int i) { // Paper - force abi breakage on usage change - this.g.a(i); - } - -@@ -382,7 +382,7 @@ public abstract class ChunkMapDistance { - - private void a(long i, int j, boolean flag, boolean flag1) { - if (flag != flag1) { -- Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i)); -+ Ticket ticket = new Ticket<>(TicketType.PLAYER, 33, new ChunkCoordIntPair(i)); // Paper - no-tick view distance - - if (flag1) { - ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 97049fdce7a8d441c0277f8f296bca0ff057db01..6620f0c104a9a71796940e072653d13e193367aa 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -122,6 +122,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - - double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks - -+ boolean needsChunkCenterUpdate; // Paper - no-tick view distance -+ - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); - this.spawnDimension = World.OVERWORLD; diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index df3150072fd36dac28d83309e50342c9cfa326b3..0b5ddff008d151ad03a1f382a8f24494356e8701 100644 +index 9999f4efd39668bfd900c7db75a19ff6b95d359c..3e08aa34e01c629083b1e6520b3eed83993b82d2 100644 --- a/src/main/java/net/minecraft/server/MCUtil.java +++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -621,7 +621,8 @@ public final class MCUtil { +@@ -628,7 +628,8 @@ public final class MCUtil { }); worldData.addProperty("name", world.getWorld().getName()); @@ -150,11 +50,46 @@ index df3150072fd36dac28d83309e50342c9cfa326b3..0b5ddff008d151ad03a1f382a8f24494 worldData.addProperty("keep-spawn-loaded", world.keepSpawnInMemory); worldData.addProperty("keep-spawn-loaded-range", world.paperConfig.keepLoadedRange); worldData.addProperty("visible-chunk-count", visibleChunks.size()); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 7413e3dbaacc288a29d9499242cb8563b4169fd9..825c3c522b0497499b72cb9f2ff3edb39d8fea08 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -57,6 +57,18 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +index 335666db1854e8aa4b2ba71d5bdc2658305cb70a..2bbdcedf4856080ea9232effdf3bdae9c26c425b 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +@@ -269,7 +269,7 @@ public abstract class ChunkMapDistance { + return s; + } + +- protected void a(int i) { ++ protected void setNoTickViewDistance(int i) { // Paper - force abi breakage on usage change + this.g.a(i); + } + +@@ -388,7 +388,7 @@ public abstract class ChunkMapDistance { + + private void a(long i, int j, boolean flag, boolean flag1) { + if (flag != flag1) { +- Ticket ticket = new Ticket<>(TicketType.PLAYER, ChunkMapDistance.b, new ChunkCoordIntPair(i)); ++ Ticket ticket = new Ticket<>(TicketType.PLAYER, 33, new ChunkCoordIntPair(i)); // Paper - no-tick view distance + + if (flag1) { + ChunkMapDistance.this.j.a(ChunkTaskQueueSorter.a(() -> { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 3505215bb46a48823a31f8fce12844859df8e459..4c8a324a70dac11251643263eb03e9939bbd1b62 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -249,6 +249,8 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + + double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + ++ boolean needsChunkCenterUpdate; // Paper - no-tick view distance ++ + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); + this.spawnDimension = World.OVERWORLD; +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 25484cac9c62e49de39fbbf506fcb3edc4ba6e65..1f6333c2c26ad04e23d2881235ed1dcf707be038 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -82,6 +82,18 @@ public class PlayerChunk { } // Paper end - optimise isOutsideOfRange @@ -173,7 +108,7 @@ index 7413e3dbaacc288a29d9499242cb8563b4169fd9..825c3c522b0497499b72cb9f2ff3edb3 public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); this.fullChunkFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; -@@ -216,7 +228,7 @@ public class PlayerChunk { +@@ -241,7 +253,7 @@ public class PlayerChunk { } public void a(BlockPosition blockposition) { @@ -182,7 +117,7 @@ index 7413e3dbaacc288a29d9499242cb8563b4169fd9..825c3c522b0497499b72cb9f2ff3edb3 if (chunk != null) { byte b0 = (byte) SectionPosition.a(blockposition.getY()); -@@ -232,7 +244,7 @@ public class PlayerChunk { +@@ -257,7 +269,7 @@ public class PlayerChunk { } public void a(EnumSkyBlock enumskyblock, int i) { @@ -191,7 +126,7 @@ index 7413e3dbaacc288a29d9499242cb8563b4169fd9..825c3c522b0497499b72cb9f2ff3edb3 if (chunk != null) { chunk.setNeedsSaving(true); -@@ -314,9 +326,48 @@ public class PlayerChunk { +@@ -339,9 +351,48 @@ public class PlayerChunk { } private void a(Packet packet, boolean flag) { @@ -243,11 +178,11 @@ index 7413e3dbaacc288a29d9499242cb8563b4169fd9..825c3c522b0497499b72cb9f2ff3edb3 } public CompletableFuture> a(ChunkStatus chunkstatus, PlayerChunkMap playerchunkmap) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb654e53d24e 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -97,7 +97,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 7b34241553794f62785cb3ea67e7aad62e2e0dae..01e2ff962754861424d6b611ffec387bb6c72075 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -141,7 +141,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private boolean updatingChunksModified; private final ChunkTaskQueueSorter p; private final Mailbox> mailboxWorldGen; @@ -256,7 +191,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 public final WorldLoadListener worldLoadListener; public final PlayerChunkMap.a chunkDistanceManager; private final AtomicInteger u; -@@ -172,6 +172,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -216,6 +216,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerMobSpawnMap; // this map is absent from updateMaps since it's controlled at the start of the chunkproviderserver tick public final com.destroystokyo.paper.util.misc.PlayerAreaMap playerChunkTickRangeMap; // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -279,7 +214,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 void addPlayerToDistanceMaps(EntityPlayer player) { int chunkX = MCUtil.getChunkCoordinate(player.locX()); -@@ -188,6 +204,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -232,6 +248,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - optimise PlayerChunkMap#isOutsideRange this.playerChunkTickRangeMap.add(player, chunkX, chunkZ, ChunkMapDistance.MOB_SPAWN_RANGE); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -299,7 +234,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 } void removePlayerFromDistanceMaps(EntityPlayer player) { -@@ -200,6 +229,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -244,6 +273,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerMobSpawnMap.remove(player); this.playerChunkTickRangeMap.remove(player); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -311,7 +246,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 } void updateMaps(EntityPlayer player) { -@@ -217,6 +251,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -261,6 +295,19 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper start - optimise PlayerChunkMap#isOutsideRange this.playerChunkTickRangeMap.update(player, chunkX, chunkZ, ChunkMapDistance.MOB_SPAWN_RANGE); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -331,7 +266,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 } // Paper end -@@ -324,6 +371,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -368,6 +415,45 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } }); // Paper end - optimise PlayerChunkMap#isOutsideRange @@ -377,7 +312,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 } public void updatePlayerMobTypeMap(Entity entity) { -@@ -1144,15 +1230,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1188,15 +1274,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { completablefuture1.thenAcceptAsync((either) -> { either.mapLeft((chunk) -> { this.u.getAndIncrement(); @@ -395,7 +330,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 }); return completablefuture1; } -@@ -1247,32 +1329,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1291,32 +1373,38 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } } @@ -449,7 +384,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 protected void sendChunk(EntityPlayer entityplayer, ChunkCoordIntPair chunkcoordintpair, Packet[] apacket, boolean flag, boolean flag1) { if (entityplayer.world == this.world) { -@@ -1280,7 +1368,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1324,7 +1412,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { PlayerChunk playerchunk = this.getVisibleChunk(chunkcoordintpair.pair()); if (playerchunk != null) { @@ -458,7 +393,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 if (chunk != null) { this.a(entityplayer, apacket, chunk); -@@ -1541,6 +1629,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1585,6 +1673,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end - optimise isOutsideOfRange @@ -466,7 +401,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 private boolean b(EntityPlayer entityplayer) { return entityplayer.isSpectator() && !this.world.getGameRules().getBoolean(GameRules.SPECTATORS_GENERATE_CHUNKS); } -@@ -1568,13 +1657,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1612,13 +1701,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.removePlayerFromDistanceMaps(entityplayer); // Paper - distance maps } @@ -481,7 +416,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 } -@@ -1582,7 +1665,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1626,7 +1709,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { SectionPosition sectionposition = SectionPosition.a((Entity) entityplayer); entityplayer.a(sectionposition); @@ -490,7 +425,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 return sectionposition; } -@@ -1627,6 +1710,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1671,6 +1754,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { int k1; int l1; @@ -498,7 +433,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 if (Math.abs(i1 - i) <= this.viewDistance * 2 && Math.abs(j1 - j) <= this.viewDistance * 2) { k1 = Math.min(i, i1) - this.viewDistance; l1 = Math.min(j, j1) - this.viewDistance; -@@ -1664,7 +1748,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1708,7 +1792,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.sendChunk(entityplayer, chunkcoordintpair1, new Packet[2], false, true); } } @@ -507,7 +442,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 this.updateMaps(entityplayer); // Paper - distance maps -@@ -1672,11 +1756,46 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1716,11 +1800,46 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public Stream a(ChunkCoordIntPair chunkcoordintpair, boolean flag) { @@ -558,7 +493,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 } protected void addEntity(Entity entity) { -@@ -1834,7 +1953,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1878,7 +1997,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -567,7 +502,7 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 private void a(EntityPlayer entityplayer, Packet[] apacket, Chunk chunk) { if (apacket[0] == null) { apacket[0] = new PacketPlayOutMapChunk(chunk, 65535, chunk.world.chunkPacketBlockController.shouldModify(entityplayer, chunk, 65535)); // Paper - Anti-Xray - Bypass -@@ -2020,7 +2139,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -2064,7 +2183,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(this.tracker.chunkX, this.tracker.chunkZ); PlayerChunk playerchunk = PlayerChunkMap.this.getVisibleChunk(chunkcoordintpair.pair()); @@ -576,11 +511,11 @@ index cf83f105c4354fe6fa0c07b8c1bd160d5d2d9e4d..b508e8318d0608d9bae34d9551d1cb65 flag1 = PlayerChunkMap.b(chunkcoordintpair, entityplayer, false) <= PlayerChunkMap.this.viewDistance; } } -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index f1cd31c4ccc1566327041b9b8469f24db542ae91..6c96a7123fb28cfadf129c4ba8688f13539583d6 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -172,7 +172,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index beb18eb9e7e37020ebd7bb03e9a65e090dcfdb4b..2067213bdf592a0882e82c1fe247ad73d8a316da 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -247,7 +247,7 @@ public abstract class PlayerList { boolean flag1 = gamerules.getBoolean(GameRules.REDUCED_DEBUG_INFO); // Spigot - view distance @@ -589,7 +524,7 @@ index f1cd31c4ccc1566327041b9b8469f24db542ae91..6c96a7123fb28cfadf129c4ba8688f13 entityplayer.getBukkitEntity().sendSupportedChannels(); // CraftBukkit playerconnection.sendPacket(new PacketPlayOutCustomPayload(PacketPlayOutCustomPayload.a, (new PacketDataSerializer(Unpooled.buffer())).a(this.getServer().getServerModName()))); playerconnection.sendPacket(new PacketPlayOutServerDifficulty(worlddata.getDifficulty(), worlddata.isDifficultyLocked())); -@@ -826,7 +826,7 @@ public abstract class PlayerList { +@@ -901,7 +901,7 @@ public abstract class PlayerList { // CraftBukkit start WorldData worlddata = worldserver1.getWorldData(); entityplayer1.playerConnection.sendPacket(new PacketPlayOutRespawn(worldserver1.getDimensionManager(), worldserver1.getDimensionKey(), BiomeManager.a(worldserver1.getSeed()), entityplayer1.playerInteractManager.getGameMode(), entityplayer1.playerInteractManager.c(), worldserver1.isDebugWorld(), worldserver1.isFlatWorld(), flag)); @@ -598,7 +533,7 @@ index f1cd31c4ccc1566327041b9b8469f24db542ae91..6c96a7123fb28cfadf129c4ba8688f13 entityplayer1.spawnIn(worldserver1); entityplayer1.dead = false; entityplayer1.playerConnection.teleport(new Location(worldserver1.getWorld(), entityplayer1.locX(), entityplayer1.locY(), entityplayer1.locZ(), entityplayer1.yaw, entityplayer1.pitch)); -@@ -1294,7 +1294,7 @@ public abstract class PlayerList { +@@ -1369,7 +1369,7 @@ public abstract class PlayerList { public void a(int i) { this.viewDistance = i; @@ -607,11 +542,11 @@ index f1cd31c4ccc1566327041b9b8469f24db542ae91..6c96a7123fb28cfadf129c4ba8688f13 Iterator iterator = this.server.getWorlds().iterator(); while (iterator.hasNext()) { -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index d26fd68b2abd4907138ce77a6e6bb45c9af4af02..b5127f4b2deaa70b411991d78657f0c9e73d9e43 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -465,8 +465,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 845836efb968fac2ab6f9927b336e10c19630ef5..58949567c8e691a1cc08647d757e497ad7dde7a8 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -517,8 +517,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.b(blockposition, iblockdata1, iblockdata2); } @@ -626,11 +561,76 @@ index d26fd68b2abd4907138ce77a6e6bb45c9af4af02..b5127f4b2deaa70b411991d78657f0c9 } if ((i & 1) != 0) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index bd56cac7ce01942704d566c2cd8c1775fe643e25..92f40f759f625a46288388a3853cf996a0685b18 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -236,7 +236,51 @@ public class Chunk implements IChunkAccess { + } + + protected void onNeighbourChange(final long bitsetBefore, final long bitsetAfter) { ++ // Paper start - no-tick view distance ++ ChunkProviderServer chunkProviderServer = ((WorldServer)this.world).getChunkProvider(); ++ PlayerChunkMap chunkMap = chunkProviderServer.playerChunkMap; ++ // this code handles the addition of ticking tickets - the distance map handles the removal ++ if (!areNeighboursLoaded(bitsetBefore, 2) && areNeighboursLoaded(bitsetAfter, 2)) { ++ if (chunkMap.playerViewDistanceTickMap.getObjectsInRange(this.coordinateKey) != null) { ++ // now we're ready for entity ticking ++ chunkProviderServer.serverThreadQueue.execute(() -> { ++ // double check that this condition still holds. ++ if (Chunk.this.areNeighboursLoaded(2) && chunkMap.playerViewDistanceTickMap.getObjectsInRange(Chunk.this.coordinateKey) != null) { ++ chunkProviderServer.addTicketAtLevel(TicketType.PLAYER, Chunk.this.loc, 31, Chunk.this.loc); // 31 -> entity ticking, TODO check on update ++ } ++ }); ++ } ++ } + ++ // this code handles the chunk sending ++ if (!areNeighboursLoaded(bitsetBefore, 1) && areNeighboursLoaded(bitsetAfter, 1)) { ++ if (chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(this.coordinateKey) != null) { ++ // now we're ready to send ++ chunkMap.mailboxMain.a(ChunkTaskQueueSorter.a(chunkMap.getUpdatingChunk(this.coordinateKey), (() -> { // Copied frm PlayerChunkMap ++ // double check that this condition still holds. ++ if (!Chunk.this.areNeighboursLoaded(1)) { ++ return; ++ } ++ com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet inRange = chunkMap.playerViewDistanceBroadcastMap.getObjectsInRange(Chunk.this.coordinateKey); ++ if (inRange == null) { ++ return; ++ } ++ ++ // broadcast ++ Object[] backingSet = inRange.getBackingSet(); ++ Packet[] chunkPackets = new Packet[2]; ++ for (int index = 0, len = backingSet.length; index < len; ++index) { ++ Object temp = backingSet[index]; ++ if (!(temp instanceof EntityPlayer)) { ++ continue; ++ } ++ EntityPlayer player = (EntityPlayer)temp; ++ chunkMap.sendChunk(player, chunkPackets, Chunk.this); ++ } ++ }))); ++ } ++ } ++ // Paper end - no-tick view distance + } + + public final boolean isAnyNeighborsLoaded() { +@@ -1125,7 +1169,7 @@ public class Chunk implements IChunkAccess { + IBlockData iblockdata = this.getType(blockposition); + IBlockData iblockdata1 = Block.b(iblockdata, (GeneratorAccess) this.world, blockposition); + +- this.world.setTypeAndData(blockposition, iblockdata1, 20); ++ this.world.setTypeAndData(blockposition, iblockdata1, 20 | 2); // Paper - We send chunks before they're ticking ready, so we need to notify here + } + + this.n[i].clear(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index c11f6e647957c353e78f6331de74264079566e1b..6fc4b59a750572b6d3b9d23fe490d7e5dc5271a5 100644 +index da3c7aaf6c2732450ac365c11a1fd7b70db0513d..70002819b0c18cce4e907678ca3d3e4e8f7cc70a 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2554,10 +2554,39 @@ public class CraftWorld implements World { +@@ -2551,10 +2551,39 @@ public class CraftWorld implements World { // Spigot start @Override public int getViewDistance() { @@ -672,10 +672,10 @@ index c11f6e647957c353e78f6331de74264079566e1b..6fc4b59a750572b6d3b9d23fe490d7e5 private final org.bukkit.World.Spigot spigot = new org.bukkit.World.Spigot() { diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java -index a87cec0b391dfe54f70be9e27723f04f149cfadd..18295dceeacefd2586f3e3fe8bd58790740ba14d 100644 +index 663127e6e6ec507959142b18a11a5a4790d4b98b..5ffdeff04d1a8ed90cd3f1ccab23c20ec760823c 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java +++ b/src/main/java/org/spigotmc/ActivationRange.java -@@ -200,7 +200,7 @@ public class ActivationRange +@@ -197,7 +197,7 @@ public class ActivationRange maxRange = Math.max( maxRange, waterActivationRange ); maxRange = Math.max( maxRange, villagerActivationRange ); // Paper end diff --git a/Spigot-Server-Patches/0471-Add-villager-reputation-API.patch b/Spigot-Server-Patches/0471-Add-villager-reputation-API.patch index c773689463..8c2f3e0927 100644 --- a/Spigot-Server-Patches/0471-Add-villager-reputation-API.patch +++ b/Spigot-Server-Patches/0471-Add-villager-reputation-API.patch @@ -19,23 +19,11 @@ index 0000000000000000000000000000000000000000..0f10c333d88f2e1c56a6c7f22d421084 + return new Reputation(values); + } +} -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 419de8176a03acc061436d1f92079b6fafcb0ed6..650e373a925296f14150de5cbecc6b083679ba54 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -960,6 +960,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation - this.bD = 0; - } - -+ public Reputation getReputation() { return this.fj(); } // Paper - OBFHELPER - public Reputation fj() { - return this.by; - } -diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java -index 3c6d6be4485cad4f2e9a395425b5837590853eee..09d2fc5769089f6d29971d10de5b8209829baae8 100644 ---- a/src/main/java/net/minecraft/server/Reputation.java -+++ b/src/main/java/net/minecraft/server/Reputation.java -@@ -25,7 +25,7 @@ import java.util.stream.Stream; +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java +index a7f5e4a499c1f6fb1450e536dbf117a8af3b3b84..9cc3a18636a356977577076e96cb7be706c61abf 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java +@@ -27,7 +27,7 @@ import net.minecraft.core.MinecraftSerializableUUID; public class Reputation { @@ -44,7 +32,7 @@ index 3c6d6be4485cad4f2e9a395425b5837590853eee..09d2fc5769089f6d29971d10de5b8209 public Reputation() {} -@@ -140,11 +140,11 @@ public class Reputation { +@@ -142,11 +142,11 @@ public class Reputation { return k > reputationtype.h ? Math.max(reputationtype.h, i) : k; } @@ -58,7 +46,7 @@ index 3c6d6be4485cad4f2e9a395425b5837590853eee..09d2fc5769089f6d29971d10de5b8209 this.a = new Object2IntOpenHashMap(); } -@@ -198,6 +198,28 @@ public class Reputation { +@@ -200,6 +200,28 @@ public class Reputation { public void b(ReputationType reputationtype) { this.a.removeInt(reputationtype); } @@ -87,25 +75,37 @@ index 3c6d6be4485cad4f2e9a395425b5837590853eee..09d2fc5769089f6d29971d10de5b8209 } static class b { +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 035b5320d1246d60000ce4d0dbcde11cb9faa634..89ae2b4b836658dc335f28760672b952c2fb58d4 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -1030,6 +1030,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation + this.bD = 0; + } + ++ public Reputation getReputation() { return this.fj(); } // Paper - OBFHELPER + public Reputation fj() { + return this.by; + } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -index 0273cf7e2ec27b094a06e5ad1131585df9a0ae8b..a705e988e3379f1ab50c2d0be3ee559dd3d9d17f 100644 +index 4b2451179cdda918808ea7001f5033c7e5a8b9ac..a524a7b8e977424e28bf2d096d9c577bdd1c99f5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftVillager.java -@@ -1,9 +1,13 @@ - package org.bukkit.craftbukkit.entity; +@@ -17,6 +17,13 @@ import org.bukkit.entity.Villager; + import org.bukkit.entity.Villager.Profession; + import org.bukkit.entity.Villager.Type; -+import com.destroystokyo.paper.entity.villager.Reputation; // Paper - import com.google.common.base.Preconditions; -+import com.google.common.collect.Maps; // Paper - import java.util.Locale; - import net.minecraft.server.BlockBed; - import net.minecraft.server.BlockPosition; -+import java.util.Map; // Paper -+import java.util.UUID; // Paper - import net.minecraft.server.EntityVillager; - import net.minecraft.server.IBlockData; - import net.minecraft.server.IRegistry; -@@ -126,4 +130,45 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { ++// Paper start ++import com.destroystokyo.paper.entity.villager.Reputation; ++import com.google.common.collect.Maps; ++import java.util.Map; ++import java.util.UUID; ++// Paper end ++ + public class CraftVillager extends CraftAbstractVillager implements Villager { + + public CraftVillager(CraftServer server, EntityVillager entity) { +@@ -126,4 +133,45 @@ public class CraftVillager extends CraftAbstractVillager implements Villager { public static VillagerProfession bukkitToNmsProfession(Profession bukkit) { return IRegistry.VILLAGER_PROFESSION.get(CraftNamespacedKey.toMinecraft(bukkit.getKey())); } diff --git a/Spigot-Server-Patches/0472-Fix-Light-Command.patch b/Spigot-Server-Patches/0472-Fix-Light-Command.patch index e923b6974c..f0aac0a3d0 100644 --- a/Spigot-Server-Patches/0472-Fix-Light-Command.patch +++ b/Spigot-Server-Patches/0472-Fix-Light-Command.patch @@ -7,29 +7,35 @@ This lets you run /paper fixlight (max 5) to automatically fix all light data in the chunks. diff --git a/src/main/java/com/destroystokyo/paper/PaperCommand.java b/src/main/java/com/destroystokyo/paper/PaperCommand.java -index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83808ff31f 100644 +index eb1e86e8bb0f421e3686ffa02a4015a588107863..d165e8c232c38ba2e2faf93c60c8a127bb74c9b6 100644 --- a/src/main/java/com/destroystokyo/paper/PaperCommand.java +++ b/src/main/java/com/destroystokyo/paper/PaperCommand.java -@@ -11,13 +11,18 @@ import com.google.common.collect.Maps; +@@ -8,6 +8,8 @@ import com.google.common.collect.ImmutableSet; + import com.google.common.collect.Iterables; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; ++import net.minecraft.core.BlockPosition; ++import net.minecraft.network.protocol.game.PacketPlayOutLightUpdate; + import net.minecraft.resources.MinecraftKey; import com.google.gson.JsonObject; import com.google.gson.internal.Streams; - import com.google.gson.stream.JsonWriter; -+import net.minecraft.server.BlockPosition; -+import net.minecraft.server.Chunk; - import net.minecraft.server.ChunkCoordIntPair; - import net.minecraft.server.ChunkProviderServer; - import net.minecraft.server.Entity; -+import net.minecraft.server.EntityPlayer; - import net.minecraft.server.EntityTypes; -+import net.minecraft.server.LightEngineThreaded; +@@ -15,12 +17,14 @@ import com.google.gson.stream.JsonWriter; import net.minecraft.server.MCUtil; - import net.minecraft.server.MinecraftKey; import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.PacketPlayOutLightUpdate; - import net.minecraft.server.PlayerChunk; - import net.minecraft.server.WorldServer; + import net.minecraft.server.level.ChunkProviderServer; ++import net.minecraft.server.level.EntityPlayer; ++import net.minecraft.server.level.LightEngineThreaded; + import net.minecraft.server.level.PlayerChunk; + import net.minecraft.server.level.WorldServer; + import net.minecraft.world.entity.Entity; + import net.minecraft.world.entity.EntityTypes; + import net.minecraft.world.level.ChunkCoordIntPair; +-import net.minecraft.server.MCUtil; ++import net.minecraft.world.level.chunk.Chunk; import org.apache.commons.lang3.tuple.MutablePair; -@@ -30,6 +35,7 @@ import org.bukkit.command.Command; + import org.apache.commons.lang3.tuple.Pair; + import org.bukkit.Bukkit; +@@ -31,6 +35,7 @@ import org.bukkit.command.Command; import org.bukkit.command.CommandSender; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.CraftWorld; @@ -37,7 +43,7 @@ index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83 import org.bukkit.entity.Player; import java.io.File; -@@ -38,10 +44,12 @@ import java.io.PrintStream; +@@ -39,10 +44,12 @@ import java.io.PrintStream; import java.io.StringWriter; import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; @@ -50,7 +56,7 @@ index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83 import java.util.Iterator; import java.util.List; import java.util.Locale; -@@ -51,7 +59,7 @@ import java.util.stream.Collectors; +@@ -52,7 +59,7 @@ import java.util.stream.Collectors; public class PaperCommand extends Command { private static final String BASE_PERM = "bukkit.command.paper."; @@ -59,7 +65,7 @@ index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83 public PaperCommand(String name) { super(name); -@@ -172,6 +180,9 @@ public class PaperCommand extends Command { +@@ -173,6 +180,9 @@ public class PaperCommand extends Command { case "syncloadinfo": this.doSyncLoadInfo(sender, args); break; @@ -69,7 +75,7 @@ index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83 case "ver": if (!testPermission(sender, "version")) break; // "ver" needs a special check because it's an alias. All other commands are checked up before the switch statement (because they are present in the SUBCOMMANDS set) case "version": -@@ -189,6 +200,77 @@ public class PaperCommand extends Command { +@@ -190,6 +200,77 @@ public class PaperCommand extends Command { return true; } @@ -91,7 +97,7 @@ index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83 + + CraftPlayer player = (CraftPlayer) sender; + EntityPlayer handle = player.getHandle(); -+ net.minecraft.server.WorldServer world = (WorldServer) handle.world; ++ WorldServer world = (WorldServer) handle.world; + LightEngineThreaded lightengine = world.getChunkProvider().getLightEngine(); + + BlockPosition center = MCUtil.toBlockPosition(player.getLocation()); @@ -147,11 +153,11 @@ index ebb17a2efde002f1384b5ad8f4f4576e9a3cc675..5f25167054d58d74c13d11ef2685ed83 private void doSyncLoadInfo(CommandSender sender, String[] args) { if (!SyncLoadFinder.ENABLED) { sender.sendMessage(ChatColor.RED + "This command requires the server startup flag '-Dpaper.debug-sync-loads=true' to be set."); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 825c3c522b0497499b72cb9f2ff3edb39d8fea08..f3d5ea4672f950bd5c52b718f2e1e0280175ccb9 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -325,6 +325,7 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 1f6333c2c26ad04e23d2881235ed1dcf707be038..e53054fc46e528f9c713eb4c03add61316e19396 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -350,6 +350,7 @@ public class PlayerChunk { } @@ -159,11 +165,11 @@ index 825c3c522b0497499b72cb9f2ff3edb39d8fea08..f3d5ea4672f950bd5c52b718f2e1e028 private void a(Packet packet, boolean flag) { // Paper start - per player view distance // there can be potential desync with player's last mapped section and the view distance map, so use the -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index b508e8318d0608d9bae34d9551d1cb654e53d24e..d1ec4de8b64934bb5e9346398bc471dab8457b83 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -98,6 +98,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 01e2ff962754861424d6b611ffec387bb6c72075..79572b2367639f84d3f1ef24e6ee8d69310b8e1c 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -142,6 +142,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { private final ChunkTaskQueueSorter p; private final Mailbox> mailboxWorldGen; final Mailbox> mailboxMain; // Paper - private -> package private @@ -176,7 +182,7 @@ index b508e8318d0608d9bae34d9551d1cb654e53d24e..d1ec4de8b64934bb5e9346398bc471da public final WorldLoadListener worldLoadListener; public final PlayerChunkMap.a chunkDistanceManager; private final AtomicInteger u; -@@ -289,11 +295,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -333,11 +339,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { Mailbox mailbox = Mailbox.a("main", iasynctaskhandler::a); this.worldLoadListener = worldloadlistener; diff --git a/Spigot-Server-Patches/0474-Optimize-brigadier-child-sorting-performance.patch b/Spigot-Server-Patches/0474-Optimize-brigadier-child-sorting-performance.patch index c5cacac8cc..e32f00ecf8 100644 --- a/Spigot-Server-Patches/0474-Optimize-brigadier-child-sorting-performance.patch +++ b/Spigot-Server-Patches/0474-Optimize-brigadier-child-sorting-performance.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Optimize brigadier child sorting performance diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java -index 1685522b494894169b4184b0b94199aedb75b5df..6976da79b20280fcd72dcfb8b48e2eb73257faf2 100644 +index f0f25fa40d4a0aa0e299ad11847b6a5f9102c214..7ef6c99d2235eed38197aa76bc9553d7efbe52a4 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java @@ -27,7 +27,7 @@ import java.util.stream.Collectors; - import net.minecraft.server.CommandListenerWrapper; // CraftBukkit + import net.minecraft.commands.CommandListenerWrapper; // CraftBukkit public abstract class CommandNode implements Comparable> { - private Map> children = Maps.newLinkedHashMap(); diff --git a/Spigot-Server-Patches/0476-Wait-for-Async-Tasks-during-shutdown.patch b/Spigot-Server-Patches/0476-Wait-for-Async-Tasks-during-shutdown.patch index d6885d92fc..434e30979c 100644 --- a/Spigot-Server-Patches/0476-Wait-for-Async-Tasks-during-shutdown.patch +++ b/Spigot-Server-Patches/0476-Wait-for-Async-Tasks-during-shutdown.patch @@ -10,10 +10,10 @@ Adds a 5 second grace period for any async tasks to finish and warns if any are still running after that delay just as reload does. diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index f606ccd7586f6ad70d2426363cfd82d07824008d..89de6c1a2463b2ea3aefb31c22e277fe707555a3 100644 +index 40b52ed64428f59173ee8af4046c1e8d926fcdd5..b1a05896c50787657421e4cf721b9100bb38706d 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -773,6 +773,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant extends PathfinderGoal { @@ -18,7 +18,7 @@ index 7a6f98e38a10a1e78eaa1adb90394d08067cbc1c..ad2a2c27f0ef064064ded28cc049a685 public b(T entityraider) { // CraftBukkit - decompile error this.b = entityraider; -@@ -496,6 +496,7 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { +@@ -532,6 +532,7 @@ public abstract class EntityRaider extends EntityMonsterPatrolling { @Override public boolean a() { diff --git a/Spigot-Server-Patches/0478-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/Spigot-Server-Patches/0478-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index e4252223e9..f11500b854 100644 --- a/Spigot-Server-Patches/0478-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/Spigot-Server-Patches/0478-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -34,11 +34,47 @@ index 78271b400c79578d043b20a5389a37b1bef9a70d..5f3b0d95cc7e6a0434d78ea7305a7068 + } + } -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index b364ceafb4c3412b0d11b3b2e8b4321ed96769bb..a45ceff9ff970b996b2767379a2ecd4693f52d3a 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -23,6 +23,19 @@ public class Block extends BlockBase implements IMaterial { +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index a9ecc2b4da587ca3d3c99f8c8af38092a02fb572..0b3479aae8f7cad7bd0b8b64aa2dead43baf4c56 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -153,6 +153,7 @@ public class Explosion { + for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { + BlockPosition blockposition = new BlockPosition(d4, d5, d6); + IBlockData iblockdata = this.world.getType(blockposition); ++ if (!iblockdata.isDestroyable()) continue; // Paper + Fluid fluid = iblockdata.getFluid(); // Paper + Optional optional = this.l.a(this, this.world, blockposition, iblockdata, fluid); + +@@ -306,7 +307,7 @@ public class Explosion { + IBlockData iblockdata = this.world.getType(blockposition); + Block block = iblockdata.getBlock(); + +- if (!iblockdata.isAir()) { ++ if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper + BlockPosition blockposition1 = blockposition.immutableCopy(); + + this.world.getMethodProfiler().enter("explosion_blocks"); +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 58949567c8e691a1cc08647d757e497ad7dde7a8..ada4a04506a32421bd4b9e661dfe87aa8a2b98bd 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -414,6 +414,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { + // CraftBukkit start - tree generation + if (this.captureTreeGeneration) { ++ // Paper start ++ IBlockData type = getType(blockposition); ++ if (!type.isDestroyable()) return false; ++ // Paper end + CraftBlockState blockstate = capturedBlockStates.get(blockposition); + if (blockstate == null) { + blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index e5c43b383a93fac76333a67b41535ab009d1dcf3..cc512bd2e89382e7fdbc59b41640e95ccafbbfe9 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -62,6 +62,19 @@ public class Block extends BlockBase implements IMaterial { protected final BlockStateList blockStateList; private IBlockData blockData; // Paper start @@ -58,46 +94,11 @@ index b364ceafb4c3412b0d11b3b2e8b4321ed96769bb..a45ceff9ff970b996b2767379a2ecd46 public co.aikar.timings.Timing timing; public co.aikar.timings.Timing getTiming() { if (timing == null) { -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index 62e7c6cb1b363d1ee626c4405f8c30e74aba03e9..1c06647fb6f8e757ca7a737a371cb1dec2aeb80e 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -138,7 +138,7 @@ public abstract class BlockBase { - - @Deprecated - public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) { -- return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()); -+ return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()) && (iblockdata.isDestroyable() || (blockactioncontext.getEntity() != null && blockactioncontext.getEntity().abilities.canInstantlyBuild)); // Paper - } - - @Deprecated -@@ -342,7 +342,11 @@ public abstract class BlockBase { - public Block getBlock() { - return (Block) this.c; - } -- -+ // Paper start -+ public final boolean isDestroyable() { -+ return getBlock().isDestroyable(); -+ } -+ // Paper end - public Material getMaterial() { - return this.g; - } -@@ -432,7 +436,7 @@ public abstract class BlockBase { - } - - public EnumPistonReaction getPushReaction() { -- return this.getBlock().getPushReaction(this.p()); -+ return !isDestroyable() ? EnumPistonReaction.BLOCK : this.getBlock().getPushReaction(this.p()); // Paper - } - - public boolean i(IBlockAccess iblockaccess, BlockPosition blockposition) { -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index 417d1a6c3dbd23905672a847939d92a953bbc91c..0bab7dfb053c1aa92f5417c25fed5484e09bbec3 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -165,6 +165,12 @@ public class BlockPiston extends BlockDirectional { +diff --git a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java +index 7de86d6232eb84642fb6423a1b0a9f30d9df9f2b..e062fd288098127fae22a55562e0207ceaf50163 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java +@@ -194,6 +194,12 @@ public class BlockPiston extends BlockDirectional { @Override public boolean a(IBlockData iblockdata, World world, BlockPosition blockposition, int i, int j) { EnumDirection enumdirection = (EnumDirection) iblockdata.get(BlockPiston.FACING); @@ -110,7 +111,7 @@ index 417d1a6c3dbd23905672a847939d92a953bbc91c..0bab7dfb053c1aa92f5417c25fed5484 if (!world.isClientSide) { boolean flag = this.a(world, blockposition, enumdirection); -@@ -196,7 +202,7 @@ public class BlockPiston extends BlockDirectional { +@@ -225,7 +231,7 @@ public class BlockPiston extends BlockDirectional { IBlockData iblockdata1 = (IBlockData) ((IBlockData) Blocks.MOVING_PISTON.getBlockData().set(BlockPistonMoving.a, enumdirection)).set(BlockPistonMoving.b, this.sticky ? BlockPropertyPistonType.STICKY : BlockPropertyPistonType.DEFAULT); world.setTypeAndData(blockposition, iblockdata1, 20); @@ -119,7 +120,7 @@ index 417d1a6c3dbd23905672a847939d92a953bbc91c..0bab7dfb053c1aa92f5417c25fed5484 world.update(blockposition, iblockdata1.getBlock()); iblockdata1.a(world, blockposition, 2); if (this.sticky) { -@@ -225,7 +231,14 @@ public class BlockPiston extends BlockDirectional { +@@ -254,7 +260,14 @@ public class BlockPiston extends BlockDirectional { } } } else { @@ -135,39 +136,38 @@ index 417d1a6c3dbd23905672a847939d92a953bbc91c..0bab7dfb053c1aa92f5417c25fed5484 } world.playSound((EntityHuman) null, blockposition, SoundEffects.BLOCK_PISTON_CONTRACT, SoundCategory.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index a552cc5bebb1a70db2e679a514769d0ad791ad68..72de544c0782e4daff222a0ca04e5bc870cf148c 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -125,6 +125,7 @@ public class Explosion { - for (float f1 = 0.3F; f > 0.0F; f -= 0.22500001F) { - BlockPosition blockposition = new BlockPosition(d4, d5, d6); - IBlockData iblockdata = this.world.getType(blockposition); -+ if (!iblockdata.isDestroyable()) continue; // Paper - Fluid fluid = iblockdata.getFluid(); // Paper - Optional optional = this.l.a(this, this.world, blockposition, iblockdata, fluid); +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index 58c9f11bda5b8a0d80739d7c243e8e5cba4fe0af..1fcbb2e78904aa9f6ab870d7e2bc95ae25fbd33a 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -189,7 +189,7 @@ public abstract class BlockBase { -@@ -278,7 +279,7 @@ public class Explosion { - IBlockData iblockdata = this.world.getType(blockposition); - Block block = iblockdata.getBlock(); + @Deprecated + public boolean a(IBlockData iblockdata, BlockActionContext blockactioncontext) { +- return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()); ++ return this.material.isReplaceable() && (blockactioncontext.getItemStack().isEmpty() || blockactioncontext.getItemStack().getItem() != this.getItem()) && (iblockdata.isDestroyable() || (blockactioncontext.getEntity() != null && blockactioncontext.getEntity().abilities.canInstantlyBuild)); // Paper + } -- if (!iblockdata.isAir()) { -+ if (!iblockdata.isAir() && iblockdata.isDestroyable()) { // Paper - BlockPosition blockposition1 = blockposition.immutableCopy(); + @Deprecated +@@ -393,7 +393,11 @@ public abstract class BlockBase { + public Block getBlock() { + return (Block) this.c; + } +- ++ // Paper start ++ public final boolean isDestroyable() { ++ return getBlock().isDestroyable(); ++ } ++ // Paper end + public Material getMaterial() { + return this.g; + } +@@ -483,7 +487,7 @@ public abstract class BlockBase { + } - this.world.getMethodProfiler().enter("explosion_blocks"); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index b5127f4b2deaa70b411991d78657f0c9e73d9e43..f2944dcf6b83b530124d53743a3d58b68ecec6f8 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -362,6 +362,10 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - public boolean a(BlockPosition blockposition, IBlockData iblockdata, int i, int j) { - // CraftBukkit start - tree generation - if (this.captureTreeGeneration) { -+ // Paper start -+ IBlockData type = getType(blockposition); -+ if (!type.isDestroyable()) return false; -+ // Paper end - CraftBlockState blockstate = capturedBlockStates.get(blockposition); - if (blockstate == null) { - blockstate = CapturedBlockState.getTreeBlockState(this, blockposition, i); + public EnumPistonReaction getPushReaction() { +- return this.getBlock().getPushReaction(this.p()); ++ return !isDestroyable() ? EnumPistonReaction.BLOCK : this.getBlock().getPushReaction(this.p()); // Paper + } + + public boolean i(IBlockAccess iblockaccess, BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0479-Optimize-NibbleArray-to-use-pooled-buffers.patch b/Spigot-Server-Patches/0479-Optimize-NibbleArray-to-use-pooled-buffers.patch index 3ca0e52002..ca39873d05 100644 --- a/Spigot-Server-Patches/0479-Optimize-NibbleArray-to-use-pooled-buffers.patch +++ b/Spigot-Server-Patches/0479-Optimize-NibbleArray-to-use-pooled-buffers.patch @@ -8,103 +8,124 @@ an object pool for these. Uses lots of advanced new capabilities of the Paper codebase :) -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 20388f4305957a83a678119dcda0249105125ab1..f26740cd0f6a7758dc45cbacd4919d38bbdbb1c4 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -392,11 +392,11 @@ public class ChunkRegionLoader { - } +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java +index 247d969e7d1aa59d9650fce1032aaa09db3903e5..f6cb758500f7ffc46c7255f980d196eb1095a6b0 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutLightUpdate.java +@@ -1,6 +1,8 @@ + package net.minecraft.network.protocol.game; + import com.google.common.collect.Lists; ++import io.netty.channel.ChannelFuture; // Paper ++ + import java.io.IOException; + import java.util.Iterator; + import java.util.List; +@@ -24,14 +26,43 @@ public class PacketPlayOutLightUpdate implements Packet { + private List h; + private boolean i; + ++ // Paper start ++ java.lang.Runnable cleaner1; ++ java.lang.Runnable cleaner2; ++ java.util.concurrent.atomic.AtomicInteger remainingSends = new java.util.concurrent.atomic.AtomicInteger(0); ++ ++ @Override ++ public void onPacketDispatch(EntityPlayer player) { ++ remainingSends.incrementAndGet(); ++ } ++ ++ @Override ++ public void onPacketDispatchFinish(EntityPlayer player, ChannelFuture future) { ++ if (remainingSends.decrementAndGet() <= 0) { ++ // incase of any race conditions, schedule this delayed ++ MCUtil.scheduleTask(5, () -> { ++ if (remainingSends.get() == 0) { ++ cleaner1.run(); ++ cleaner2.run(); ++ } ++ }, "Light Packet Release"); ++ } ++ } ++ ++ @Override ++ public boolean hasFinishListener() { ++ return true; ++ } ++ ++ // Paper end + public PacketPlayOutLightUpdate() {} + + public PacketPlayOutLightUpdate(ChunkCoordIntPair chunkcoordintpair, LightEngine lightengine, boolean flag) { + this.a = chunkcoordintpair.x; + this.b = chunkcoordintpair.z; + this.i = flag; +- this.g = Lists.newArrayList(); +- this.h = Lists.newArrayList(); ++ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper ++ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper + + for (int i = 0; i < 18; ++i) { + NibbleArray nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + i)); +@@ -42,7 +73,7 @@ public class PacketPlayOutLightUpdate implements Packet { + this.e |= 1 << i; + } else { + this.c |= 1 << i; +- this.g.add(nibblearray.asBytes().clone()); ++ this.g.add(nibblearray.getCloneIfSet()); // Paper + } + } + +@@ -51,7 +82,7 @@ public class PacketPlayOutLightUpdate implements Packet { + this.f |= 1 << i; + } else { + this.d |= 1 << i; +- this.h.add(nibblearray1.asBytes().clone()); ++ this.h.add(nibblearray1.getCloneIfSet()); // Paper + } + } + } +@@ -64,8 +95,8 @@ public class PacketPlayOutLightUpdate implements Packet { + this.i = flag; + this.c = i; + this.d = j; +- this.g = Lists.newArrayList(); +- this.h = Lists.newArrayList(); ++ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper ++ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper + + for (int k = 0; k < 18; ++k) { + NibbleArray nibblearray; +@@ -73,7 +104,7 @@ public class PacketPlayOutLightUpdate implements Packet { + if ((this.c & 1 << k) != 0) { + nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + k)); if (nibblearray != null && !nibblearray.c()) { -- nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytes()); -+ nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytesPoolSafe().clone()); // Paper - } - - if (nibblearray1 != null && !nibblearray1.c()) { -- nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytes()); -+ nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytesPoolSafe().clone()); // Paper - } - - nbttaglist.add(nbttagcompound2); -diff --git a/src/main/java/net/minecraft/server/LightEngineStorage.java b/src/main/java/net/minecraft/server/LightEngineStorage.java -index 6c7c4e75670a7e08ba10c0231a2510bf985dab6b..b8b06c790adfa0246b1a6fb5eab1f63bf5ef8b0b 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorage.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorage.java -@@ -149,7 +149,7 @@ public abstract class LightEngineStorage> e - protected NibbleArray j(long i) { - NibbleArray nibblearray = (NibbleArray) this.i.get(i); - -- return nibblearray != null ? nibblearray : new NibbleArray(); -+ return nibblearray != null ? nibblearray : new NibbleArray().markPoolSafe(); // Paper - } - - protected void a(LightEngineLayer lightenginelayer, long i) { -@@ -331,12 +331,12 @@ public abstract class LightEngineStorage> e - - protected void a(long i, @Nullable NibbleArray nibblearray, boolean flag) { - if (nibblearray != null) { -- this.i.put(i, nibblearray); -+ NibbleArray remove = this.i.put(i, nibblearray); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed - if (!flag) { - this.n.add(i); - } - } else { -- this.i.remove(i); -+ NibbleArray remove = this.i.remove(i); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed - } - - } -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -index 53199595da71a25710bd1ff8ee2868ee63edc0e1..37c44a89f28c44915fcae5a7e2c4797b1c123723 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -@@ -33,7 +33,9 @@ public abstract class LightEngineStorageArray { + if ((this.d & 1 << k) != 0) { + nibblearray = lightengine.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, -1 + k)); + if (nibblearray != null && !nibblearray.c()) { +- this.h.add(nibblearray.asBytes().clone()); ++ this.h.add(nibblearray.getCloneIfSet()); // Paper + } else { + this.d &= ~(1 << k); + if (nibblearray != null) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +index 2e86be5be969ebf672ef3844e1367583c823f252..50fc6316bfd42a532f792ba7557783eea3988a55 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java ++++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +@@ -1,17 +1,76 @@ + package net.minecraft.world.level.chunk; +import com.destroystokyo.paper.util.pooled.PooledObjects; // Paper + +import javax.annotation.Nonnull; import javax.annotation.Nullable; + import net.minecraft.SystemUtils; public class NibbleArray { @@ -176,7 +197,7 @@ index 6d608dfa52fffd79878f3bdebcda9fab176e413e..ff00830b95a17f66d0c913087492dbf4 if (abyte.length != 2048) { throw (IllegalArgumentException) SystemUtils.c((Throwable) (new IllegalArgumentException("ChunkNibbleArrays should be 2048 bytes not: " + abyte.length))); } -@@ -44,7 +103,8 @@ public class NibbleArray { +@@ -45,7 +104,8 @@ public class NibbleArray { public void a(int i, int j) { // PAIL: private -> public if (this.a == null) { @@ -186,7 +207,7 @@ index 6d608dfa52fffd79878f3bdebcda9fab176e413e..ff00830b95a17f66d0c913087492dbf4 } int k = this.d(i); -@@ -66,14 +126,36 @@ public class NibbleArray { +@@ -67,14 +127,36 @@ public class NibbleArray { public byte[] asBytes() { if (this.a == null) { this.a = new byte[2048]; @@ -224,11 +245,97 @@ index 6d608dfa52fffd79878f3bdebcda9fab176e413e..ff00830b95a17f66d0c913087492dbf4 } public String toString() { -diff --git a/src/main/java/net/minecraft/server/NibbleArrayFlat.java b/src/main/java/net/minecraft/server/NibbleArrayFlat.java -index 67c960292db9d99ac85b5d0dda50ae48ef942c1b..5e3efa1fa6c089df35971ce5c83da384f7dbd402 100644 ---- a/src/main/java/net/minecraft/server/NibbleArrayFlat.java -+++ b/src/main/java/net/minecraft/server/NibbleArrayFlat.java -@@ -8,7 +8,7 @@ public class NibbleArrayFlat extends NibbleArray { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 358b3c396e8201fa5f82778179e8a300b4aed908..120115b44c2ec592fe0f90eee89bb213d4e8325e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -434,11 +434,11 @@ public class ChunkRegionLoader { + } + + if (nibblearray != null && !nibblearray.c()) { +- nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytes()); ++ nbttagcompound2.setByteArray("BlockLight", nibblearray.asBytesPoolSafe().clone()); // Paper + } + + if (nibblearray1 != null && !nibblearray1.c()) { +- nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytes()); ++ nbttagcompound2.setByteArray("SkyLight", nibblearray1.asBytesPoolSafe().clone()); // Paper + } + + nbttaglist.add(nbttagcompound2); +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +index 5b1ff4ff87591dd4ff0b79e4ac6ff0494fc3d0f8..9ba9efb181b9607f25b7c921e69e4c59b182d429 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorage.java +@@ -156,7 +156,7 @@ public abstract class LightEngineStorage> e + protected NibbleArray j(long i) { + NibbleArray nibblearray = (NibbleArray) this.i.get(i); + +- return nibblearray != null ? nibblearray : new NibbleArray(); ++ return nibblearray != null ? nibblearray : new NibbleArray().markPoolSafe(); // Paper + } + + protected void a(LightEngineLayer lightenginelayer, long i) { +@@ -338,12 +338,12 @@ public abstract class LightEngineStorage> e + + protected void a(long i, @Nullable NibbleArray nibblearray, boolean flag) { + if (nibblearray != null) { +- this.i.put(i, nibblearray); ++ NibbleArray remove = this.i.put(i, nibblearray); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed + if (!flag) { + this.n.add(i); + } + } else { +- this.i.remove(i); ++ NibbleArray remove = this.i.remove(i); if (remove != null && remove.cleaner != null) remove.cleaner.run(); // Paper - clean up when removed + } + + } +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +index ed7864c552054fc47c6010a094230ce4aebf1c54..0ab4917053c090c874e8bb59e750fd909636f89d 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +@@ -34,7 +34,9 @@ public abstract class LightEngineStorageArray { - private List h; - private boolean i; - -+ // Paper start -+ java.lang.Runnable cleaner1; -+ java.lang.Runnable cleaner2; -+ java.util.concurrent.atomic.AtomicInteger remainingSends = new java.util.concurrent.atomic.AtomicInteger(0); -+ -+ @Override -+ public void onPacketDispatch(EntityPlayer player) { -+ remainingSends.incrementAndGet(); -+ } -+ -+ @Override -+ public void onPacketDispatchFinish(EntityPlayer player, ChannelFuture future) { -+ if (remainingSends.decrementAndGet() <= 0) { -+ // incase of any race conditions, schedule this delayed -+ MCUtil.scheduleTask(5, () -> { -+ if (remainingSends.get() == 0) { -+ cleaner1.run(); -+ cleaner2.run(); -+ } -+ }, "Light Packet Release"); -+ } -+ } -+ -+ @Override -+ public boolean hasFinishListener() { -+ return true; -+ } -+ -+ // Paper end - public PacketPlayOutLightUpdate() {} - - public PacketPlayOutLightUpdate(ChunkCoordIntPair chunkcoordintpair, LightEngine lightengine, boolean flag) { - this.a = chunkcoordintpair.x; - this.b = chunkcoordintpair.z; - this.i = flag; -- this.g = Lists.newArrayList(); -- this.h = Lists.newArrayList(); -+ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper -+ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper - - for (int i = 0; i < 18; ++i) { - NibbleArray nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + i)); -@@ -35,7 +66,7 @@ public class PacketPlayOutLightUpdate implements Packet { - this.e |= 1 << i; - } else { - this.c |= 1 << i; -- this.g.add(nibblearray.asBytes().clone()); -+ this.g.add(nibblearray.getCloneIfSet()); // Paper - } - } - -@@ -44,7 +75,7 @@ public class PacketPlayOutLightUpdate implements Packet { - this.f |= 1 << i; - } else { - this.d |= 1 << i; -- this.h.add(nibblearray1.asBytes().clone()); -+ this.h.add(nibblearray1.getCloneIfSet()); // Paper - } - } - } -@@ -57,8 +88,8 @@ public class PacketPlayOutLightUpdate implements Packet { - this.i = flag; - this.c = i; - this.d = j; -- this.g = Lists.newArrayList(); -- this.h = Lists.newArrayList(); -+ this.g = Lists.newArrayList();cleaner1 = MCUtil.registerListCleaner(this, this.g, NibbleArray::releaseBytes); // Paper -+ this.h = Lists.newArrayList();cleaner2 = MCUtil.registerListCleaner(this, this.h, NibbleArray::releaseBytes); // Paper - - for (int k = 0; k < 18; ++k) { - NibbleArray nibblearray; -@@ -66,7 +97,7 @@ public class PacketPlayOutLightUpdate implements Packet { - if ((this.c & 1 << k) != 0) { - nibblearray = lightengine.a(EnumSkyBlock.SKY).a(SectionPosition.a(chunkcoordintpair, -1 + k)); - if (nibblearray != null && !nibblearray.c()) { -- this.g.add(nibblearray.asBytes().clone()); -+ this.g.add(nibblearray.getCloneIfSet()); // Paper - } else { - this.c &= ~(1 << k); - if (nibblearray != null) { -@@ -78,7 +109,7 @@ public class PacketPlayOutLightUpdate implements Packet { - if ((this.d & 1 << k) != 0) { - nibblearray = lightengine.a(EnumSkyBlock.BLOCK).a(SectionPosition.a(chunkcoordintpair, -1 + k)); - if (nibblearray != null && !nibblearray.c()) { -- this.h.add(nibblearray.asBytes().clone()); -+ this.h.add(nibblearray.getCloneIfSet()); // Paper - } else { - this.d &= ~(1 << k); - if (nibblearray != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java -index 531d5e41dfbfbfe8da0676207f6325a0bca97a9a..b345b7658b7de28787cb10255d7d881bc1493003 100644 +index 8ade81a693286cdf65f8c0eeca2121a217c90350..98ab124b4dca9387b4793cef68a33c67aed64e21 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunk.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunk.java @@ -299,14 +299,14 @@ public class CraftChunk implements Chunk { diff --git a/Spigot-Server-Patches/0480-Reduce-MutableInt-allocations-from-light-engine.patch b/Spigot-Server-Patches/0480-Reduce-MutableInt-allocations-from-light-engine.patch index 15504c4c63..31207e90cd 100644 --- a/Spigot-Server-Patches/0480-Reduce-MutableInt-allocations-from-light-engine.patch +++ b/Spigot-Server-Patches/0480-Reduce-MutableInt-allocations-from-light-engine.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Reduce MutableInt allocations from light engine We can abuse the fact light is single threaded and share an instance per light engine instance -diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java -index 29e12f76a3e424d36506144e09e083cc5ce3bedc..4db28b9a9b8a1e91911126172c6670c252dd49cb 100644 ---- a/src/main/java/net/minecraft/server/LightEngineBlock.java -+++ b/src/main/java/net/minecraft/server/LightEngineBlock.java -@@ -6,6 +6,7 @@ public final class LightEngineBlock extends LightEngineLayer= 15) { -diff --git a/src/main/java/net/minecraft/server/LightEngineSky.java b/src/main/java/net/minecraft/server/LightEngineSky.java -index 2301a982e17ab9568e3da9ca84c4a024c7c1b214..f0b57784006752e031800a12a1a3c1a5945c636b 100644 ---- a/src/main/java/net/minecraft/server/LightEngineSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineSky.java -@@ -6,6 +6,7 @@ public final class LightEngineSky extends LightEngineLayer= 15) { return k; } else { diff --git a/Spigot-Server-Patches/0481-Reduce-allocation-of-Vec3D-by-entity-tracker.patch b/Spigot-Server-Patches/0481-Reduce-allocation-of-Vec3D-by-entity-tracker.patch index 8f9d95280a..5654541532 100644 --- a/Spigot-Server-Patches/0481-Reduce-allocation-of-Vec3D-by-entity-tracker.patch +++ b/Spigot-Server-Patches/0481-Reduce-allocation-of-Vec3D-by-entity-tracker.patch @@ -4,11 +4,11 @@ Date: Mon, 27 Apr 2020 00:04:16 -0700 Subject: [PATCH] Reduce allocation of Vec3D by entity tracker -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index d40d41faae13ee17bbe1c7bd4b64126bcaee5643..3960a975e74ed81c45819fe5e0f01c6c18252982 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -127,8 +127,12 @@ public class EntityTrackerEntry { +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index 4c82266656d0a60a166faa082a9aaaaed7f062d3..aa5ba862f18ff706f11b0b26cea55a904a5a9473 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -156,8 +156,12 @@ public class EntityTrackerEntry { ++this.o; i = MathHelper.d(this.tracker.yaw * 256.0F / 360.0F); j = MathHelper.d(this.tracker.pitch * 256.0F / 360.0F); @@ -23,7 +23,7 @@ index d40d41faae13ee17bbe1c7bd4b64126bcaee5643..3960a975e74ed81c45819fe5e0f01c6c Packet packet1 = null; boolean flag2 = flag1 || this.tickCounter % 60 == 0; boolean flag3 = Math.abs(i - this.yRot) >= 1 || Math.abs(j - this.xRot) >= 1; -@@ -145,9 +149,11 @@ public class EntityTrackerEntry { +@@ -174,9 +178,11 @@ public class EntityTrackerEntry { // CraftBukkit end if (this.tickCounter > 0 || this.tracker instanceof EntityArrow) { @@ -38,11 +38,11 @@ index d40d41faae13ee17bbe1c7bd4b64126bcaee5643..3960a975e74ed81c45819fe5e0f01c6c boolean flag4 = k < -32768L || k > 32767L || l < -32768L || l > 32767L || i1 < -32768L || i1 > 32767L; if (!flag4 && this.o <= 400 && !this.q && this.r == this.tracker.isOnGround()) { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index d1ec4de8b64934bb5e9346398bc471dab8457b83..2654afa43b8322752267ca71447567e91323922e 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -2135,9 +2135,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 79572b2367639f84d3f1ef24e6ee8d69310b8e1c..406331bf57182355c6d7428b0986baad4248cf9d 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -2179,9 +2179,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public void updatePlayer(EntityPlayer entityplayer) { org.spigotmc.AsyncCatcher.catchOp("player tracker update"); // Spigot if (entityplayer != this.tracker) { diff --git a/Spigot-Server-Patches/0482-Ensure-safe-gateway-teleport.patch b/Spigot-Server-Patches/0482-Ensure-safe-gateway-teleport.patch index 1f34e01f01..92e815000c 100644 --- a/Spigot-Server-Patches/0482-Ensure-safe-gateway-teleport.patch +++ b/Spigot-Server-Patches/0482-Ensure-safe-gateway-teleport.patch @@ -4,11 +4,11 @@ Date: Fri, 15 May 2020 01:10:03 -0400 Subject: [PATCH] Ensure safe gateway teleport -diff --git a/src/main/java/net/minecraft/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -index a242dd1f7ca7f2d93312d630173397a3abd83b1d..b740c9b66a77df1ff20fba794c49a1de4292ba88 100644 ---- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java -+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java -@@ -64,9 +64,14 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java +index 1d90cb32560a9102ebe43dfa9806b407d0ee1bd1..5a1d23dc718a883825e8e7550bd9d034b81f2bf8 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityEndGateway.java +@@ -88,9 +88,14 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick } else if (!this.world.isClientSide) { List list = this.world.a(Entity.class, new AxisAlignedBB(this.getPosition()), TileEntityEndGateway::a); diff --git a/Spigot-Server-Patches/0484-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch b/Spigot-Server-Patches/0484-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch index b1e2834198..32ab0cae48 100644 --- a/Spigot-Server-Patches/0484-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch +++ b/Spigot-Server-Patches/0484-Fix-Non-Full-Status-Chunk-NBT-Memory-Leak.patch @@ -15,18 +15,18 @@ full chunks so this was really starting to hurt. We further improve it by making a copy of the nbt tag with only the memory it needs, so that we dont have to hold a copy to the entire compound. -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index f26740cd0f6a7758dc45cbacd4919d38bbdbb1c4..63bd11ba69c9e4645269f62973ef23bfa034999b 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -156,15 +156,9 @@ public class ChunkRegionLoader { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 120115b44c2ec592fe0f90eee89bb213d4e8325e..427544bc0ad72f82a54e9d2f7dbb3373a25c5ca3 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -198,15 +198,9 @@ public class ChunkRegionLoader { object2 = protochunkticklist1; } - object = new Chunk(worldserver.getMinecraftWorld(), chunkcoordintpair, biomestorage, chunkconverter, (TickList) object1, (TickList) object2, j, achunksection, (chunk) -> { - loadEntities(nbttagcompound1, chunk); - // CraftBukkit start - load chunk persistent data from nbt -- NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues"); +- net.minecraft.nbt.NBTBase persistentBase = nbttagcompound1.get("ChunkBukkitValues"); - if (persistentBase instanceof NBTTagCompound) { - chunk.persistentDataContainer.putAll((NBTTagCompound) persistentBase); - } @@ -38,7 +38,7 @@ index f26740cd0f6a7758dc45cbacd4919d38bbdbb1c4..63bd11ba69c9e4645269f62973ef23bf } else { ProtoChunk protochunk = new ProtoChunk(chunkcoordintpair, chunkconverter, achunksection, protochunkticklist, protochunkticklist1, worldserver); // Paper - Anti-Xray - Add parameter -@@ -270,6 +264,50 @@ public class ChunkRegionLoader { +@@ -312,6 +306,50 @@ public class ChunkRegionLoader { return new InProgressChunkHolder(protochunk1, tasksToExecuteOnMain); // Paper - Async chunk loading } } diff --git a/Spigot-Server-Patches/0485-Workaround-for-Client-Lag-Spikes-MC-162253.patch b/Spigot-Server-Patches/0485-Workaround-for-Client-Lag-Spikes-MC-162253.patch index c4631f4cfe..994d215160 100644 --- a/Spigot-Server-Patches/0485-Workaround-for-Client-Lag-Spikes-MC-162253.patch +++ b/Spigot-Server-Patches/0485-Workaround-for-Client-Lag-Spikes-MC-162253.patch @@ -11,36 +11,11 @@ This patch basically serves as a workaround by sending light maps to the client, so that it doesn't attempt to calculate them. This mitigates the frametime impact to a minimum (but it's still there). -diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java -index 0347dca5d2e40ba078d3f256e17f69ee7f0265cc..3bcd63a754538ccfc5965207a8fc79faa31925c0 100644 ---- a/src/main/java/net/minecraft/server/Chunk.java -+++ b/src/main/java/net/minecraft/server/Chunk.java -@@ -234,7 +234,7 @@ public class Chunk implements IChunkAccess { - - // broadcast - Object[] backingSet = inRange.getBackingSet(); -- Packet[] chunkPackets = new Packet[2]; -+ Packet[] chunkPackets = new Packet[10]; - for (int index = 0, len = backingSet.length; index < len; ++index) { - Object temp = backingSet[index]; - if (!(temp instanceof EntityPlayer)) { -diff --git a/src/main/java/net/minecraft/server/ChunkSection.java b/src/main/java/net/minecraft/server/ChunkSection.java -index 39572cdce691a459cb9df0cc064fbf7bde83a99e..e52df8096e399c84ff8a2637fdd65ea57d9001d0 100644 ---- a/src/main/java/net/minecraft/server/ChunkSection.java -+++ b/src/main/java/net/minecraft/server/ChunkSection.java -@@ -100,6 +100,7 @@ public class ChunkSection { - return this.nonEmptyBlockCount == 0; - } - -+ public static boolean isEmpty(@Nullable ChunkSection chunksection) { return a(chunksection) ; } // Paper - OBFHELPER - public static boolean a(@Nullable ChunkSection chunksection) { - return chunksection == Chunk.a || chunksection.c(); - } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 2654afa43b8322752267ca71447567e91323922e..126f94eaf8b328e5ca0133c61f92c52197c498dd 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -1960,12 +1960,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 406331bf57182355c6d7428b0986baad4248cf9d..76a5310ea35dc6fe482ecfdea8866df0598444c8 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -2004,12 +2004,112 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } @@ -153,3 +128,28 @@ index 2654afa43b8322752267ca71447567e91323922e..126f94eaf8b328e5ca0133c61f92c521 entityplayer.a(chunk.getPos(), apacket[0], apacket[1]); PacketDebug.a(this.world, chunk.getPos()); +diff --git a/src/main/java/net/minecraft/world/level/chunk/Chunk.java b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +index 92f40f759f625a46288388a3853cf996a0685b18..e056d198a530a830aeebf7ebb51ac9273675f2f0 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/Chunk.java ++++ b/src/main/java/net/minecraft/world/level/chunk/Chunk.java +@@ -268,7 +268,7 @@ public class Chunk implements IChunkAccess { + + // broadcast + Object[] backingSet = inRange.getBackingSet(); +- Packet[] chunkPackets = new Packet[2]; ++ Packet[] chunkPackets = new Packet[10]; + for (int index = 0, len = backingSet.length; index < len; ++index) { + Object temp = backingSet[index]; + if (!(temp instanceof EntityPlayer)) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +index 506b79c67454e41d32ad18003f066681d47e50f5..e81a6b9538f5c770cbfb4d71439db31f8e97face 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkSection.java +@@ -106,6 +106,7 @@ public class ChunkSection { + return this.nonEmptyBlockCount == 0; + } + ++ public static boolean isEmpty(@Nullable ChunkSection chunksection) { return a(chunksection) ; } // Paper - OBFHELPER + public static boolean a(@Nullable ChunkSection chunksection) { + return chunksection == Chunk.a || chunksection.c(); + } diff --git a/Spigot-Server-Patches/0486-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch b/Spigot-Server-Patches/0486-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch index 079d65e7fa..174c47f467 100644 --- a/Spigot-Server-Patches/0486-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch +++ b/Spigot-Server-Patches/0486-Implement-Chunk-Priority-Urgency-System-for-Chunks.patch @@ -77,31 +77,31 @@ index 49a594e5f345096cb3b9913b8ee2760795c5f012..bcb7ce2692c5bc1a6214c3a384949666 } } -diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index b12e43ed13a1a9d7d418831b8988c30a242cb5c4..dcaf9f8574a9c913b64ba3a1d8b02220db720225 100644 ---- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -103,6 +103,7 @@ public class ChunkCoordIntPair { - return "[" + this.x + ", " + this.z + "]"; - } - -+ public final BlockPosition asPosition() { return l(); } // Paper - OBFHELPER - public BlockPosition l() { - return new BlockPosition(this.d(), 0, this.e()); - } -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc39a8f7f0 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java -@@ -23,6 +23,7 @@ import java.util.concurrent.Executor; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java +index 3e08aa34e01c629083b1e6520b3eed83993b82d2..f1eddf0c8a4c8755c11716c7dbf06c84222fe544 100644 +--- a/src/main/java/net/minecraft/server/MCUtil.java ++++ b/src/main/java/net/minecraft/server/MCUtil.java +@@ -663,6 +663,7 @@ public final class MCUtil { + chunkData.addProperty("x", playerChunk.location.x); + chunkData.addProperty("z", playerChunk.location.z); + chunkData.addProperty("ticket-level", playerChunk.getTicketLevel()); ++ chunkData.addProperty("priority", playerChunk.getCurrentPriority()); + chunkData.addProperty("state", PlayerChunk.getChunkState(playerChunk.getTicketLevel()).toString()); + chunkData.addProperty("queued-for-unload", chunkMap.unloadQueue.contains(playerChunk.location.pair())); + chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +index 2bbdcedf4856080ea9232effdf3bdae9c26c425b..f30939f345c75b8c7d71b6afe8f008fe747c7574 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +@@ -29,6 +29,7 @@ import net.minecraft.world.level.chunk.Chunk; + import net.minecraft.world.level.chunk.ChunkStatus; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import org.spigotmc.AsyncCatcher; // Paper public abstract class ChunkMapDistance { -@@ -46,7 +47,7 @@ public abstract class ChunkMapDistance { +@@ -52,7 +53,7 @@ public abstract class ChunkMapDistance { private final ChunkTaskQueueSorter i; private final Mailbox> j; private final Mailbox k; @@ -110,7 +110,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc private final Executor m; private long currentTick; -@@ -84,6 +85,7 @@ public abstract class ChunkMapDistance { +@@ -90,6 +91,7 @@ public abstract class ChunkMapDistance { } private static int getLowestTicketLevel(ArraySetSorted> arraysetsorted) { @@ -118,7 +118,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc return !arraysetsorted.isEmpty() ? ((Ticket) arraysetsorted.b()).b() : PlayerChunkMap.GOLDEN_TICKET + 1; } -@@ -97,6 +99,7 @@ public abstract class ChunkMapDistance { +@@ -103,6 +105,7 @@ public abstract class ChunkMapDistance { public boolean a(PlayerChunkMap playerchunkmap) { //this.f.a(); // Paper - no longer used @@ -126,7 +126,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc this.g.a(); int i = Integer.MAX_VALUE - this.ticketLevelTracker.a(Integer.MAX_VALUE); boolean flag = i != 0; -@@ -107,11 +110,13 @@ public abstract class ChunkMapDistance { +@@ -113,11 +116,13 @@ public abstract class ChunkMapDistance { // Paper start if (!this.pendingChunkUpdates.isEmpty()) { @@ -140,7 +140,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc // Paper end return true; } else { -@@ -147,8 +152,10 @@ public abstract class ChunkMapDistance { +@@ -153,8 +158,10 @@ public abstract class ChunkMapDistance { return flag; } } @@ -151,7 +151,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc ArraySetSorted> arraysetsorted = this.e(i); int j = getLowestTicketLevel(arraysetsorted); Ticket ticket1 = (Ticket) arraysetsorted.a(ticket); // CraftBukkit - decompile error -@@ -162,7 +169,9 @@ public abstract class ChunkMapDistance { +@@ -168,7 +175,9 @@ public abstract class ChunkMapDistance { } private boolean removeTicket(long i, Ticket ticket) { // CraftBukkit - void -> boolean @@ -161,7 +161,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { -@@ -173,7 +182,8 @@ public abstract class ChunkMapDistance { +@@ -179,7 +188,8 @@ public abstract class ChunkMapDistance { this.tickets.remove(i); } @@ -171,7 +171,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc return removed; // CraftBukkit } -@@ -182,6 +192,135 @@ public abstract class ChunkMapDistance { +@@ -188,6 +198,135 @@ public abstract class ChunkMapDistance { this.addTicketAtLevel(tickettype, chunkcoordintpair, i, t0); } @@ -307,7 +307,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc public boolean addTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkcoordintpair, int level, T identifier) { return this.addTicket(chunkcoordintpair.pair(), new Ticket<>(ticketType, level, identifier)); // CraftBukkit end -@@ -382,27 +521,50 @@ public abstract class ChunkMapDistance { +@@ -388,27 +527,50 @@ public abstract class ChunkMapDistance { private void a(long i, int j, boolean flag, boolean flag1) { if (flag != flag1) { @@ -364,7 +364,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc }); }, i, true)); } -@@ -410,6 +572,101 @@ public abstract class ChunkMapDistance { +@@ -416,6 +578,101 @@ public abstract class ChunkMapDistance { } @@ -466,7 +466,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc @Override public void a() { super.a(); -@@ -441,6 +698,7 @@ public abstract class ChunkMapDistance { +@@ -447,6 +704,7 @@ public abstract class ChunkMapDistance { } @@ -474,7 +474,7 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc private boolean c(int i) { return i <= this.e - 2; } -@@ -457,6 +715,7 @@ public abstract class ChunkMapDistance { +@@ -463,6 +721,7 @@ public abstract class ChunkMapDistance { this.a.defaultReturnValue((byte) (i + 2)); } @@ -482,11 +482,11 @@ index 6ebc4a4b5c90d8592a017e7b29dec5ca00827432..d0bdffadefa6ed67bd30d833891256cc @Override protected int c(long i) { return this.a.get(i); -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e541e6311 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -443,6 +443,26 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 031979ed14b93f2c5b9567c53c269740ef956de5..0905aa93425a9c85f77ac2f4ffe28ec4ddb9f8b4 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -465,6 +465,26 @@ public class ChunkProviderServer extends IChunkProvider { public void removeTicketAtLevel(TicketType ticketType, ChunkCoordIntPair chunkPos, int ticketLevel, T identifier) { this.chunkMapDistance.removeTicketAtLevel(ticketType, chunkPos, ticketLevel, identifier); } @@ -513,7 +513,7 @@ index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e // Paper end @Nullable -@@ -481,6 +501,8 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -503,6 +523,8 @@ public class ChunkProviderServer extends IChunkProvider { if (!completablefuture.isDone()) { // Paper // Paper start - async chunk io/loading @@ -522,7 +522,7 @@ index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e this.world.asyncChunkTaskManager.raisePriority(x, z, com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGHEST_PRIORITY); com.destroystokyo.paper.io.chunk.ChunkTaskManager.pushChunkWait(this.world, x, z); // Paper end -@@ -489,6 +511,8 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -511,6 +533,8 @@ public class ChunkProviderServer extends IChunkProvider { this.serverThreadQueue.awaitTasks(completablefuture::isDone); com.destroystokyo.paper.io.chunk.ChunkTaskManager.popChunkWait(); // Paper - async chunk debug this.world.timings.syncChunkLoad.stopTiming(); // Paper @@ -531,7 +531,7 @@ index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e } // Paper ichunkaccess = (IChunkAccess) ((Either) completablefuture.join()).map((ichunkaccess1) -> { return ichunkaccess1; -@@ -541,10 +565,12 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -563,10 +587,12 @@ public class ChunkProviderServer extends IChunkProvider { if (flag && !currentlyUnloading) { // CraftBukkit end this.chunkMapDistance.a(TicketType.UNKNOWN, chunkcoordintpair, l, chunkcoordintpair); @@ -544,7 +544,7 @@ index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e this.tickDistanceManager(); playerchunk = this.getChunk(k); gameprofilerfiller.exit(); -@@ -553,8 +579,13 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -575,8 +601,13 @@ public class ChunkProviderServer extends IChunkProvider { } } } @@ -560,7 +560,7 @@ index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e } private boolean a(@Nullable PlayerChunk playerchunk, int i) { -@@ -605,6 +636,7 @@ public class ChunkProviderServer extends IChunkProvider { +@@ -627,6 +658,7 @@ public class ChunkProviderServer extends IChunkProvider { } public boolean tickDistanceManager() { // Paper - private -> public @@ -568,11 +568,11 @@ index 5c092243e3e6f069f9ab6799de56dd60499b3b53..29ec0d9c5e10b19e07cf1ba3c848925e boolean flag = this.chunkMapDistance.a(this.playerChunkMap); boolean flag1 = this.playerChunkMap.b(); -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 6620f0c104a9a71796940e072653d13e193367aa..a7f39878829f1c901934fb2d8b53d906295112e9 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -58,6 +58,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 4c8a324a70dac11251643263eb03e9939bbd1b62..9c30a74dae5df5a187b3384e36cdabc227edd1b9 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -185,6 +185,12 @@ public class EntityPlayer extends EntityHuman implements ICrafting { private int lastArmorScored = Integer.MIN_VALUE; private int lastExpLevelScored = Integer.MIN_VALUE; private int lastExpTotalScored = Integer.MIN_VALUE; @@ -585,7 +585,7 @@ index 6620f0c104a9a71796940e072653d13e193367aa..a7f39878829f1c901934fb2d8b53d906 private float lastHealthSent = -1.0E8F; private int lastFoodSent = -99999999; private boolean lastSentSaturationZero = true; -@@ -145,6 +151,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -272,6 +278,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.maxHealthCache = this.getMaxHealth(); this.cachedSingleMobDistanceMap = new com.destroystokyo.paper.util.PooledHashSets.PooledObjectLinkedOpenHashSet<>(this); // Paper } @@ -607,7 +607,7 @@ index 6620f0c104a9a71796940e072653d13e193367aa..a7f39878829f1c901934fb2d8b53d906 // Yes, this doesn't match Vanilla, but it's the best we can do for now. // If this is an issue, PRs are welcome -@@ -492,6 +513,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -619,6 +640,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { if (valid && !this.isSpectator() || this.world.isLoaded(this.getChunkCoordinates())) { // Paper - don't tick dead players that are not in the world currently (pending respawn) super.tick(); } @@ -615,31 +615,19 @@ index 6620f0c104a9a71796940e072653d13e193367aa..a7f39878829f1c901934fb2d8b53d906 for (int i = 0; i < this.inventory.getSize(); ++i) { ItemStack itemstack = this.inventory.getItem(i); -diff --git a/src/main/java/net/minecraft/server/MCUtil.java b/src/main/java/net/minecraft/server/MCUtil.java -index 0b5ddff008d151ad03a1f382a8f24494356e8701..ff74be14512a947e81b62d53e616131ca7d7f609 100644 ---- a/src/main/java/net/minecraft/server/MCUtil.java -+++ b/src/main/java/net/minecraft/server/MCUtil.java -@@ -656,6 +656,7 @@ public final class MCUtil { - chunkData.addProperty("x", playerChunk.location.x); - chunkData.addProperty("z", playerChunk.location.z); - chunkData.addProperty("ticket-level", playerChunk.getTicketLevel()); -+ chunkData.addProperty("priority", playerChunk.getCurrentPriority()); - chunkData.addProperty("state", PlayerChunk.getChunkState(playerChunk.getTicketLevel()).toString()); - chunkData.addProperty("queued-for-unload", chunkMap.unloadQueue.contains(playerChunk.location.pair())); - chunkData.addProperty("status", status == null ? "unloaded" : status.toString()); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9569784b4 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index e53054fc46e528f9c713eb4c03add61316e19396..cd2c2a680a93d92b1814ce88892bfc763313ca1f 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java @@ -1,6 +1,7 @@ - package net.minecraft.server; + package net.minecraft.server.level; import com.mojang.datafixers.util.Either; +import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; // Paper import it.unimi.dsi.fastutil.shorts.ShortArraySet; import it.unimi.dsi.fastutil.shorts.ShortSet; import java.util.List; -@@ -28,8 +29,8 @@ public class PlayerChunk { +@@ -53,8 +54,8 @@ public class PlayerChunk { private CompletableFuture chunkSave; public int oldTicketLevel; private int ticketLevel; @@ -650,7 +638,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 private boolean p; private final ShortSet[] dirtyBlocks; private int r; -@@ -41,6 +42,7 @@ public class PlayerChunk { +@@ -66,6 +67,7 @@ public class PlayerChunk { private boolean x; private final PlayerChunkMap chunkMap; // Paper @@ -658,7 +646,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 long lastAutoSaveTime; // Paper - incremental autosave long inactiveTimeStart; // Paper - incremental autosave -@@ -68,6 +70,120 @@ public class PlayerChunk { +@@ -93,6 +95,120 @@ public class PlayerChunk { return null; } // Paper end - no-tick view distance @@ -779,7 +767,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 public PlayerChunk(ChunkCoordIntPair chunkcoordintpair, int i, LightEngine lightengine, PlayerChunk.c playerchunk_c, PlayerChunk.d playerchunk_d) { this.statusFutures = new AtomicReferenceArray(PlayerChunk.CHUNK_STATUSES.size()); -@@ -170,6 +286,18 @@ public class PlayerChunk { +@@ -195,6 +311,18 @@ public class PlayerChunk { } return null; } @@ -798,7 +786,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 // Paper end public CompletableFuture> getStatusFutureUnchecked(ChunkStatus chunkstatus) { -@@ -416,6 +544,7 @@ public class PlayerChunk { +@@ -441,6 +569,7 @@ public class PlayerChunk { return this.n; } @@ -806,7 +794,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 private void d(int i) { this.n = i; } -@@ -434,7 +563,7 @@ public class PlayerChunk { +@@ -459,7 +588,7 @@ public class PlayerChunk { // CraftBukkit start // ChunkUnloadEvent: Called before the chunk is unloaded: isChunkLoaded is still true and chunk can still be modified by plugins. if (playerchunk_state.isAtLeast(PlayerChunk.State.BORDER) && !playerchunk_state1.isAtLeast(PlayerChunk.State.BORDER)) { @@ -815,7 +803,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 Chunk chunk = (Chunk)either.left().orElse(null); if (chunk != null) { playerchunkmap.callbackExecutor.execute(() -> { -@@ -499,12 +628,13 @@ public class PlayerChunk { +@@ -524,12 +653,13 @@ public class PlayerChunk { if (!flag2 && flag3) { // Paper start - cache ticking ready status int expectCreateCount = ++this.fullChunkCreateCount; @@ -830,7 +818,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 } -@@ -529,7 +659,7 @@ public class PlayerChunk { +@@ -554,7 +684,7 @@ public class PlayerChunk { if (!flag4 && flag5) { // Paper start - cache ticking ready status @@ -839,7 +827,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 if (either.left().isPresent()) { // note: Here is a very good place to add callbacks to logic waiting on this. Chunk tickingChunk = either.left().get(); -@@ -560,7 +690,7 @@ public class PlayerChunk { +@@ -585,7 +715,7 @@ public class PlayerChunk { } // Paper start - cache ticking ready status @@ -848,7 +836,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 if (either.left().isPresent()) { // note: Here is a very good place to add callbacks to logic waiting on this. Chunk entityTickingChunk = either.left().get(); -@@ -580,12 +710,29 @@ public class PlayerChunk { +@@ -605,12 +735,29 @@ public class PlayerChunk { this.entityTickingFuture = PlayerChunk.UNLOADED_CHUNK_FUTURE; } @@ -880,7 +868,7 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 Chunk chunk = (Chunk)either.left().orElse(null); if (chunk != null) { playerchunkmap.callbackExecutor.execute(() -> { -@@ -667,6 +814,7 @@ public class PlayerChunk { +@@ -692,6 +839,7 @@ public class PlayerChunk { public interface c { @@ -888,10 +876,10 @@ index f3d5ea4672f950bd5c52b718f2e1e0280175ccb9..3d95c7cd5d34166a427b45061bce2ac9 void a(ChunkCoordIntPair chunkcoordintpair, IntSupplier intsupplier, int i, IntConsumer intconsumer); } -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f6706091bb4 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 76a5310ea35dc6fe482ecfdea8866df0598444c8..8585e5da1fed256038f41d50c6ecd1ddb54a7bd0 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java @@ -14,6 +14,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectMap; import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ByteMap; @@ -900,7 +888,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectMap.Entry; import it.unimi.dsi.fastutil.longs.LongIterator; -@@ -53,6 +54,7 @@ import org.apache.logging.log4j.LogManager; +@@ -97,6 +98,7 @@ import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.bukkit.entity.Player; // CraftBukkit @@ -908,7 +896,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { -@@ -90,6 +92,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -134,6 +136,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { public final WorldServer world; private final LightEngineThreaded lightEngine; private final IAsyncTaskHandler executor; @@ -916,7 +904,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 public final ChunkGenerator chunkGenerator; private final Supplier l; public final Supplier getWorldPersistentDataSupplier() { return this.l; } // Paper - OBFHELPER private final VillagePlace m; -@@ -127,6 +130,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -171,6 +174,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public void execute(Runnable runnable) { @@ -924,7 +912,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 if (queued == null) { queued = new java.util.ArrayDeque<>(); } -@@ -135,6 +139,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -179,6 +183,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public void run() { @@ -932,7 +920,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 if (queued == null) { return; } -@@ -289,6 +294,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -333,6 +338,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.world = worldserver; this.chunkGenerator = chunkgenerator; this.executor = iasynctaskhandler; @@ -948,7 +936,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 ThreadedMailbox threadedmailbox = ThreadedMailbox.a(executor, "worldgen"); iasynctaskhandler.getClass(); -@@ -383,6 +397,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -427,6 +441,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { this.playerViewDistanceTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet newState) -> { @@ -956,7 +944,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 if (newState.size() != 1) { return; } -@@ -401,7 +416,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -445,7 +460,11 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(rangeX, rangeZ); PlayerChunkMap.this.world.getChunkProvider().removeTicketAtLevel(TicketType.PLAYER, chunkPos, 31, chunkPos); // entity ticking level, TODO check on update @@ -969,7 +957,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 this.playerViewDistanceNoTickMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets); this.playerViewDistanceBroadcastMap = new com.destroystokyo.paper.util.misc.PlayerAreaMap(this.pooledLinkedPlayerHashSets, (EntityPlayer player, int rangeX, int rangeZ, int currPosX, int currPosZ, int prevPosX, int prevPosZ, -@@ -418,6 +437,115 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -462,6 +481,115 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }); // Paper end - no-tick view distance } @@ -1085,7 +1073,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 public void updatePlayerMobTypeMap(Entity entity) { if (!this.world.paperConfig.perPlayerMobSpawns) { -@@ -547,6 +675,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -591,6 +719,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { List>> list = Lists.newArrayList(); int j = chunkcoordintpair.x; int k = chunkcoordintpair.z; @@ -1093,7 +1081,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 for (int l = -i; l <= i; ++l) { for (int i1 = -i; i1 <= i; ++i1) { -@@ -565,6 +694,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -609,6 +738,14 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { ChunkStatus chunkstatus = (ChunkStatus) intfunction.apply(j1); CompletableFuture> completablefuture = playerchunk.a(chunkstatus, this); @@ -1108,7 +1096,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 list.add(completablefuture); } -@@ -1032,14 +1169,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1076,14 +1213,22 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { }; CompletableFuture chunkSaveFuture = this.world.asyncChunkTaskManager.getChunkSaveFuture(chunkcoordintpair.x, chunkcoordintpair.z); @@ -1136,7 +1124,7 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 return ret; // Paper end } -@@ -1176,7 +1321,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1220,7 +1365,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { long i = playerchunk.i().pair(); playerchunk.getClass(); @@ -1145,53 +1133,10 @@ index 126f94eaf8b328e5ca0133c61f92c52197c498dd..897496d669eafdbbacebb1d393ee3f67 }); } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index c33d87d9c3ce2c258a5e782768eac491538a2836..99dddcaac05cf6496fdfd3a824b42ff4336e00c5 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1383,6 +1383,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - - this.A = this.e; - this.player.setLocation(d0, d1, d2, f, f1); -+ this.player.forceCheckHighPriority(); // Paper - this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); - } - -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6c96a7123fb28cfadf129c4ba8688f13539583d6..6cbb49a728704491ba41fdf9463b8438985e0d1d 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -193,8 +193,8 @@ public abstract class PlayerList { - final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); - PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; - playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); -- worldserver1.getChunkProvider().tickDistanceManager(); -- worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { -+ worldserver1.getChunkProvider().markAreaHighPriority(pos, 28, 3); -+ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { - PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair()); - if (updatingChunk != null) { - return updatingChunk.getEntityTickingFuture(); -@@ -614,6 +614,7 @@ public abstract class PlayerList { - SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress(); - - EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(World.OVERWORLD))); -+ entity.isRealPlayer = true; // Paper - Player player = entity.getBukkitEntity(); - PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); - -@@ -820,6 +821,7 @@ public abstract class PlayerList { - // CraftBukkit end - - worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper -+ entityplayer1.forceCheckHighPriority(); // Player - while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { - entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); - } -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index 7a8397815a5b7f79f3e3a0348aeedf63fe879f8f..b5030d6f5d917ba33fb3c40903384fa7a56bc5f1 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java +index e06fe77f6ea05a93e95fce223bcfd0d16394f96f..90cbd12611b7b078f35f08f910453bcc02f6665b 100644 +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -8,6 +8,7 @@ public final class Ticket implements Comparable> { private final int b; public final T identifier; public final T getObjectReason() { return this.identifier; } // Paper - OBFHELPER @@ -1208,11 +1153,11 @@ index 7a8397815a5b7f79f3e3a0348aeedf63fe879f8f..b5030d6f5d917ba33fb3c40903384fa7 protected void a(long i) { this.d = i; } -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index d7b9d9fd3a3b607278a3d72b0b306b0be2aa30ad..6fd852db6bcfbfbf84ec2acf6d23b08a6051165c 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -24,6 +24,8 @@ public class TicketType { +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index 2c932d36f982e7f8713aabff9a6c631055810366..f5d18834e0e2ee0e3bcf55810456766d2f134450 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -28,6 +28,8 @@ public class TicketType { public static final TicketType PLUGIN_TICKET = a("plugin_ticket", (plugin1, plugin2) -> plugin1.getClass().getName().compareTo(plugin2.getClass().getName())); // CraftBukkit public static final TicketType FUTURE_AWAIT = a("future_await", Long::compareTo); // Paper public static final TicketType ASYNC_LOAD = a("async_load", Long::compareTo); // Paper @@ -1221,11 +1166,66 @@ index d7b9d9fd3a3b607278a3d72b0b306b0be2aa30ad..6fd852db6bcfbfbf84ec2acf6d23b08a public static TicketType a(String s, Comparator comparator) { return new TicketType<>(s, comparator, 0L); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 5cd8ee9a9099cd435735c3d9a2194f86232db45f..c42b981038fcca80de0ac293bef6a78697d3818f 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1527,6 +1527,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + + this.A = this.e; + this.player.setLocation(d0, d1, d2, f, f1); ++ this.player.forceCheckHighPriority(); // Paper + this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); + } + +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 2067213bdf592a0882e82c1fe247ad73d8a316da..141166a4e3aaf811debdd20694c953ef771fc8ac 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -268,8 +268,8 @@ public abstract class PlayerList { + final ChunkCoordIntPair pos = new ChunkCoordIntPair(chunkX, chunkZ); + PlayerChunkMap playerChunkMap = worldserver1.getChunkProvider().playerChunkMap; + playerChunkMap.chunkDistanceManager.addTicketAtLevel(TicketType.LOGIN, pos, 31, pos.pair()); +- worldserver1.getChunkProvider().tickDistanceManager(); +- worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, true).thenApply(chunk -> { ++ worldserver1.getChunkProvider().markAreaHighPriority(pos, 28, 3); ++ worldserver1.getChunkProvider().getChunkAtAsynchronously(chunkX, chunkZ, true, false).thenApply(chunk -> { + PlayerChunk updatingChunk = playerChunkMap.getUpdatingChunk(pos.pair()); + if (updatingChunk != null) { + return updatingChunk.getEntityTickingFuture(); +@@ -689,6 +689,7 @@ public abstract class PlayerList { + SocketAddress socketaddress = loginlistener.networkManager.getSocketAddress(); + + EntityPlayer entity = new EntityPlayer(this.server, this.server.getWorldServer(World.OVERWORLD), gameprofile, new PlayerInteractManager(this.server.getWorldServer(World.OVERWORLD))); ++ entity.isRealPlayer = true; // Paper + Player player = entity.getBukkitEntity(); + PlayerLoginEvent event = new PlayerLoginEvent(player, hostname, ((java.net.InetSocketAddress) socketaddress).getAddress(), ((java.net.InetSocketAddress) loginlistener.networkManager.getRawAddress()).getAddress()); + +@@ -895,6 +896,7 @@ public abstract class PlayerList { + // CraftBukkit end + + worldserver1.getChunkProvider().addTicket(TicketType.POST_TELEPORT, new ChunkCoordIntPair(location.getBlockX() >> 4, location.getBlockZ() >> 4), 1, entityplayer.getId()); // Paper ++ entityplayer1.forceCheckHighPriority(); // Player + while (avoidSuffocation && !worldserver1.getCubes(entityplayer1) && entityplayer1.locY() < 256.0D) { + entityplayer1.setPosition(entityplayer1.locX(), entityplayer1.locY() + 1.0D, entityplayer1.locZ()); + } +diff --git a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +index 9a88791be443a5b18934e7d752aee6dcdb8aa38f..e41d63596c32eee5f0c04a6f043d576d8021ff1a 100644 +--- a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +@@ -104,6 +104,7 @@ public class ChunkCoordIntPair { + return "[" + this.x + ", " + this.z + "]"; + } + ++ public final BlockPosition asPosition() { return l(); } // Paper - OBFHELPER + public BlockPosition l() { + return new BlockPosition(this.d(), 0, this.e()); + } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 6fc4b59a750572b6d3b9d23fe490d7e5dc5271a5..59a9684d16d702777d834c64ebdcef0ef5a22623 100644 +index 70002819b0c18cce4e907678ca3d3e4e8f7cc70a..fa2f6f737b41157b90f455b65d41b1e51fcb4eb5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2544,6 +2544,10 @@ public class CraftWorld implements World { +@@ -2541,6 +2541,10 @@ public class CraftWorld implements World { return future; } @@ -1234,10 +1234,10 @@ index 6fc4b59a750572b6d3b9d23fe490d7e5dc5271a5..59a9684d16d702777d834c64ebdcef0e + world.getChunkProvider().markHighPriority(new ChunkCoordIntPair(x, z), 1); + } return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); + net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null); return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6f20a5b9c96c14ca5fc18c3e4bfe2656c3cb4b63..8a34261c0fdfae3526646ddf14bc9a7b5dedc3b5 100644 +index ebdb72c7967cd0091a47c1634be011cd81b555f9..b00f8dbe7398ea7711b50adaa6061b3e2026b8b6 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -848,6 +848,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0487-Optimize-sending-packets-to-nearby-locations-sounds-.patch b/Spigot-Server-Patches/0487-Optimize-sending-packets-to-nearby-locations-sounds-.patch index 705b52fd7d..8a241bbb80 100644 --- a/Spigot-Server-Patches/0487-Optimize-sending-packets-to-nearby-locations-sounds-.patch +++ b/Spigot-Server-Patches/0487-Optimize-sending-packets-to-nearby-locations-sounds-.patch @@ -10,11 +10,11 @@ is originating from. This will drastically cut down on packet sending cost for worlds with lots of players in them. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6cbb49a728704491ba41fdf9463b8438985e0d1d..6d6fb9012b67e1c93c0141eb59bdcfdf65de71db 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1071,16 +1071,40 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 141166a4e3aaf811debdd20694c953ef771fc8ac..ead0079e3d6f338c34f8589067c4d1bf0be2b83f 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1146,16 +1146,40 @@ public abstract class PlayerList { } public void sendPacketNearby(@Nullable EntityHuman entityhuman, double d0, double d1, double d2, double d3, ResourceKey resourcekey, Packet packet) { diff --git a/Spigot-Server-Patches/0488-Improve-Chunk-Status-Transition-Speed.patch b/Spigot-Server-Patches/0488-Improve-Chunk-Status-Transition-Speed.patch index 3b2012f7fe..2894032e28 100644 --- a/Spigot-Server-Patches/0488-Improve-Chunk-Status-Transition-Speed.patch +++ b/Spigot-Server-Patches/0488-Improve-Chunk-Status-Transition-Speed.patch @@ -35,11 +35,11 @@ scenario / path: Previously would have hopped to SERVER around 12+ times there extra. -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 3d95c7cd5d34166a427b45061bce2ac9569784b4..0799970f90527f97d64eb857a0b07990114c7ab2 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -58,6 +58,13 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index cd2c2a680a93d92b1814ce88892bfc763313ca1f..48b87ed945a71b97d8a88cbaf4099dc966a8ab88 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -83,6 +83,13 @@ public class PlayerChunk { this.playersInChunkTickRange = this.chunkMap.playerChunkTickRangeMap.getObjectsInRange(key); } // Paper end - optimise isOutsideOfRange @@ -53,11 +53,11 @@ index 3d95c7cd5d34166a427b45061bce2ac9569784b4..0799970f90527f97d64eb857a0b07990 // Paper start - no-tick view distance public final Chunk getSendingChunk() { -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 897496d669eafdbbacebb1d393ee3f6706091bb4..b1c332b79bfa00e89c6d3aca327b88fe94c3bba1 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -742,7 +742,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 8585e5da1fed256038f41d50c6ecd1ddb54a7bd0..4441af38184adefdf686429d1d147b9bbb76b5a6 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -786,7 +786,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return either.mapLeft((list) -> { return (Chunk) list.get(list.size() / 2); }); @@ -66,7 +66,7 @@ index 897496d669eafdbbacebb1d393ee3f6706091bb4..b1c332b79bfa00e89c6d3aca327b88fe } @Nullable -@@ -1092,7 +1092,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1136,7 +1136,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { IChunkAccess ichunkaccess = (IChunkAccess) optional.get(); if (ichunkaccess.getChunkStatus().b(chunkstatus)) { @@ -75,7 +75,7 @@ index 897496d669eafdbbacebb1d393ee3f6706091bb4..b1c332b79bfa00e89c6d3aca327b88fe if (chunkstatus == ChunkStatus.LIGHT) { completablefuture1 = this.b(playerchunk, chunkstatus); -@@ -1108,7 +1108,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1152,7 +1152,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return this.b(playerchunk, chunkstatus); } } @@ -84,7 +84,7 @@ index 897496d669eafdbbacebb1d393ee3f6706091bb4..b1c332b79bfa00e89c6d3aca327b88fe } } -@@ -1229,6 +1229,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -1273,6 +1273,12 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { return CompletableFuture.completedFuture(Either.right(playerchunk_failure)); }); }, (runnable) -> { diff --git a/Spigot-Server-Patches/0489-Fix-villager-trading-demand-MC-163962.patch b/Spigot-Server-Patches/0489-Fix-villager-trading-demand-MC-163962.patch index 96152b810e..b6b2585f20 100644 --- a/Spigot-Server-Patches/0489-Fix-villager-trading-demand-MC-163962.patch +++ b/Spigot-Server-Patches/0489-Fix-villager-trading-demand-MC-163962.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix villager trading demand - MC-163962 Prevent demand from going negative and tending to negative infinity -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java -index 2865fa7018c3631fbcaaaaa2892219d9cab713d3..e42382a5c385c27b6322b03e87870eb20b21cb22 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipe.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java -@@ -104,7 +104,7 @@ public class MerchantRecipe { +diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java +index d840c657a6a992c86364a5f4536da0b217515c53..9e2fe0d5e6d4ea1f4c9cea96b755ddcd1e3c9009 100644 +--- a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java ++++ b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java +@@ -109,7 +109,7 @@ public class MerchantRecipe { } public void e() { diff --git a/Spigot-Server-Patches/0490-Maps-shouldn-t-load-chunks.patch b/Spigot-Server-Patches/0490-Maps-shouldn-t-load-chunks.patch index 34d198574b..28c169e754 100644 --- a/Spigot-Server-Patches/0490-Maps-shouldn-t-load-chunks.patch +++ b/Spigot-Server-Patches/0490-Maps-shouldn-t-load-chunks.patch @@ -14,11 +14,11 @@ Previously maps would load all chunks in a certain radius depending on eventually anyways and that maps will get checked for update every five ticks that movement occur in anyways. -diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java -index c6feee870be41188b5bced4bb9a8ae1b4e53c942..63b112b38a51873cf5769ad8506c3fdb9d52d42c 100644 ---- a/src/main/java/net/minecraft/server/ItemWorldMap.java -+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java -@@ -96,9 +96,9 @@ public class ItemWorldMap extends ItemWorldMapBase { +diff --git a/src/main/java/net/minecraft/world/item/ItemWorldMap.java b/src/main/java/net/minecraft/world/item/ItemWorldMap.java +index b18149cf048e78fefc019b50ed8f20ff8b609f5c..a1945e9ac1dd8961c5758a22bef3908d3adf0704 100644 +--- a/src/main/java/net/minecraft/world/item/ItemWorldMap.java ++++ b/src/main/java/net/minecraft/world/item/ItemWorldMap.java +@@ -120,9 +120,9 @@ public class ItemWorldMap extends ItemWorldMapBase { int k2 = (j / i + k1 - 64) * i; int l2 = (k / i + l1 - 64) * i; Multiset multiset = LinkedHashMultiset.create(); diff --git a/Spigot-Server-Patches/0491-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch b/Spigot-Server-Patches/0491-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch index e2d64ce4cd..590f6fd281 100644 --- a/Spigot-Server-Patches/0491-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch +++ b/Spigot-Server-Patches/0491-Use-seed-based-lookup-for-Treasure-Maps-Fixes-lag-fr.patch @@ -5,24 +5,11 @@ Subject: [PATCH] Use seed based lookup for Treasure Maps - Fixes lag from carto/sunken maps -diff --git a/src/main/java/net/minecraft/server/ItemWorldMap.java b/src/main/java/net/minecraft/server/ItemWorldMap.java -index 63b112b38a51873cf5769ad8506c3fdb9d52d42c..910d1b3788fa713cadf2c8a56f595282ba6c1247 100644 ---- a/src/main/java/net/minecraft/server/ItemWorldMap.java -+++ b/src/main/java/net/minecraft/server/ItemWorldMap.java -@@ -229,7 +229,7 @@ public class ItemWorldMap extends ItemWorldMapBase { - - for (l = 0; l < 128 * i; ++l) { - for (i1 = 0; i1 < 128 * i; ++i1) { -- abiomebase[l * 128 * i + i1] = worldserver.getBiome(new BlockPosition((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)); -+ abiomebase[l * 128 * i + i1] = worldserver.getBiomeBySeed((j / i - 64) * i + i1, 0, (k / i - 64) * i + l); // Paper - } - } - -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 5d299a65417ff17eae3dfe52841c1a27a6d75677..bb73dc2cfca633f85aa0aa1c988d3cdd86be8e4e 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -307,8 +307,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index b294337a586193870fcdbfe1697703137f4ae626..117772867eede63646d80bb7af4792a2db16d815 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -416,8 +416,8 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.worldDataServer.setThundering(flag1); } @@ -33,3 +20,16 @@ index 5d299a65417ff17eae3dfe52841c1a27a6d75677..bb73dc2cfca633f85aa0aa1c988d3cdd return this.getChunkProvider().getChunkGenerator().getWorldChunkManager().getBiome(i, j, k); } +diff --git a/src/main/java/net/minecraft/world/item/ItemWorldMap.java b/src/main/java/net/minecraft/world/item/ItemWorldMap.java +index a1945e9ac1dd8961c5758a22bef3908d3adf0704..3aa0f19d4a924d40005a38bb95a08d4a109c5b2e 100644 +--- a/src/main/java/net/minecraft/world/item/ItemWorldMap.java ++++ b/src/main/java/net/minecraft/world/item/ItemWorldMap.java +@@ -253,7 +253,7 @@ public class ItemWorldMap extends ItemWorldMapBase { + + for (l = 0; l < 128 * i; ++l) { + for (i1 = 0; i1 < 128 * i; ++i1) { +- abiomebase[l * 128 * i + i1] = worldserver.getBiome(new BlockPosition((j / i - 64) * i + i1, 0, (k / i - 64) * i + l)); ++ abiomebase[l * 128 * i + i1] = worldserver.getBiomeBySeed((j / i - 64) * i + i1, 0, (k / i - 64) * i + l); // Paper + } + } + diff --git a/Spigot-Server-Patches/0492-Optimize-Bit-Operations-by-inlining.patch b/Spigot-Server-Patches/0492-Optimize-Bit-Operations-by-inlining.patch index c709d0527d..3e547b0e89 100644 --- a/Spigot-Server-Patches/0492-Optimize-Bit-Operations-by-inlining.patch +++ b/Spigot-Server-Patches/0492-Optimize-Bit-Operations-by-inlining.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Optimize Bit Operations by inlining Inline bit operations and reduce instruction count to make these hot operations faster -diff --git a/src/main/java/net/minecraft/server/BlockPosition.java b/src/main/java/net/minecraft/server/BlockPosition.java -index 52ae74571b0d671a294900caedaa400b62d4ea34..2d887af902a33b0e28d8f0a6ac2e59c815a7856e 100644 ---- a/src/main/java/net/minecraft/server/BlockPosition.java -+++ b/src/main/java/net/minecraft/server/BlockPosition.java -@@ -25,14 +25,16 @@ public class BlockPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/BlockPosition.java b/src/main/java/net/minecraft/core/BlockPosition.java +index 1fb931d4c0720a5e496030e25c865771aea3ec70..eb67af795dd716d9f92ac32843accc1ec4efd647 100644 +--- a/src/main/java/net/minecraft/core/BlockPosition.java ++++ b/src/main/java/net/minecraft/core/BlockPosition.java +@@ -31,14 +31,16 @@ public class BlockPosition extends BaseBlockPosition { }).stable(); private static final Logger LOGGER = LogManager.getLogger(); public static final BlockPosition ZERO = new BlockPosition(0, 0, 0); @@ -35,7 +35,7 @@ index 52ae74571b0d671a294900caedaa400b62d4ea34..2d887af902a33b0e28d8f0a6ac2e59c8 public BlockPosition(int i, int j, int k) { super(i, j, k); -@@ -54,28 +56,29 @@ public class BlockPosition extends BaseBlockPosition { +@@ -60,28 +62,29 @@ public class BlockPosition extends BaseBlockPosition { this(baseblockposition.getX(), baseblockposition.getY(), baseblockposition.getZ()); } @@ -70,7 +70,7 @@ index 52ae74571b0d671a294900caedaa400b62d4ea34..2d887af902a33b0e28d8f0a6ac2e59c8 } public long asLong() { -@@ -84,12 +87,7 @@ public class BlockPosition extends BaseBlockPosition { +@@ -90,12 +93,7 @@ public class BlockPosition extends BaseBlockPosition { public static long asLong(int x, int y, int z) { return a(x, y, z); } // Paper - OBFHELPER public static long a(int i, int j, int k) { @@ -84,11 +84,11 @@ index 52ae74571b0d671a294900caedaa400b62d4ea34..2d887af902a33b0e28d8f0a6ac2e59c8 } public static long f(long i) { -diff --git a/src/main/java/net/minecraft/server/SectionPosition.java b/src/main/java/net/minecraft/server/SectionPosition.java -index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175c6ac080f 100644 ---- a/src/main/java/net/minecraft/server/SectionPosition.java -+++ b/src/main/java/net/minecraft/server/SectionPosition.java -@@ -16,7 +16,7 @@ public class SectionPosition extends BaseBlockPosition { +diff --git a/src/main/java/net/minecraft/core/SectionPosition.java b/src/main/java/net/minecraft/core/SectionPosition.java +index 97126ae5a43bb7acb04a1ab14fb7f364c8c2675f..7d9a16eb81288b74425319c60525f57c98ad3b69 100644 +--- a/src/main/java/net/minecraft/core/SectionPosition.java ++++ b/src/main/java/net/minecraft/core/SectionPosition.java +@@ -19,7 +19,7 @@ public class SectionPosition extends BaseBlockPosition { } public static SectionPosition a(BlockPosition blockposition) { @@ -97,7 +97,7 @@ index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175 } public static SectionPosition a(ChunkCoordIntPair chunkcoordintpair, int i) { -@@ -28,15 +28,23 @@ public class SectionPosition extends BaseBlockPosition { +@@ -31,15 +31,23 @@ public class SectionPosition extends BaseBlockPosition { } public static SectionPosition a(long i) { @@ -123,7 +123,7 @@ index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175 } public static int a(int i) { -@@ -48,11 +56,7 @@ public class SectionPosition extends BaseBlockPosition { +@@ -51,11 +59,7 @@ public class SectionPosition extends BaseBlockPosition { } public static short b(BlockPosition blockposition) { @@ -136,7 +136,7 @@ index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175 } public static int a(short short0) { -@@ -111,16 +115,16 @@ public class SectionPosition extends BaseBlockPosition { +@@ -114,16 +118,16 @@ public class SectionPosition extends BaseBlockPosition { return this.getZ(); } @@ -159,7 +159,7 @@ index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175 } public int g() { -@@ -135,8 +139,10 @@ public class SectionPosition extends BaseBlockPosition { +@@ -138,8 +142,10 @@ public class SectionPosition extends BaseBlockPosition { return (this.c() << 4) + 15; } @@ -171,7 +171,7 @@ index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175 } public static long f(long i) { -@@ -157,17 +163,18 @@ public class SectionPosition extends BaseBlockPosition { +@@ -160,17 +166,18 @@ public class SectionPosition extends BaseBlockPosition { return new ChunkCoordIntPair(this.a(), this.c()); } @@ -197,7 +197,7 @@ index 8d325ec19c5d954785732d8e295b4ba150f740ca..f95925f1c5d091f1a129d0437bb6e175 } public Stream t() { -@@ -175,18 +182,11 @@ public class SectionPosition extends BaseBlockPosition { +@@ -178,18 +185,11 @@ public class SectionPosition extends BaseBlockPosition { } public static Stream a(SectionPosition sectionposition, int i) { diff --git a/Spigot-Server-Patches/0493-Optimize-Light-Engine.patch b/Spigot-Server-Patches/0493-Optimize-Light-Engine.patch index b4254aaceb..a85f37e515 100644 --- a/Spigot-Server-Patches/0493-Optimize-Light-Engine.patch +++ b/Spigot-Server-Patches/0493-Optimize-Light-Engine.patch @@ -24,11 +24,11 @@ Massive update to light to improve performance and chunk loading/generation. 7) Buffer non urgent tasks even if queueUpdate is called multiple times to improve efficiency. 8) Fix NPE risk that crashes server in getting nibble data -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 29ec0d9c5e10b19e07cf1ba3c848925e541e6311..12e417d2fe8e7f6a2f664ef916c141305ce1b29c 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -1045,7 +1045,7 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 0905aa93425a9c85f77ac2f4ffe28ec4ddb9f8b4..3a7b7df4080c04b618dfaf0b47cc54293332c41d 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -1067,7 +1067,7 @@ public class ChunkProviderServer extends IChunkProvider { if (ChunkProviderServer.this.tickDistanceManager()) { return true; } else { @@ -37,139 +37,11 @@ index 29ec0d9c5e10b19e07cf1ba3c848925e541e6311..12e417d2fe8e7f6a2f664ef916c14130 return super.executeNext() || execChunkTask; // Paper } } finally { -diff --git a/src/main/java/net/minecraft/server/LightEngineBlock.java b/src/main/java/net/minecraft/server/LightEngineBlock.java -index 4db28b9a9b8a1e91911126172c6670c252dd49cb..636ed196d53971a3d0dc67d3e83032a9114b603b 100644 ---- a/src/main/java/net/minecraft/server/LightEngineBlock.java -+++ b/src/main/java/net/minecraft/server/LightEngineBlock.java -@@ -13,9 +13,11 @@ public final class LightEngineBlock extends LightEngineLayer> 38); -+ int k = (int) ((i << 52) >> 52); -+ int l = (int) ((i << 26) >> 38); -+ // Paper end - IBlockAccess iblockaccess = this.a.c(j >> 4, l >> 4); - - return iblockaccess != null ? iblockaccess.g(this.f.d(j, k, l)) : 0; -@@ -30,25 +32,33 @@ public final class LightEngineBlock extends LightEngineLayer= 15) { - return k; - } else { -- int l = Integer.signum(BlockPosition.b(j) - BlockPosition.b(i)); -- int i1 = Integer.signum(BlockPosition.c(j) - BlockPosition.c(i)); -- int j1 = Integer.signum(BlockPosition.d(j) - BlockPosition.d(i)); -+ // Paper start - reuse math - credit to JellySquid for idea -+ int jx = (int) (j >> 38); -+ int jy = (int) ((j << 52) >> 52); -+ int jz = (int) ((j << 26) >> 38); -+ int ix = (int) (i >> 38); -+ int iy = (int) ((i << 52) >> 52); -+ int iz = (int) ((i << 26) >> 38); -+ int l = Integer.signum(jx - ix); -+ int i1 = Integer.signum(jy - iy); -+ int j1 = Integer.signum(jz - iz); -+ // Paper end - EnumDirection enumdirection = EnumDirection.a(l, i1, j1); - - if (enumdirection == null) { - return 15; - } else { - //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded -- IBlockData iblockdata = this.a(j, mutableint); -- -- if (mutableint.getValue() >= 15) { -+ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); // Paper -+ int blockedLight = mutableint.getValue(); // Paper -+ if (blockedLight >= 15) { // Paper - return 15; - } else { -- IBlockData iblockdata1 = this.a(i, (MutableInt) null); -+ IBlockData iblockdata1 = this.getBlockOptimized(ix, iy, iz); // Paper - VoxelShape voxelshape = this.a(iblockdata1, i, enumdirection); - VoxelShape voxelshape1 = this.a(iblockdata, j, enumdirection.opposite()); - -- return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, mutableint.getValue()); -+ return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, blockedLight); // Paper - } - } - } -@@ -56,14 +66,19 @@ public final class LightEngineBlock extends LightEngineLayer> 38); -+ int y = (int) ((i << 52) >> 52); -+ int z = (int) ((i << 26) >> 38); -+ long k = SectionPosition.blockPosAsSectionLong(x, y, z); -+ // Paper end - EnumDirection[] aenumdirection = LightEngineBlock.e; - int l = aenumdirection.length; - - for (int i1 = 0; i1 < l; ++i1) { - EnumDirection enumdirection = aenumdirection[i1]; -- long j1 = BlockPosition.a(i, enumdirection); -- long k1 = SectionPosition.e(j1); -+ long j1 = BlockPosition.getAdjacent(x, y, z, enumdirection); // Paper -+ long k1 = SectionPosition.getAdjacentFromBlockPos(x, y, z, enumdirection); // Paper - - if (k == k1 || ((LightEngineStorageBlock) this.c).g(k1)) { - this.b(i, j1, j, flag); -@@ -88,27 +103,37 @@ public final class LightEngineBlock extends LightEngineLayer> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); -+ // Paper end - EnumDirection[] aenumdirection = LightEngineBlock.e; - int k1 = aenumdirection.length; - - for (int l1 = 0; l1 < k1; ++l1) { - EnumDirection enumdirection = aenumdirection[l1]; -- long i2 = BlockPosition.a(i, enumdirection); -+ // Paper start -+ int newX = baseX + enumdirection.getAdjacentX(); -+ int newY = baseY + enumdirection.getAdjacentY(); -+ int newZ = baseZ + enumdirection.getAdjacentZ(); -+ long i2 = BlockPosition.asLong(newX, newY, newZ); - - if (i2 != j) { -- long j2 = SectionPosition.e(i2); -+ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); -+ // Paper end - NibbleArray nibblearray1; - - if (j1 == j2) { - nibblearray1 = nibblearray; - } else { -- nibblearray1 = ((LightEngineStorageBlock) this.c).a(j2, true); -+ nibblearray1 = ((LightEngineStorageBlock) this.c).updating.getUpdatingOptimized(j2); // Paper - } - - if (nibblearray1 != null) { -- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); -+ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper - - if (l > k2) { - l = k2; -diff --git a/src/main/java/net/minecraft/server/LightEngineGraphSection.java b/src/main/java/net/minecraft/server/LightEngineGraphSection.java -index 2eb37fb5796d423a70fa7321899a19b6625bbecc..13d067f48647dea63ef1bf3a2a3e0868074ba75f 100644 ---- a/src/main/java/net/minecraft/server/LightEngineGraphSection.java -+++ b/src/main/java/net/minecraft/server/LightEngineGraphSection.java -@@ -13,14 +13,20 @@ public abstract class LightEngineGraphSection extends LightEngineGraph { +diff --git a/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java b/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java +index c8bb040e7ed848877ec9c2f9b30dcda137cadf35..4ee7070364a8989eece4fa4237b529926821f9c9 100644 +--- a/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java ++++ b/src/main/java/net/minecraft/server/level/LightEngineGraphSection.java +@@ -16,14 +16,20 @@ public abstract class LightEngineGraphSection extends LightEngineGraph { @Override protected void a(long i, int j, boolean flag) { @@ -193,7 +65,7 @@ index 2eb37fb5796d423a70fa7321899a19b6625bbecc..13d067f48647dea63ef1bf3a2a3e0868 } } } -@@ -31,10 +37,15 @@ public abstract class LightEngineGraphSection extends LightEngineGraph { +@@ -34,10 +40,15 @@ public abstract class LightEngineGraphSection extends LightEngineGraph { protected int a(long i, long j, int k) { int l = k; @@ -210,835 +82,19 @@ index 2eb37fb5796d423a70fa7321899a19b6625bbecc..13d067f48647dea63ef1bf3a2a3e0868 if (l1 == i) { l1 = Long.MAX_VALUE; -diff --git a/src/main/java/net/minecraft/server/LightEngineLayer.java b/src/main/java/net/minecraft/server/LightEngineLayer.java -index 3e9731bcdd4c6370c11ffc93f9fafcaf60fe932b..b5d5dd1075fd6aabbfbbd60f219b76593fc54a76 100644 ---- a/src/main/java/net/minecraft/server/LightEngineLayer.java -+++ b/src/main/java/net/minecraft/server/LightEngineLayer.java -@@ -11,10 +11,37 @@ public abstract class LightEngineLayer, S e - protected final EnumSkyBlock b; - protected final S c; - private boolean f; -- protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); -+ protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); protected final BlockPosition.MutableBlockPosition pos = d; // Paper - private final long[] g = new long[2]; -- private final IBlockAccess[] h = new IBlockAccess[2]; -+ private final IChunkAccess[] h = new IChunkAccess[2]; // Paper - -+ // Paper start - see fully commented out method below (look for Bedrock) -+ // optimized method with less branching for when scenarios arent needed. -+ // avoid using mutable version if can -+ protected final IBlockData getBlockOptimized(int x, int y, int z, MutableInt mutableint) { -+ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); -+ -+ if (iblockaccess == null) { -+ mutableint.setValue(16); -+ return Blocks.BEDROCK.getBlockData(); -+ } else { -+ this.pos.setValues(x, y, z); -+ IBlockData iblockdata = iblockaccess.getType(x, y, z); -+ mutableint.setValue(iblockdata.b(this.a.getWorld(), this.pos)); -+ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); -+ } -+ } -+ protected final IBlockData getBlockOptimized(int x, int y, int z) { -+ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); -+ -+ if (iblockaccess == null) { -+ return Blocks.BEDROCK.getBlockData(); -+ } else { -+ IBlockData iblockdata = iblockaccess.getType(x, y, z); -+ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); -+ } -+ } -+ // Paper end - public LightEngineLayer(ILightAccess ilightaccess, EnumSkyBlock enumskyblock, S s0) { - super(16, 256, 8192); - this.a = ilightaccess; -@@ -33,7 +60,7 @@ public abstract class LightEngineLayer, S e - } - - @Nullable -- private IBlockAccess a(int i, int j) { -+ private IChunkAccess a(int i, int j) { // Paper - long k = ChunkCoordIntPair.pair(i, j); - - for (int l = 0; l < 2; ++l) { -@@ -42,7 +69,7 @@ public abstract class LightEngineLayer, S e - } - } - -- IBlockAccess iblockaccess = this.a.c(i, j); -+ IChunkAccess iblockaccess = (IChunkAccess) this.a.c(i, j); // Paper - - for (int i1 = 1; i1 > 0; --i1) { - this.g[i1] = this.g[i1 - 1]; -@@ -59,37 +86,39 @@ public abstract class LightEngineLayer, S e - Arrays.fill(this.h, (Object) null); - } - -- protected IBlockData a(long i, @Nullable MutableInt mutableint) { -- if (i == Long.MAX_VALUE) { -- if (mutableint != null) { -- mutableint.setValue(0); -- } -- -- return Blocks.AIR.getBlockData(); -- } else { -- int j = SectionPosition.a(BlockPosition.b(i)); -- int k = SectionPosition.a(BlockPosition.d(i)); -- IBlockAccess iblockaccess = this.a(j, k); -- -- if (iblockaccess == null) { -- if (mutableint != null) { -- mutableint.setValue(16); -- } -- -- return Blocks.BEDROCK.getBlockData(); -- } else { -- this.d.g(i); -- IBlockData iblockdata = iblockaccess.getType(this.d); -- boolean flag = iblockdata.l() && iblockdata.e(); -- -- if (mutableint != null) { -- mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); -- } -- -- return flag ? iblockdata : Blocks.AIR.getBlockData(); -- } -- } -- } -+ // Paper start - comment out, see getBlockOptimized -+// protected IBlockData a(long i, @Nullable MutableInt mutableint) { -+// if (i == Long.MAX_VALUE) { -+// if (mutableint != null) { -+// mutableint.setValue(0); -+// } -+// -+// return Blocks.AIR.getBlockData(); -+// } else { -+// int j = SectionPosition.a(BlockPosition.b(i)); -+// int k = SectionPosition.a(BlockPosition.d(i)); -+// IBlockAccess iblockaccess = this.a(j, k); -+// -+// if (iblockaccess == null) { -+// if (mutableint != null) { -+// mutableint.setValue(16); -+// } -+// -+// return Blocks.BEDROCK.getBlockData(); -+// } else { -+// this.d.g(i); -+// IBlockData iblockdata = iblockaccess.getType(this.d); -+// boolean flag = iblockdata.l() && iblockdata.e(); -+// -+// if (mutableint != null) { -+// mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); -+// } -+// -+// return flag ? iblockdata : Blocks.AIR.getBlockData(); -+// } -+// } -+// } -+ // Paper end - - protected VoxelShape a(IBlockData iblockdata, long i, EnumDirection enumdirection) { - return iblockdata.l() ? iblockdata.a(this.a.getWorld(), this.d.g(i), enumdirection) : VoxelShapes.a(); -@@ -124,8 +153,9 @@ public abstract class LightEngineLayer, S e - return i == Long.MAX_VALUE ? 0 : 15 - this.c.i(i); - } - -+ protected int getNibbleLightInverse(NibbleArray nibblearray, int x, int y, int z) { return 15 - nibblearray.a(x & 15, y & 15, z & 15); } // Paper - x/y/z version of below - protected int a(NibbleArray nibblearray, long i) { -- return 15 - nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); -+ return 15 - nibblearray.a((int) (i >> 38) & 15, (int) ((i << 52) >> 52) & 15, (int) ((i << 26) >> 38) & 15); // Paper - } - - @Override -diff --git a/src/main/java/net/minecraft/server/LightEngineSky.java b/src/main/java/net/minecraft/server/LightEngineSky.java -index f0b57784006752e031800a12a1a3c1a5945c636b..32b52ca2462fa206b1184025cb3837d6c326db2d 100644 ---- a/src/main/java/net/minecraft/server/LightEngineSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineSky.java -@@ -29,21 +29,25 @@ public final class LightEngineSky extends LightEngineLayer= 15) { -+ // Paper start - use x/y/z and optimized block lookup -+ int jx = (int) (j >> 38); -+ int jy = (int) ((j << 52) >> 52); -+ int jz = (int) ((j << 26) >> 38); -+ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); -+ int blockedLight = mutableint.getValue(); -+ if (blockedLight >= 15) { -+ // Paper end - return 15; - } else { -- int l = BlockPosition.b(i); -- int i1 = BlockPosition.c(i); -- int j1 = BlockPosition.d(i); -- int k1 = BlockPosition.b(j); -- int l1 = BlockPosition.c(j); -- int i2 = BlockPosition.d(j); -- boolean flag = l == k1 && j1 == i2; -- int j2 = Integer.signum(k1 - l); -- int k2 = Integer.signum(l1 - i1); -- int l2 = Integer.signum(i2 - j1); -+ // Paper start - inline math -+ int ix = (int) (i >> 38); -+ int iy = (int) ((i << 52) >> 52); -+ int iz = (int) ((i << 26) >> 38); -+ boolean flag = ix == jx && iz == jz; -+ int j2 = Integer.signum(jx - ix); -+ int k2 = Integer.signum(jy - iy); -+ int l2 = Integer.signum(jz - iz); -+ // Paper end - EnumDirection enumdirection; - - if (i == Long.MAX_VALUE) { -@@ -52,7 +56,7 @@ public final class LightEngineSky extends LightEngineLayer l1; -+ boolean flag1 = i == Long.MAX_VALUE || flag && iy > jy; // Paper rename vars to iy > jy - -- return flag1 && k == 0 && mutableint.getValue() == 0 ? 0 : k + Math.max(1, mutableint.getValue()); -+ return flag1 && k == 0 && blockedLight == 0 ? 0 : k + Math.max(1, blockedLight); // Paper - } - } - } -@@ -92,10 +96,14 @@ public final class LightEngineSky extends LightEngineLayer> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long k = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ int i1 = baseY & 15; -+ int j1 = baseY >> 4; -+ // Paper end - int k1; - - if (i1 != 0) { -@@ -110,15 +118,16 @@ public final class LightEngineSky extends LightEngineLayer> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); -+ // Paper end - EnumDirection[] aenumdirection = LightEngineSky.e; - int k1 = aenumdirection.length; - - for (int l1 = 0; l1 < k1; ++l1) { - EnumDirection enumdirection = aenumdirection[l1]; -- long i2 = BlockPosition.a(i, enumdirection); -- long j2 = SectionPosition.e(i2); -+ // Paper start -+ int newX = baseX + enumdirection.getAdjacentX(); -+ int newY = baseY + enumdirection.getAdjacentY(); -+ int newZ = baseZ + enumdirection.getAdjacentZ(); -+ long i2 = BlockPosition.asLong(newX, newY, newZ); -+ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); -+ // Paper end - NibbleArray nibblearray1; - - if (j1 == j2) { - nibblearray1 = nibblearray; - } else { -- nibblearray1 = ((LightEngineStorageSky) this.c).a(j2, true); -+ nibblearray1 = ((LightEngineStorageSky) this.c).updating.getUpdatingOptimized(j2); // Paper - } - - if (nibblearray1 != null) { - if (i2 != j) { -- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); -+ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper - - if (l > k2) { - l = k2; -@@ -206,7 +225,7 @@ public final class LightEngineSky extends LightEngineLayer> e - protected final LongSet c = new LongOpenHashSet(); - protected final LongSet d = new LongOpenHashSet(); - protected volatile M e_visible; protected final Object visibleUpdateLock = new Object(); // Paper - diff on change, should be "visible" - force compile fail on usage change -- protected final M f; // Paper - diff on change, should be "updating" -+ protected final M f; protected final M updating; // Paper - diff on change, should be "updating" - protected final LongSet g = new LongOpenHashSet(); -- protected final LongSet h = new LongOpenHashSet(); -+ protected final LongSet h = new LongOpenHashSet(); LongSet dirty = h; // Paper - OBFHELPER - protected final Long2ObjectMap i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); - private final LongSet n = new LongOpenHashSet(); - private final LongSet o = new LongOpenHashSet(); -@@ -30,33 +30,33 @@ public abstract class LightEngineStorage> e - protected volatile boolean j; - - protected LightEngineStorage(EnumSkyBlock enumskyblock, ILightAccess ilightaccess, M m0) { -- super(3, 16, 256); -+ super(3, 256, 256); // Paper - bump expected size of level sets to improve collisions and reduce rehashing (seen a lot of it) - this.l = enumskyblock; - this.m = ilightaccess; -- this.f = m0; -+ this.f = m0; updating = m0; // Paper - this.e_visible = m0.b(); // Paper - avoid copying light data - this.e_visible.d(); // Paper - avoid copying light data - } - -- protected boolean g(long i) { -- return this.a(i, true) != null; -+ protected final boolean g(long i) { // Paper - final to help inlining -+ return this.updating.getUpdatingOptimized(i) != null; // Paper - inline to avoid branching - } - - @Nullable - protected NibbleArray a(long i, boolean flag) { - // Paper start - avoid copying light data - if (flag) { -- return this.a(this.f, i); -+ return this.updating.getUpdatingOptimized(i); - } else { - synchronized (this.visibleUpdateLock) { -- return this.a(this.e_visible, i); -+ return this.e_visible.lookup.apply(i); - } - } - // Paper end - avoid copying light data - } - - @Nullable -- protected NibbleArray a(M m0, long i) { -+ protected final NibbleArray a(M m0, long i) { // Paper - return m0.c(i); - } - -@@ -70,27 +70,57 @@ public abstract class LightEngineStorage> e - protected abstract int d(long i); - - protected int i(long i) { -- long j = SectionPosition.e(i); -- NibbleArray nibblearray = this.a(j, true); -+ // Paper start - reuse and inline math, use Optimized Updating path -+ final int x = (int) (i >> 38); -+ final int y = (int) ((i << 52) >> 52); -+ final int z = (int) ((i << 26) >> 38); -+ long j = SectionPosition.blockPosAsSectionLong(x, y, z); -+ NibbleArray nibblearray = this.updating.getUpdatingOptimized(j); -+ // BUG: Sometimes returns null and crashes, try to recover, but to prevent crash just return no light. -+ if (nibblearray == null) { -+ nibblearray = this.e_visible.lookup.apply(j); -+ } -+ if (nibblearray == null) { -+ System.err.println("Null nibble, preventing crash " + BlockPosition.fromLong(i)); -+ return 0; -+ } - -- return nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); -+ return nibblearray.a(x & 15, y & 15, z & 15); // Paper - inline operations -+ // Paper end - } - - protected void b(long i, int j) { -- long k = SectionPosition.e(i); -+ // Paper start - cache part of the math done in loop below -+ int x = (int) (i >> 38); -+ int y = (int) ((i << 52) >> 52); -+ int z = (int) ((i << 26) >> 38); -+ long k = SectionPosition.blockPosAsSectionLong(x, y, z); -+ // Paper end - - if (this.g.add(k)) { - this.f.a(k); - } - - NibbleArray nibblearray = this.a(k, true); -- -- nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i)), j); -- -- for (int l = -1; l <= 1; ++l) { -- for (int i1 = -1; i1 <= 1; ++i1) { -- for (int j1 = -1; j1 <= 1; ++j1) { -- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); -+ nibblearray.a(x & 15, y & 15, z & 15, j); // Paper - use already calculated x/y/z -+ -+ // Paper start - credit to JellySquid for a major optimization here: -+ /* -+ * An extremely important optimization is made here in regards to adding items to the pending notification set. The -+ * original implementation attempts to add the coordinate of every chunk which contains a neighboring block position -+ * even though a huge number of loop iterations will simply map to block positions within the same updating chunk. -+ * -+ * Our implementation here avoids this by pre-calculating the min/max chunk coordinates so we can iterate over only -+ * the relevant chunk positions once. This reduces what would always be 27 iterations to just 1-8 iterations. -+ * -+ * @reason Use faster implementation -+ * @author JellySquid -+ */ -+ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { -+ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { -+ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { -+ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); -+ // Paper end - } - } - } -@@ -122,17 +152,23 @@ public abstract class LightEngineStorage> e - } - - if (k >= 2 && j != 2) { -- if (this.p.contains(i)) { -- this.p.remove(i); -- } else { -+ if (!this.p.remove(i)) { // Paper - remove useless contains - credit to JellySquid -+ //this.p.remove(i); // Paper -+ //} else { // Paper - this.f.a(i, this.j(i)); - this.g.add(i); - this.k(i); - -- for (int l = -1; l <= 1; ++l) { -- for (int i1 = -1; i1 <= 1; ++i1) { -- for (int j1 = -1; j1 <= 1; ++j1) { -- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); -+ // Paper start - reuse x/y/z and only notify valid chunks - Credit to JellySquid (See above method for notes) -+ int x = (int) (i >> 38); -+ int y = (int) ((i << 52) >> 52); -+ int z = (int) ((i << 26) >> 38); -+ -+ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { -+ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { -+ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { -+ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); -+ // Paper end - } - } - } -@@ -158,9 +194,9 @@ public abstract class LightEngineStorage> e - return SectionPosition.e(j) == i; - }); - } else { -- int j = SectionPosition.c(SectionPosition.b(i)); -- int k = SectionPosition.c(SectionPosition.c(i)); -- int l = SectionPosition.c(SectionPosition.d(i)); -+ int j = (int) (i >> 42) << 4; // Paper - inline -+ int k = (int) (i << 44 >> 44) << 4; // Paper - inline -+ int l = (int) (i << 22 >> 42) << 4; // Paper - inline - - for (int i1 = 0; i1 < 16; ++i1) { - for (int j1 = 0; j1 < 16; ++j1) { -@@ -187,7 +223,7 @@ public abstract class LightEngineStorage> e - NibbleArray nibblearray; - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.a(lightenginelayer, i); - NibbleArray nibblearray1 = (NibbleArray) this.i.remove(i); - -@@ -205,7 +241,7 @@ public abstract class LightEngineStorage> e - longiterator = this.p.iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.l(i); - } - -@@ -216,12 +252,13 @@ public abstract class LightEngineStorage> e - Entry entry; - long j; - -+ NibbleArray test = null; // Paper - while (objectiterator.hasNext()) { - entry = (Entry) objectiterator.next(); - j = entry.getLongKey(); -- if (this.g(j)) { -+ if ((test = this.updating.getUpdatingOptimized(j)) != null) { // Paper - dont look up nibble twice - nibblearray = (NibbleArray) entry.getValue(); -- if (this.f.c(j) != nibblearray) { -+ if (test != nibblearray) { // Paper - this.a(lightenginelayer, j); - this.f.a(j, nibblearray); - this.g.add(j); -@@ -234,14 +271,14 @@ public abstract class LightEngineStorage> e - longiterator = this.i.keySet().iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.b(lightenginelayer, i); - } - } else { - longiterator = this.n.iterator(); - - while (longiterator.hasNext()) { -- i = (Long) longiterator.next(); -+ i = longiterator.nextLong(); // Paper - this.b(lightenginelayer, i); - } - } -@@ -262,15 +299,20 @@ public abstract class LightEngineStorage> e - - private void b(LightEngineLayer lightenginelayer, long i) { - if (this.g(i)) { -- int j = SectionPosition.c(SectionPosition.b(i)); -- int k = SectionPosition.c(SectionPosition.c(i)); -- int l = SectionPosition.c(SectionPosition.d(i)); -+ // Paper start -+ int secX = (int) (i >> 42); -+ int secY = (int) (i << 44 >> 44); -+ int secZ = (int) (i << 22 >> 42); -+ int j = secX << 4; // baseX -+ int k = secY << 4; // baseY -+ int l = secZ << 4; // baseZ -+ // Paper end - EnumDirection[] aenumdirection = LightEngineStorage.k; - int i1 = aenumdirection.length; - - for (int j1 = 0; j1 < i1; ++j1) { - EnumDirection enumdirection = aenumdirection[j1]; -- long k1 = SectionPosition.a(i, enumdirection); -+ long k1 = SectionPosition.getAdjacentFromSectionPos(secX, secY, secZ, enumdirection); // Paper - avoid extra unpacking - - if (!this.i.containsKey(k1) && this.g(k1)) { - for (int l1 = 0; l1 < 16; ++l1) { -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageArray.java b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -index 37c44a89f28c44915fcae5a7e2c4797b1c123723..549c2551c2b59730bf53a80f8706d388d96ad932 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageArray.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageArray.java -@@ -5,13 +5,18 @@ import javax.annotation.Nullable; - - public abstract class LightEngineStorageArray> { - -- private final long[] b = new long[2]; -- private final NibbleArray[] c = new NibbleArray[2]; -+ // private final long[] b = new long[2]; // Paper - unused -+ private final NibbleArray[] c = new NibbleArray[]{NibbleArray.EMPTY_NIBBLE_ARRAY, NibbleArray.EMPTY_NIBBLE_ARRAY}; private final NibbleArray[] cache = c; // Paper - OBFHELPER - private boolean d; - protected final com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object data; // Paper - avoid copying light data - protected final boolean isVisible; // Paper - avoid copying light data -- java.util.function.Function lookup; // Paper - faster branchless lookup - -+ // Paper start - faster lookups with less branching, use interface to avoid boxing instead of Function -+ public final NibbleArrayAccess lookup; -+ public interface NibbleArrayAccess { -+ NibbleArray apply(long id); -+ } -+ // Paper end - // Paper start - avoid copying light data - protected LightEngineStorageArray(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object data, boolean isVisible) { - if (isVisible) { -@@ -19,12 +24,14 @@ public abstract class LightEngineStorageArray 0; --k) { -- this.b[k] = this.b[k - 1]; -- this.c[k] = this.c[k - 1]; -- } -- -- this.b[0] = i; -- this.c[0] = nibblearray; -- } -- -+ cache[1] = cache[0]; -+ cache[0] = nibblearray; - return nibblearray; - } - } -+ // Paper end -+ -+ @Nullable -+ public final NibbleArray c(final long i) { // Paper - final -+ // Paper start - optimize visible case or missed updating cases -+ if (this.d) { -+ // short circuit to optimized -+ return getUpdatingOptimized(i); -+ } -+ -+ return this.lookup.apply(i); -+ // Paper end -+ } - - @Nullable - public NibbleArray d(long i) { -@@ -80,13 +89,14 @@ public abstract class LightEngineStorageArray> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j = (((long) (baseX >> 4) & 4194303L) << 42) | (((long) (baseY >> 4) & 1048575L)) | (((long) (baseZ >> 4) & 4194303L) << 20); -+ NibbleArray nibblearray = this.e_visible.lookup.apply(j); -+ return nibblearray == null ? 0 : nibblearray.a(baseX & 15, baseY & 15, baseZ & 15); -+ // Paper end - } - - public static final class a extends LightEngineStorageArray { -diff --git a/src/main/java/net/minecraft/server/LightEngineStorageSky.java b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -index a35e7b392c74fadf2760d1fc2021e98d33858cb5..944094e8e770cc8c0205ef2aa6c48fff55d74639 100644 ---- a/src/main/java/net/minecraft/server/LightEngineStorageSky.java -+++ b/src/main/java/net/minecraft/server/LightEngineStorageSky.java -@@ -22,7 +22,12 @@ public class LightEngineStorageSky extends LightEngineStorage> 38); -+ int baseY = (int) ((i << 52) >> 52); -+ int baseZ = (int) ((i << 26) >> 38); -+ long j = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); -+ // Paper end - int k = SectionPosition.c(j); - synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data - LightEngineStorageSky.a lightenginestoragesky_a = (LightEngineStorageSky.a) this.e_visible; // Paper - avoid copying light data - must be after lock acquire -@@ -43,7 +48,7 @@ public class LightEngineStorageSky extends LightEngineStorage> 52) & 15, (int) baseZ & 15); // Paper - y changed above - } else { - return 15; - } -@@ -162,7 +167,7 @@ public class LightEngineStorageSky extends LightEngineStorage> 42) << 4; // Paper -+ int baseY = (int) (i << 44 >> 44) << 4; // Paper -+ int baseZ = (int) (i << 22 >> 42) << 4; // Paper - j = this.c(i); - if (j != 2 && !this.n.contains(i) && this.l.add(i)) { - int l; -@@ -197,10 +205,10 @@ public class LightEngineStorageSky extends LightEngineStorage> 42) << 4; // Paper -+ int baseY = (int) (i << 44 >> 44) << 4; // Paper -+ int baseZ = (int) (i << 22 >> 42) << 4; // Paper - if (this.l.remove(i) && this.g(i)) { - for (j = 0; j < 16; ++j) { - for (k = 0; k < 16; ++k) { -- long l3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + j, SectionPosition.c(SectionPosition.c(i)) + 16 - 1, SectionPosition.c(SectionPosition.d(i)) + k); -+ long l3 = BlockPosition.a(baseX + j, baseY + 16 - 1, baseZ + k); // Paper - - lightenginelayer.a(Long.MAX_VALUE, l3, 15, false); - } -diff --git a/src/main/java/net/minecraft/server/LightEngineThreaded.java b/src/main/java/net/minecraft/server/LightEngineThreaded.java -index f8c2b957bb5b38f05251cccf5137a9c23262c3d6..2f9c97dd4e1d705a87772d18c7ab4883a876af08 100644 ---- a/src/main/java/net/minecraft/server/LightEngineThreaded.java -+++ b/src/main/java/net/minecraft/server/LightEngineThreaded.java +diff --git a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java +index e066848127cb9a42e8c39422691cc65132cac6bb..8a70286c017450dcc1926f471673933c493c555c 100644 +--- a/src/main/java/net/minecraft/server/level/LightEngineThreaded.java ++++ b/src/main/java/net/minecraft/server/level/LightEngineThreaded.java @@ -1,6 +1,7 @@ - package net.minecraft.server; + package net.minecraft.server.level; import com.mojang.datafixers.util.Pair; +import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; // Paper import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectList; import it.unimi.dsi.fastutil.objects.ObjectListIterator; -@@ -15,15 +16,149 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { +@@ -27,15 +28,149 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { private static final Logger LOGGER = LogManager.getLogger(); private final ThreadedMailbox b; @@ -1191,7 +247,7 @@ index f8c2b957bb5b38f05251cccf5137a9c23262c3d6..2f9c97dd4e1d705a87772d18c7ab4883 this.e = mailbox; this.b = threadedmailbox; } -@@ -110,13 +245,9 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { +@@ -122,13 +257,9 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { } private void a(int i, int j, IntSupplier intsupplier, LightEngineThreaded.Update lightenginethreaded_update, Runnable runnable) { @@ -1208,7 +264,7 @@ index f8c2b957bb5b38f05251cccf5137a9c23262c3d6..2f9c97dd4e1d705a87772d18c7ab4883 } @Override -@@ -133,8 +264,19 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { +@@ -145,8 +276,19 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { public CompletableFuture a(IChunkAccess ichunkaccess, boolean flag) { ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos(); @@ -1230,7 +286,7 @@ index f8c2b957bb5b38f05251cccf5137a9c23262c3d6..2f9c97dd4e1d705a87772d18c7ab4883 ChunkSection[] achunksection = ichunkaccess.getSections(); for (int i = 0; i < 16; ++i) { -@@ -152,55 +294,48 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { +@@ -164,55 +306,48 @@ public class LightEngineThreaded extends LightEngine implements AutoCloseable { }); } @@ -1310,29 +366,11 @@ index f8c2b957bb5b38f05251cccf5137a9c23262c3d6..2f9c97dd4e1d705a87772d18c7ab4883 } public void a(int i) { -diff --git a/src/main/java/net/minecraft/server/NibbleArray.java b/src/main/java/net/minecraft/server/NibbleArray.java -index ff00830b95a17f66d0c913087492dbf4b066df8a..4085426af03f032cf405bdfd1e40a8e5dc27c1d1 100644 ---- a/src/main/java/net/minecraft/server/NibbleArray.java -+++ b/src/main/java/net/minecraft/server/NibbleArray.java -@@ -8,6 +8,13 @@ import javax.annotation.Nullable; - public class NibbleArray { - - // Paper start -+ static final NibbleArray EMPTY_NIBBLE_ARRAY = new NibbleArray() { -+ @Override -+ public byte[] asBytes() { -+ throw new IllegalStateException(); -+ } -+ }; -+ long lightCacheKey = Long.MIN_VALUE; - public static byte[] EMPTY_NIBBLE = new byte[2048]; - private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); - private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8)); -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index 0799970f90527f97d64eb857a0b07990114c7ab2..afea606641c27e2ea8769455833b96e3f012e78e 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -728,6 +728,7 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index 48b87ed945a71b97d8a88cbaf4099dc966a8ab88..b19c3bdbf64dc44f01487a3d17236a03a95708b5 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -753,6 +753,7 @@ public class PlayerChunk { ioPriority = com.destroystokyo.paper.io.PrioritizedTaskQueue.HIGH_PRIORITY; } chunkMap.world.asyncChunkTaskManager.raisePriority(location.x, location.z, ioPriority); @@ -1340,11 +378,11 @@ index 0799970f90527f97d64eb857a0b07990114c7ab2..afea606641c27e2ea8769455833b96e3 } if (getCurrentPriority() != priority) { this.u.a(this.location, this::getCurrentPriority, priority, this::setPriority); // use preferred priority -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index b1c332b79bfa00e89c6d3aca327b88fe94c3bba1..4264fab9164b8a59cbbcedfb97272413a6303ac9 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -278,6 +278,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index 4441af38184adefdf686429d1d147b9bbb76b5a6..f3f906d8ffa195b100d5bd2d232ae8489d48d60d 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -322,6 +322,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { } // Paper end @@ -1352,7 +390,7 @@ index b1c332b79bfa00e89c6d3aca327b88fe94c3bba1..4264fab9164b8a59cbbcedfb97272413 public PlayerChunkMap(WorldServer worldserver, Convertable.ConversionSession convertable_conversionsession, DataFixer datafixer, DefinedStructureManager definedstructuremanager, Executor executor, IAsyncTaskHandler iasynctaskhandler, ILightAccess ilightaccess, ChunkGenerator chunkgenerator, WorldLoadListener worldloadlistener, Supplier supplier, int i, boolean flag) { super(new File(convertable_conversionsession.a(worldserver.getDimensionKey()), "region"), datafixer, flag); //this.visibleChunks = this.updatingChunks.clone(); // Paper - no more cloning -@@ -309,7 +310,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -353,7 +354,15 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { Mailbox mailbox = Mailbox.a("main", iasynctaskhandler::a); this.worldLoadListener = worldloadlistener; @@ -1369,7 +407,7 @@ index b1c332b79bfa00e89c6d3aca327b88fe94c3bba1..4264fab9164b8a59cbbcedfb97272413 this.p = new ChunkTaskQueueSorter(ImmutableList.of(threadedmailbox, mailbox, threadedmailbox1), executor, Integer.MAX_VALUE); this.mailboxWorldGen = this.p.a(threadedmailbox, false); -@@ -655,6 +664,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -699,6 +708,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { // Paper end } @@ -1377,7 +415,7 @@ index b1c332b79bfa00e89c6d3aca327b88fe94c3bba1..4264fab9164b8a59cbbcedfb97272413 protected IntSupplier c(long i) { return () -> { PlayerChunk playerchunk = this.getVisibleChunk(i); -@@ -782,6 +792,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { +@@ -826,6 +836,7 @@ public class PlayerChunkMap extends IChunkLoader implements PlayerChunk.d { @Override public void close() throws IOException { try { @@ -1385,11 +423,23 @@ index b1c332b79bfa00e89c6d3aca327b88fe94c3bba1..4264fab9164b8a59cbbcedfb97272413 this.p.close(); this.world.asyncChunkTaskManager.close(true); // Paper - Required since we're closing regionfiles in the next line this.m.close(); -diff --git a/src/main/java/net/minecraft/server/ThreadedMailbox.java b/src/main/java/net/minecraft/server/ThreadedMailbox.java -index b7af235dc2841dc9c8296805624f6ee763b86dfb..faf4745d368993ccdf0c017937efc5be7805083b 100644 ---- a/src/main/java/net/minecraft/server/ThreadedMailbox.java -+++ b/src/main/java/net/minecraft/server/ThreadedMailbox.java -@@ -109,7 +109,8 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 117772867eede63646d80bb7af4792a2db16d815..2181fbc31e96c74679185a49abbb3d7a2d5b6e9f 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -823,6 +823,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + } + gameprofilerfiller.exit(); + timings.chunkTicksBlocks.stopTiming(); // Paper ++ getChunkProvider().getLightEngine().queueUpdate(); // Paper + // Paper end + } + } +diff --git a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java +index 2efca1fe92b2e93dcbf5337eea8855b1b2b9a564..72bfda620f073fd3c3e4c43d78583386dadf95e6 100644 +--- a/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java ++++ b/src/main/java/net/minecraft/util/thread/ThreadedMailbox.java +@@ -110,7 +110,8 @@ public class ThreadedMailbox implements Mailbox, AutoCloseable, Runnable { } @@ -1399,15 +449,965 @@ index b7af235dc2841dc9c8296805624f6ee763b86dfb..faf4745d368993ccdf0c017937efc5be public void a(T t0) { this.a.a(t0); this.f(); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 1a75e688d7bd6aa0c7d83574b07ab27960fcaf7a..d2edfc8053a3db0a8e27f408bd467b193d8f9d9c 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -714,6 +714,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +index 50fc6316bfd42a532f792ba7557783eea3988a55..c01284e6221b69f8fac3c74a7f9726a188f1f843 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java ++++ b/src/main/java/net/minecraft/world/level/chunk/NibbleArray.java +@@ -9,6 +9,13 @@ import net.minecraft.SystemUtils; + public class NibbleArray { + + // Paper start ++ static final NibbleArray EMPTY_NIBBLE_ARRAY = new NibbleArray() { ++ @Override ++ public byte[] asBytes() { ++ throw new IllegalStateException(); ++ } ++ }; ++ long lightCacheKey = Long.MIN_VALUE; + public static byte[] EMPTY_NIBBLE = new byte[2048]; + private static final int nibbleBucketSizeMultiplier = Integer.getInteger("Paper.nibbleBucketSize", 3072); + private static final int maxPoolSize = Integer.getInteger("Paper.maxNibblePoolSize", (int) Math.min(6, Math.max(1, Runtime.getRuntime().maxMemory() / 1024 / 1024 / 1024)) * (nibbleBucketSizeMultiplier * 8)); +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java +index f6198069e3ca421b4f551939263c7cf8bd5b754e..e8d2415033c5db3c27e10a38e1ea75e60ebd693e 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineBlock.java +@@ -23,9 +23,11 @@ public final class LightEngineBlock extends LightEngineLayer> 38); ++ int k = (int) ((i << 52) >> 52); ++ int l = (int) ((i << 26) >> 38); ++ // Paper end + IBlockAccess iblockaccess = this.a.c(j >> 4, l >> 4); + + return iblockaccess != null ? iblockaccess.g(this.f.d(j, k, l)) : 0; +@@ -40,25 +42,33 @@ public final class LightEngineBlock extends LightEngineLayer= 15) { + return k; + } else { +- int l = Integer.signum(BlockPosition.b(j) - BlockPosition.b(i)); +- int i1 = Integer.signum(BlockPosition.c(j) - BlockPosition.c(i)); +- int j1 = Integer.signum(BlockPosition.d(j) - BlockPosition.d(i)); ++ // Paper start - reuse math - credit to JellySquid for idea ++ int jx = (int) (j >> 38); ++ int jy = (int) ((j << 52) >> 52); ++ int jz = (int) ((j << 26) >> 38); ++ int ix = (int) (i >> 38); ++ int iy = (int) ((i << 52) >> 52); ++ int iz = (int) ((i << 26) >> 38); ++ int l = Integer.signum(jx - ix); ++ int i1 = Integer.signum(jy - iy); ++ int j1 = Integer.signum(jz - iz); ++ // Paper end + EnumDirection enumdirection = EnumDirection.a(l, i1, j1); + + if (enumdirection == null) { + return 15; + } else { + //MutableInt mutableint = new MutableInt(); // Paper - share mutableint, single threaded +- IBlockData iblockdata = this.a(j, mutableint); +- +- if (mutableint.getValue() >= 15) { ++ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); // Paper ++ int blockedLight = mutableint.getValue(); // Paper ++ if (blockedLight >= 15) { // Paper + return 15; + } else { +- IBlockData iblockdata1 = this.a(i, (MutableInt) null); ++ IBlockData iblockdata1 = this.getBlockOptimized(ix, iy, iz); // Paper + VoxelShape voxelshape = this.a(iblockdata1, i, enumdirection); + VoxelShape voxelshape1 = this.a(iblockdata, j, enumdirection.opposite()); + +- return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, mutableint.getValue()); ++ return VoxelShapes.b(voxelshape, voxelshape1) ? 15 : k + Math.max(1, blockedLight); // Paper + } } - gameprofilerfiller.exit(); - timings.chunkTicksBlocks.stopTiming(); // Paper -+ getChunkProvider().getLightEngine().queueUpdate(); // Paper - // Paper end + } +@@ -66,14 +76,19 @@ public final class LightEngineBlock extends LightEngineLayer> 38); ++ int y = (int) ((i << 52) >> 52); ++ int z = (int) ((i << 26) >> 38); ++ long k = SectionPosition.blockPosAsSectionLong(x, y, z); ++ // Paper end + EnumDirection[] aenumdirection = LightEngineBlock.e; + int l = aenumdirection.length; + + for (int i1 = 0; i1 < l; ++i1) { + EnumDirection enumdirection = aenumdirection[i1]; +- long j1 = BlockPosition.a(i, enumdirection); +- long k1 = SectionPosition.e(j1); ++ long j1 = BlockPosition.getAdjacent(x, y, z, enumdirection); // Paper ++ long k1 = SectionPosition.getAdjacentFromBlockPos(x, y, z, enumdirection); // Paper + + if (k == k1 || ((LightEngineStorageBlock) this.c).g(k1)) { + this.b(i, j1, j, flag); +@@ -98,27 +113,37 @@ public final class LightEngineBlock extends LightEngineLayer> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); ++ // Paper end + EnumDirection[] aenumdirection = LightEngineBlock.e; + int k1 = aenumdirection.length; + + for (int l1 = 0; l1 < k1; ++l1) { + EnumDirection enumdirection = aenumdirection[l1]; +- long i2 = BlockPosition.a(i, enumdirection); ++ // Paper start ++ int newX = baseX + enumdirection.getAdjacentX(); ++ int newY = baseY + enumdirection.getAdjacentY(); ++ int newZ = baseZ + enumdirection.getAdjacentZ(); ++ long i2 = BlockPosition.asLong(newX, newY, newZ); + + if (i2 != j) { +- long j2 = SectionPosition.e(i2); ++ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); ++ // Paper end + NibbleArray nibblearray1; + + if (j1 == j2) { + nibblearray1 = nibblearray; + } else { +- nibblearray1 = ((LightEngineStorageBlock) this.c).a(j2, true); ++ nibblearray1 = ((LightEngineStorageBlock) this.c).updating.getUpdatingOptimized(j2); // Paper + } + + if (nibblearray1 != null) { +- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); ++ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper + + if (l > k2) { + l = k2; +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java +index 944a8c295ff9df0d96800ddc4f6763598cf61d0d..896020d7d680a2456c190cc2463248a908046ddc 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineLayer.java +@@ -23,10 +23,37 @@ public abstract class LightEngineLayer, S e + protected final EnumSkyBlock b; + protected final S c; + private boolean f; +- protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); ++ protected final BlockPosition.MutableBlockPosition d = new BlockPosition.MutableBlockPosition(); protected final BlockPosition.MutableBlockPosition pos = d; // Paper + private final long[] g = new long[2]; +- private final IBlockAccess[] h = new IBlockAccess[2]; ++ private final IChunkAccess[] h = new IChunkAccess[2]; // Paper + ++ // Paper start - see fully commented out method below (look for Bedrock) ++ // optimized method with less branching for when scenarios arent needed. ++ // avoid using mutable version if can ++ protected final IBlockData getBlockOptimized(int x, int y, int z, MutableInt mutableint) { ++ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); ++ ++ if (iblockaccess == null) { ++ mutableint.setValue(16); ++ return Blocks.BEDROCK.getBlockData(); ++ } else { ++ this.pos.setValues(x, y, z); ++ IBlockData iblockdata = iblockaccess.getType(x, y, z); ++ mutableint.setValue(iblockdata.b(this.a.getWorld(), this.pos)); ++ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); ++ } ++ } ++ protected final IBlockData getBlockOptimized(int x, int y, int z) { ++ IChunkAccess iblockaccess = this.a(x >> 4, z >> 4); ++ ++ if (iblockaccess == null) { ++ return Blocks.BEDROCK.getBlockData(); ++ } else { ++ IBlockData iblockdata = iblockaccess.getType(x, y, z); ++ return iblockdata.l() && iblockdata.e() ? iblockdata : Blocks.AIR.getBlockData(); ++ } ++ } ++ // Paper end + public LightEngineLayer(ILightAccess ilightaccess, EnumSkyBlock enumskyblock, S s0) { + super(16, 256, 8192); + this.a = ilightaccess; +@@ -45,7 +72,7 @@ public abstract class LightEngineLayer, S e + } + + @Nullable +- private IBlockAccess a(int i, int j) { ++ private IChunkAccess a(int i, int j) { // Paper + long k = ChunkCoordIntPair.pair(i, j); + + for (int l = 0; l < 2; ++l) { +@@ -54,7 +81,7 @@ public abstract class LightEngineLayer, S e + } + } + +- IBlockAccess iblockaccess = this.a.c(i, j); ++ IChunkAccess iblockaccess = (IChunkAccess) this.a.c(i, j); // Paper + + for (int i1 = 1; i1 > 0; --i1) { + this.g[i1] = this.g[i1 - 1]; +@@ -71,37 +98,39 @@ public abstract class LightEngineLayer, S e + Arrays.fill(this.h, (Object) null); + } + +- protected IBlockData a(long i, @Nullable MutableInt mutableint) { +- if (i == Long.MAX_VALUE) { +- if (mutableint != null) { +- mutableint.setValue(0); +- } +- +- return Blocks.AIR.getBlockData(); +- } else { +- int j = SectionPosition.a(BlockPosition.b(i)); +- int k = SectionPosition.a(BlockPosition.d(i)); +- IBlockAccess iblockaccess = this.a(j, k); +- +- if (iblockaccess == null) { +- if (mutableint != null) { +- mutableint.setValue(16); +- } +- +- return Blocks.BEDROCK.getBlockData(); +- } else { +- this.d.g(i); +- IBlockData iblockdata = iblockaccess.getType(this.d); +- boolean flag = iblockdata.l() && iblockdata.e(); +- +- if (mutableint != null) { +- mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); +- } +- +- return flag ? iblockdata : Blocks.AIR.getBlockData(); +- } +- } +- } ++ // Paper start - comment out, see getBlockOptimized ++// protected IBlockData a(long i, @Nullable MutableInt mutableint) { ++// if (i == Long.MAX_VALUE) { ++// if (mutableint != null) { ++// mutableint.setValue(0); ++// } ++// ++// return Blocks.AIR.getBlockData(); ++// } else { ++// int j = SectionPosition.a(BlockPosition.b(i)); ++// int k = SectionPosition.a(BlockPosition.d(i)); ++// IBlockAccess iblockaccess = this.a(j, k); ++// ++// if (iblockaccess == null) { ++// if (mutableint != null) { ++// mutableint.setValue(16); ++// } ++// ++// return Blocks.BEDROCK.getBlockData(); ++// } else { ++// this.d.g(i); ++// IBlockData iblockdata = iblockaccess.getType(this.d); ++// boolean flag = iblockdata.l() && iblockdata.e(); ++// ++// if (mutableint != null) { ++// mutableint.setValue(iblockdata.b(this.a.getWorld(), (BlockPosition) this.d)); ++// } ++// ++// return flag ? iblockdata : Blocks.AIR.getBlockData(); ++// } ++// } ++// } ++ // Paper end + + protected VoxelShape a(IBlockData iblockdata, long i, EnumDirection enumdirection) { + return iblockdata.l() ? iblockdata.a(this.a.getWorld(), this.d.g(i), enumdirection) : VoxelShapes.a(); +@@ -136,8 +165,9 @@ public abstract class LightEngineLayer, S e + return i == Long.MAX_VALUE ? 0 : 15 - this.c.i(i); + } + ++ protected int getNibbleLightInverse(NibbleArray nibblearray, int x, int y, int z) { return 15 - nibblearray.a(x & 15, y & 15, z & 15); } // Paper - x/y/z version of below + protected int a(NibbleArray nibblearray, long i) { +- return 15 - nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); ++ return 15 - nibblearray.a((int) (i >> 38) & 15, (int) ((i << 52) >> 52) & 15, (int) ((i << 26) >> 38) & 15); // Paper + } + + @Override +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java +index 37fa5faea6e2972e3eb8a3cbd1913ef38dc9456f..fa8d84ce6819b2f41ff7448dec5662ba2df76e77 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineSky.java +@@ -38,21 +38,25 @@ public final class LightEngineSky extends LightEngineLayer= 15) { ++ // Paper start - use x/y/z and optimized block lookup ++ int jx = (int) (j >> 38); ++ int jy = (int) ((j << 52) >> 52); ++ int jz = (int) ((j << 26) >> 38); ++ IBlockData iblockdata = this.getBlockOptimized(jx, jy, jz, mutableint); ++ int blockedLight = mutableint.getValue(); ++ if (blockedLight >= 15) { ++ // Paper end + return 15; + } else { +- int l = BlockPosition.b(i); +- int i1 = BlockPosition.c(i); +- int j1 = BlockPosition.d(i); +- int k1 = BlockPosition.b(j); +- int l1 = BlockPosition.c(j); +- int i2 = BlockPosition.d(j); +- boolean flag = l == k1 && j1 == i2; +- int j2 = Integer.signum(k1 - l); +- int k2 = Integer.signum(l1 - i1); +- int l2 = Integer.signum(i2 - j1); ++ // Paper start - inline math ++ int ix = (int) (i >> 38); ++ int iy = (int) ((i << 52) >> 52); ++ int iz = (int) ((i << 26) >> 38); ++ boolean flag = ix == jx && iz == jz; ++ int j2 = Integer.signum(jx - ix); ++ int k2 = Integer.signum(jy - iy); ++ int l2 = Integer.signum(jz - iz); ++ // Paper end + EnumDirection enumdirection; + + if (i == Long.MAX_VALUE) { +@@ -61,7 +65,7 @@ public final class LightEngineSky extends LightEngineLayer l1; ++ boolean flag1 = i == Long.MAX_VALUE || flag && iy > jy; // Paper rename vars to iy > jy + +- return flag1 && k == 0 && mutableint.getValue() == 0 ? 0 : k + Math.max(1, mutableint.getValue()); ++ return flag1 && k == 0 && blockedLight == 0 ? 0 : k + Math.max(1, blockedLight); // Paper + } + } + } +@@ -101,10 +105,14 @@ public final class LightEngineSky extends LightEngineLayer> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long k = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ int i1 = baseY & 15; ++ int j1 = baseY >> 4; ++ // Paper end + int k1; + + if (i1 != 0) { +@@ -119,15 +127,16 @@ public final class LightEngineSky extends LightEngineLayer> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j1 = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ NibbleArray nibblearray = this.c.updating.getUpdatingOptimized(j1); ++ // Paper end + EnumDirection[] aenumdirection = LightEngineSky.e; + int k1 = aenumdirection.length; + + for (int l1 = 0; l1 < k1; ++l1) { + EnumDirection enumdirection = aenumdirection[l1]; +- long i2 = BlockPosition.a(i, enumdirection); +- long j2 = SectionPosition.e(i2); ++ // Paper start ++ int newX = baseX + enumdirection.getAdjacentX(); ++ int newY = baseY + enumdirection.getAdjacentY(); ++ int newZ = baseZ + enumdirection.getAdjacentZ(); ++ long i2 = BlockPosition.asLong(newX, newY, newZ); ++ long j2 = SectionPosition.blockPosAsSectionLong(newX, newY, newZ); ++ // Paper end + NibbleArray nibblearray1; + + if (j1 == j2) { + nibblearray1 = nibblearray; + } else { +- nibblearray1 = ((LightEngineStorageSky) this.c).a(j2, true); ++ nibblearray1 = ((LightEngineStorageSky) this.c).updating.getUpdatingOptimized(j2); // Paper + } + + if (nibblearray1 != null) { + if (i2 != j) { +- int k2 = this.b(i2, i, this.a(nibblearray1, i2)); ++ int k2 = this.b(i2, i, this.getNibbleLightInverse(nibblearray1, newX, newY, newZ)); // Paper + + if (l > k2) { + l = k2; +@@ -215,7 +234,7 @@ public final class LightEngineSky extends LightEngineLayer> e + protected final LongSet c = new LongOpenHashSet(); + protected final LongSet d = new LongOpenHashSet(); + protected volatile M e_visible; protected final Object visibleUpdateLock = new Object(); // Paper - diff on change, should be "visible" - force compile fail on usage change +- protected final M f; // Paper - diff on change, should be "updating" ++ protected final M f; protected final M updating; // Paper - diff on change, should be "updating" + protected final LongSet g = new LongOpenHashSet(); +- protected final LongSet h = new LongOpenHashSet(); ++ protected final LongSet h = new LongOpenHashSet(); LongSet dirty = h; // Paper - OBFHELPER + protected final Long2ObjectMap i = Long2ObjectMaps.synchronize(new Long2ObjectOpenHashMap()); + private final LongSet n = new LongOpenHashSet(); + private final LongSet o = new LongOpenHashSet(); +@@ -37,33 +37,33 @@ public abstract class LightEngineStorage> e + protected volatile boolean j; + + protected LightEngineStorage(EnumSkyBlock enumskyblock, ILightAccess ilightaccess, M m0) { +- super(3, 16, 256); ++ super(3, 256, 256); // Paper - bump expected size of level sets to improve collisions and reduce rehashing (seen a lot of it) + this.l = enumskyblock; + this.m = ilightaccess; +- this.f = m0; ++ this.f = m0; updating = m0; // Paper + this.e_visible = m0.b(); // Paper - avoid copying light data + this.e_visible.d(); // Paper - avoid copying light data + } + +- protected boolean g(long i) { +- return this.a(i, true) != null; ++ protected final boolean g(long i) { // Paper - final to help inlining ++ return this.updating.getUpdatingOptimized(i) != null; // Paper - inline to avoid branching + } + + @Nullable + protected NibbleArray a(long i, boolean flag) { + // Paper start - avoid copying light data + if (flag) { +- return this.a(this.f, i); ++ return this.updating.getUpdatingOptimized(i); + } else { + synchronized (this.visibleUpdateLock) { +- return this.a(this.e_visible, i); ++ return this.e_visible.lookup.apply(i); + } + } + // Paper end - avoid copying light data + } + + @Nullable +- protected NibbleArray a(M m0, long i) { ++ protected final NibbleArray a(M m0, long i) { // Paper + return m0.c(i); + } + +@@ -77,27 +77,57 @@ public abstract class LightEngineStorage> e + protected abstract int d(long i); + + protected int i(long i) { +- long j = SectionPosition.e(i); +- NibbleArray nibblearray = this.a(j, true); ++ // Paper start - reuse and inline math, use Optimized Updating path ++ final int x = (int) (i >> 38); ++ final int y = (int) ((i << 52) >> 52); ++ final int z = (int) ((i << 26) >> 38); ++ long j = SectionPosition.blockPosAsSectionLong(x, y, z); ++ NibbleArray nibblearray = this.updating.getUpdatingOptimized(j); ++ // BUG: Sometimes returns null and crashes, try to recover, but to prevent crash just return no light. ++ if (nibblearray == null) { ++ nibblearray = this.e_visible.lookup.apply(j); ++ } ++ if (nibblearray == null) { ++ System.err.println("Null nibble, preventing crash " + BlockPosition.fromLong(i)); ++ return 0; ++ } + +- return nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i))); ++ return nibblearray.a(x & 15, y & 15, z & 15); // Paper - inline operations ++ // Paper end + } + + protected void b(long i, int j) { +- long k = SectionPosition.e(i); ++ // Paper start - cache part of the math done in loop below ++ int x = (int) (i >> 38); ++ int y = (int) ((i << 52) >> 52); ++ int z = (int) ((i << 26) >> 38); ++ long k = SectionPosition.blockPosAsSectionLong(x, y, z); ++ // Paper end + + if (this.g.add(k)) { + this.f.a(k); + } + + NibbleArray nibblearray = this.a(k, true); +- +- nibblearray.a(SectionPosition.b(BlockPosition.b(i)), SectionPosition.b(BlockPosition.c(i)), SectionPosition.b(BlockPosition.d(i)), j); +- +- for (int l = -1; l <= 1; ++l) { +- for (int i1 = -1; i1 <= 1; ++i1) { +- for (int j1 = -1; j1 <= 1; ++j1) { +- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); ++ nibblearray.a(x & 15, y & 15, z & 15, j); // Paper - use already calculated x/y/z ++ ++ // Paper start - credit to JellySquid for a major optimization here: ++ /* ++ * An extremely important optimization is made here in regards to adding items to the pending notification set. The ++ * original implementation attempts to add the coordinate of every chunk which contains a neighboring block position ++ * even though a huge number of loop iterations will simply map to block positions within the same updating chunk. ++ * ++ * Our implementation here avoids this by pre-calculating the min/max chunk coordinates so we can iterate over only ++ * the relevant chunk positions once. This reduces what would always be 27 iterations to just 1-8 iterations. ++ * ++ * @reason Use faster implementation ++ * @author JellySquid ++ */ ++ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { ++ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { ++ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { ++ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); ++ // Paper end + } + } + } +@@ -129,17 +159,23 @@ public abstract class LightEngineStorage> e + } + + if (k >= 2 && j != 2) { +- if (this.p.contains(i)) { +- this.p.remove(i); +- } else { ++ if (!this.p.remove(i)) { // Paper - remove useless contains - credit to JellySquid ++ //this.p.remove(i); // Paper ++ //} else { // Paper + this.f.a(i, this.j(i)); + this.g.add(i); + this.k(i); + +- for (int l = -1; l <= 1; ++l) { +- for (int i1 = -1; i1 <= 1; ++i1) { +- for (int j1 = -1; j1 <= 1; ++j1) { +- this.h.add(SectionPosition.e(BlockPosition.a(i, i1, j1, l))); ++ // Paper start - reuse x/y/z and only notify valid chunks - Credit to JellySquid (See above method for notes) ++ int x = (int) (i >> 38); ++ int y = (int) ((i << 52) >> 52); ++ int z = (int) ((i << 26) >> 38); ++ ++ for (int z2 = (z - 1) >> 4; z2 <= (z + 1) >> 4; ++z2) { ++ for (int x2 = (x - 1) >> 4; x2 <= (x + 1) >> 4; ++x2) { ++ for (int y2 = (y - 1) >> 4; y2 <= (y + 1) >> 4; ++y2) { ++ this.dirty.add(SectionPosition.asLong(x2, y2, z2)); ++ // Paper end + } + } + } +@@ -165,9 +201,9 @@ public abstract class LightEngineStorage> e + return SectionPosition.e(j) == i; + }); + } else { +- int j = SectionPosition.c(SectionPosition.b(i)); +- int k = SectionPosition.c(SectionPosition.c(i)); +- int l = SectionPosition.c(SectionPosition.d(i)); ++ int j = (int) (i >> 42) << 4; // Paper - inline ++ int k = (int) (i << 44 >> 44) << 4; // Paper - inline ++ int l = (int) (i << 22 >> 42) << 4; // Paper - inline + + for (int i1 = 0; i1 < 16; ++i1) { + for (int j1 = 0; j1 < 16; ++j1) { +@@ -194,7 +230,7 @@ public abstract class LightEngineStorage> e + NibbleArray nibblearray; + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.a(lightenginelayer, i); + NibbleArray nibblearray1 = (NibbleArray) this.i.remove(i); + +@@ -212,7 +248,7 @@ public abstract class LightEngineStorage> e + longiterator = this.p.iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.l(i); + } + +@@ -223,12 +259,13 @@ public abstract class LightEngineStorage> e + Entry entry; + long j; + ++ NibbleArray test = null; // Paper + while (objectiterator.hasNext()) { + entry = (Entry) objectiterator.next(); + j = entry.getLongKey(); +- if (this.g(j)) { ++ if ((test = this.updating.getUpdatingOptimized(j)) != null) { // Paper - dont look up nibble twice + nibblearray = (NibbleArray) entry.getValue(); +- if (this.f.c(j) != nibblearray) { ++ if (test != nibblearray) { // Paper + this.a(lightenginelayer, j); + this.f.a(j, nibblearray); + this.g.add(j); +@@ -241,14 +278,14 @@ public abstract class LightEngineStorage> e + longiterator = this.i.keySet().iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.b(lightenginelayer, i); + } + } else { + longiterator = this.n.iterator(); + + while (longiterator.hasNext()) { +- i = (Long) longiterator.next(); ++ i = longiterator.nextLong(); // Paper + this.b(lightenginelayer, i); + } + } +@@ -269,15 +306,20 @@ public abstract class LightEngineStorage> e + + private void b(LightEngineLayer lightenginelayer, long i) { + if (this.g(i)) { +- int j = SectionPosition.c(SectionPosition.b(i)); +- int k = SectionPosition.c(SectionPosition.c(i)); +- int l = SectionPosition.c(SectionPosition.d(i)); ++ // Paper start ++ int secX = (int) (i >> 42); ++ int secY = (int) (i << 44 >> 44); ++ int secZ = (int) (i << 22 >> 42); ++ int j = secX << 4; // baseX ++ int k = secY << 4; // baseY ++ int l = secZ << 4; // baseZ ++ // Paper end + EnumDirection[] aenumdirection = LightEngineStorage.k; + int i1 = aenumdirection.length; + + for (int j1 = 0; j1 < i1; ++j1) { + EnumDirection enumdirection = aenumdirection[j1]; +- long k1 = SectionPosition.a(i, enumdirection); ++ long k1 = SectionPosition.getAdjacentFromSectionPos(secX, secY, secZ, enumdirection); // Paper - avoid extra unpacking + + if (!this.i.containsKey(k1) && this.g(k1)) { + for (int l1 = 0; l1 < 16; ++l1) { +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +index 0ab4917053c090c874e8bb59e750fd909636f89d..a994e7e93814796d1a5d86f8863d1d21bae51022 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageArray.java +@@ -6,13 +6,18 @@ import net.minecraft.world.level.chunk.NibbleArray; + + public abstract class LightEngineStorageArray> { + +- private final long[] b = new long[2]; +- private final NibbleArray[] c = new NibbleArray[2]; ++ // private final long[] b = new long[2]; // Paper - unused ++ private final NibbleArray[] c = new NibbleArray[]{NibbleArray.EMPTY_NIBBLE_ARRAY, NibbleArray.EMPTY_NIBBLE_ARRAY}; private final NibbleArray[] cache = c; // Paper - OBFHELPER + private boolean d; + protected final com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object data; // Paper - avoid copying light data + protected final boolean isVisible; // Paper - avoid copying light data +- java.util.function.Function lookup; // Paper - faster branchless lookup + ++ // Paper start - faster lookups with less branching, use interface to avoid boxing instead of Function ++ public final NibbleArrayAccess lookup; ++ public interface NibbleArrayAccess { ++ NibbleArray apply(long id); ++ } ++ // Paper end + // Paper start - avoid copying light data + protected LightEngineStorageArray(com.destroystokyo.paper.util.map.QueuedChangesMapLong2Object data, boolean isVisible) { + if (isVisible) { +@@ -20,12 +25,14 @@ public abstract class LightEngineStorageArray 0; --k) { +- this.b[k] = this.b[k - 1]; +- this.c[k] = this.c[k - 1]; +- } +- +- this.b[0] = i; +- this.c[0] = nibblearray; +- } +- ++ cache[1] = cache[0]; ++ cache[0] = nibblearray; + return nibblearray; } } ++ // Paper end ++ ++ @Nullable ++ public final NibbleArray c(final long i) { // Paper - final ++ // Paper start - optimize visible case or missed updating cases ++ if (this.d) { ++ // short circuit to optimized ++ return getUpdatingOptimized(i); ++ } ++ ++ return this.lookup.apply(i); ++ // Paper end ++ } + + @Nullable + public NibbleArray d(long i) { +@@ -81,13 +90,14 @@ public abstract class LightEngineStorageArray> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j = (((long) (baseX >> 4) & 4194303L) << 42) | (((long) (baseY >> 4) & 1048575L)) | (((long) (baseZ >> 4) & 4194303L) << 20); ++ NibbleArray nibblearray = this.e_visible.lookup.apply(j); ++ return nibblearray == null ? 0 : nibblearray.a(baseX & 15, baseY & 15, baseZ & 15); ++ // Paper end + } + + public static final class a extends LightEngineStorageArray { +diff --git a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +index 488403a6765598317faedc2d600ae82238e99e39..6d31b19c851081a37e6fcefdcdfcb7018fce6b26 100644 +--- a/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java ++++ b/src/main/java/net/minecraft/world/level/lighting/LightEngineStorageSky.java +@@ -28,7 +28,12 @@ public class LightEngineStorageSky extends LightEngineStorage> 38); ++ int baseY = (int) ((i << 52) >> 52); ++ int baseZ = (int) ((i << 26) >> 38); ++ long j = SectionPosition.blockPosAsSectionLong(baseX, baseY, baseZ); ++ // Paper end + int k = SectionPosition.c(j); + synchronized (this.visibleUpdateLock) { // Paper - avoid copying light data + LightEngineStorageSky.a lightenginestoragesky_a = (LightEngineStorageSky.a) this.e_visible; // Paper - avoid copying light data - must be after lock acquire +@@ -49,7 +54,7 @@ public class LightEngineStorageSky extends LightEngineStorage> 52) & 15, (int) baseZ & 15); // Paper - y changed above + } else { + return 15; + } +@@ -168,7 +173,7 @@ public class LightEngineStorageSky extends LightEngineStorage> 42) << 4; // Paper ++ int baseY = (int) (i << 44 >> 44) << 4; // Paper ++ int baseZ = (int) (i << 22 >> 42) << 4; // Paper + j = this.c(i); + if (j != 2 && !this.n.contains(i) && this.l.add(i)) { + int l; +@@ -203,10 +211,10 @@ public class LightEngineStorageSky extends LightEngineStorage> 42) << 4; // Paper ++ int baseY = (int) (i << 44 >> 44) << 4; // Paper ++ int baseZ = (int) (i << 22 >> 42) << 4; // Paper + if (this.l.remove(i) && this.g(i)) { + for (j = 0; j < 16; ++j) { + for (k = 0; k < 16; ++k) { +- long l3 = BlockPosition.a(SectionPosition.c(SectionPosition.b(i)) + j, SectionPosition.c(SectionPosition.c(i)) + 16 - 1, SectionPosition.c(SectionPosition.d(i)) + k); ++ long l3 = BlockPosition.a(baseX + j, baseY + 16 - 1, baseZ + k); // Paper + + lightenginelayer.a(Long.MAX_VALUE, l3, 15, false); + } diff --git a/Spigot-Server-Patches/0494-Delay-Chunk-Unloads-based-on-Player-Movement.patch b/Spigot-Server-Patches/0494-Delay-Chunk-Unloads-based-on-Player-Movement.patch index d0fee909c9..55bb5034fc 100644 --- a/Spigot-Server-Patches/0494-Delay-Chunk-Unloads-based-on-Player-Movement.patch +++ b/Spigot-Server-Patches/0494-Delay-Chunk-Unloads-based-on-Player-Movement.patch @@ -34,11 +34,11 @@ index 6463d3e4837d032a35654a035f42b8a805e0e286..1655bca0502e7b871de4addaa163536d + } + } } -diff --git a/src/main/java/net/minecraft/server/ChunkMapDistance.java b/src/main/java/net/minecraft/server/ChunkMapDistance.java -index 09fec533d7feebb90e989007dd19c952823550ba..3c7b225edbe23dc1959002293a6f8b816287b5a8 100644 ---- a/src/main/java/net/minecraft/server/ChunkMapDistance.java -+++ b/src/main/java/net/minecraft/server/ChunkMapDistance.java -@@ -176,6 +176,27 @@ public abstract class ChunkMapDistance { +diff --git a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +index f30939f345c75b8c7d71b6afe8f008fe747c7574..982352a21d3834c1c1dba24fffa361806227bed5 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkMapDistance.java ++++ b/src/main/java/net/minecraft/server/level/ChunkMapDistance.java +@@ -182,6 +182,27 @@ public abstract class ChunkMapDistance { boolean removed = false; // CraftBukkit if (arraysetsorted.remove(ticket)) { removed = true; // CraftBukkit @@ -66,10 +66,10 @@ index 09fec533d7feebb90e989007dd19c952823550ba..3c7b225edbe23dc1959002293a6f8b81 } if (arraysetsorted.isEmpty()) { -diff --git a/src/main/java/net/minecraft/server/Ticket.java b/src/main/java/net/minecraft/server/Ticket.java -index b5030d6f5d917ba33fb3c40903384fa7a56bc5f1..e41cb8613efc86499dfe3be36c9130ab6dc9b89e 100644 ---- a/src/main/java/net/minecraft/server/Ticket.java -+++ b/src/main/java/net/minecraft/server/Ticket.java +diff --git a/src/main/java/net/minecraft/server/level/Ticket.java b/src/main/java/net/minecraft/server/level/Ticket.java +index 90cbd12611b7b078f35f08f910453bcc02f6665b..6e5ae954c6eb40590bf8c83f592c22088d489be8 100644 +--- a/src/main/java/net/minecraft/server/level/Ticket.java ++++ b/src/main/java/net/minecraft/server/level/Ticket.java @@ -9,11 +9,13 @@ public final class Ticket implements Comparable> { public final T identifier; public final T getObjectReason() { return this.identifier; } // Paper - OBFHELPER private long d; public final long getCreationTick() { return this.d; } // Paper - OBFHELPER @@ -93,11 +93,11 @@ index b5030d6f5d917ba33fb3c40903384fa7a56bc5f1..e41cb8613efc86499dfe3be36c9130ab return j != 0L && i - this.d > j; } -diff --git a/src/main/java/net/minecraft/server/TicketType.java b/src/main/java/net/minecraft/server/TicketType.java -index 6fd852db6bcfbfbf84ec2acf6d23b08a6051165c..5c789b25f1df2eae8ea8ceb4ba977ba336fe6d5e 100644 ---- a/src/main/java/net/minecraft/server/TicketType.java -+++ b/src/main/java/net/minecraft/server/TicketType.java -@@ -26,6 +26,7 @@ public class TicketType { +diff --git a/src/main/java/net/minecraft/server/level/TicketType.java b/src/main/java/net/minecraft/server/level/TicketType.java +index f5d18834e0e2ee0e3bcf55810456766d2f134450..3c804c7b20a14ea6e510810e2be10c1cc89ff5c1 100644 +--- a/src/main/java/net/minecraft/server/level/TicketType.java ++++ b/src/main/java/net/minecraft/server/level/TicketType.java +@@ -30,6 +30,7 @@ public class TicketType { public static final TicketType ASYNC_LOAD = a("async_load", Long::compareTo); // Paper public static final TicketType PRIORITY = a("priority", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper public static final TicketType URGENT = a("urgent", Comparator.comparingLong(ChunkCoordIntPair::pair), 300); // Paper diff --git a/Spigot-Server-Patches/0495-Add-Plugin-Tickets-to-API-Chunk-Methods.patch b/Spigot-Server-Patches/0495-Add-Plugin-Tickets-to-API-Chunk-Methods.patch index 4d14f56ac7..6d72c1fd8a 100644 --- a/Spigot-Server-Patches/0495-Add-Plugin-Tickets-to-API-Chunk-Methods.patch +++ b/Spigot-Server-Patches/0495-Add-Plugin-Tickets-to-API-Chunk-Methods.patch @@ -22,7 +22,7 @@ wants it to collect even faster, they can restore that setting back to 1 instead Not adding it to .getType() though to keep behavior consistent with vanilla for performance reasons. diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9b6d081f7db0ed389776c68dc4771e7cbaebea7d..dfe6b9e680a4b64fd6a664581f0a1db81f04dafa 100644 +index 32e68e403950be62bd0330b268738225c2e70edd..d0c951878600a4227e558bc68d68098c59fb7b2b 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -346,7 +346,7 @@ public final class CraftServer implements Server { @@ -44,10 +44,10 @@ index 9b6d081f7db0ed389776c68dc4771e7cbaebea7d..dfe6b9e680a4b64fd6a664581f0a1db8 printSaveWarning = false; console.autosavePeriod = configuration.getInt("ticks-per.autosave"); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 59a9684d16d702777d834c64ebdcef0ef5a22623..602f0aa24adb641933c026aaba7d3245df628bbc 100644 +index fa2f6f737b41157b90f455b65d41b1e51fcb4eb5..0a9bdf5e2665aa379cd6c887c534189d8a197191 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -408,9 +408,22 @@ public class CraftWorld implements World { +@@ -406,8 +406,21 @@ public class CraftWorld implements World { @Override public Chunk getChunkAt(int x, int z) { @@ -60,18 +60,17 @@ index 59a9684d16d702777d834c64ebdcef0ef5a22623..602f0aa24adb641933c026aaba7d3245 + } + return chunk.bukkitChunk; + // Paper end - } - ++ } ++ + // Paper start + private void addTicket(int x, int z) { + MCUtil.MAIN_EXECUTOR.execute(() -> world.getChunkProvider().addTicket(TicketType.PLUGIN, new ChunkCoordIntPair(x, z), 0, Unit.INSTANCE)); // Paper -+ } + } + // Paper end -+ + @Override public Chunk getChunkAt(Block block) { - Preconditions.checkArgument(block != null, "null block"); -@@ -484,7 +497,7 @@ public class CraftWorld implements World { +@@ -482,7 +495,7 @@ public class CraftWorld implements World { public boolean unloadChunkRequest(int x, int z) { org.spigotmc.AsyncCatcher.catchOp("chunk unload"); // Spigot if (isChunkLoaded(x, z)) { @@ -80,7 +79,7 @@ index 59a9684d16d702777d834c64ebdcef0ef5a22623..602f0aa24adb641933c026aaba7d3245 } return true; -@@ -561,10 +574,12 @@ public class CraftWorld implements World { +@@ -559,9 +572,12 @@ public class CraftWorld implements World { org.spigotmc.AsyncCatcher.catchOp("chunk load"); // Spigot // Paper start - Optimize this method ChunkCoordIntPair chunkPos = new ChunkCoordIntPair(x, z); @@ -88,14 +87,14 @@ index 59a9684d16d702777d834c64ebdcef0ef5a22623..602f0aa24adb641933c026aaba7d3245 + if (immediate != null) return true; // Paper if (!generate) { - - IChunkAccess immediate = world.getChunkProvider().getChunkAtImmediately(x, z); ++ + //IChunkAccess immediate = world.getChunkProvider().getChunkAtImmediately(x, z); // Paper if (immediate == null) { immediate = world.getChunkProvider().playerChunkMap.getUnloadingChunk(x, z); } -@@ -572,7 +587,7 @@ public class CraftWorld implements World { - if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.server.Chunk)) { +@@ -569,7 +585,7 @@ public class CraftWorld implements World { + if (!(immediate instanceof ProtoChunkExtension) && !(immediate instanceof net.minecraft.world.level.chunk.Chunk)) { return false; // not full status } - world.getChunkProvider().addTicket(TicketType.PLUGIN, chunkPos, 1, Unit.INSTANCE); @@ -103,7 +102,7 @@ index 59a9684d16d702777d834c64ebdcef0ef5a22623..602f0aa24adb641933c026aaba7d3245 world.getChunkAt(x, z); // make sure we're at ticket level 32 or lower return true; } -@@ -599,7 +614,7 @@ public class CraftWorld implements World { +@@ -596,7 +612,7 @@ public class CraftWorld implements World { // we do this so we do not re-read the chunk data on disk } @@ -112,11 +111,11 @@ index 59a9684d16d702777d834c64ebdcef0ef5a22623..602f0aa24adb641933c026aaba7d3245 world.getChunkProvider().getChunkAt(x, z, ChunkStatus.FULL, true); return true; // Paper end -@@ -2550,6 +2565,7 @@ public class CraftWorld implements World { +@@ -2547,6 +2563,7 @@ public class CraftWorld implements World { } return this.world.getChunkProvider().getChunkAtAsynchronously(x, z, gen, urgent).thenComposeAsync((either) -> { - net.minecraft.server.Chunk chunk = (net.minecraft.server.Chunk) either.left().orElse(null); + net.minecraft.world.level.chunk.Chunk chunk = (net.minecraft.world.level.chunk.Chunk) either.left().orElse(null); + if (chunk != null) addTicket(x, z); // Paper return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); - }, MinecraftServer.getServer()); + }, net.minecraft.server.MinecraftServer.getServer()); } diff --git a/Spigot-Server-Patches/0496-Fix-missing-chunks-due-to-integer-overflow.patch b/Spigot-Server-Patches/0496-Fix-missing-chunks-due-to-integer-overflow.patch index 935940026e..15f03e8c36 100644 --- a/Spigot-Server-Patches/0496-Fix-missing-chunks-due-to-integer-overflow.patch +++ b/Spigot-Server-Patches/0496-Fix-missing-chunks-due-to-integer-overflow.patch @@ -12,11 +12,11 @@ is a few hundred thousand block gap before end land resuming to generate at The fix for the issue is quite simple, casting chunk coordinates to longs allows the distance calculation to avoid overflow and work as intended. -diff --git a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -index 844ad0fbdc6e2f9aee1d25fe21dcdf53eb28d559..9c15cd303ccc2928be4e3e7080e74e8314d7e0f2 100644 ---- a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -+++ b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -@@ -70,7 +70,9 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { +diff --git a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java +index 1d46e2c4e06cfe32eac06223e1966ce39c41685e..1077972d694d604c3ec97d333d34a9ab81819c33 100644 +--- a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java ++++ b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java +@@ -75,7 +75,9 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { int l = j / 2; int i1 = i % 2; int j1 = j % 2; diff --git a/Spigot-Server-Patches/0498-Fix-piston-physics-inconsistency-MC-188840.patch b/Spigot-Server-Patches/0498-Fix-piston-physics-inconsistency-MC-188840.patch index 8e792345ed..86e65e4b6f 100644 --- a/Spigot-Server-Patches/0498-Fix-piston-physics-inconsistency-MC-188840.patch +++ b/Spigot-Server-Patches/0498-Fix-piston-physics-inconsistency-MC-188840.patch @@ -46,11 +46,11 @@ index 7f140333c2e62012fa572c1a061d84432426997f..b67ba8f75e4a3358d7c2462918b85b0b + set("settings.unsupported-settings.allow-tnt-duplication", null); + } } -diff --git a/src/main/java/net/minecraft/server/BlockPiston.java b/src/main/java/net/minecraft/server/BlockPiston.java -index 0bab7dfb053c1aa92f5417c25fed5484e09bbec3..5d3bb5f393a1e0e4a2e8b9a466530a91279697a9 100644 ---- a/src/main/java/net/minecraft/server/BlockPiston.java -+++ b/src/main/java/net/minecraft/server/BlockPiston.java -@@ -370,12 +370,24 @@ public class BlockPiston extends BlockDirectional { +diff --git a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java +index e062fd288098127fae22a55562e0207ceaf50163..8aa51fb207820a7629d50b80ea821ec6cccf8b54 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/BlockPiston.java +@@ -399,12 +399,24 @@ public class BlockPiston extends BlockDirectional { } for (k = list.size() - 1; k >= 0; --k) { @@ -78,11 +78,11 @@ index 0bab7dfb053c1aa92f5417c25fed5484e09bbec3..5d3bb5f393a1e0e4a2e8b9a466530a91 aiblockdata[j++] = iblockdata1; } -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index 8b2758377b70aaf7a9d21a28d4bbe16389f22403..7d86f0fe55063f6875db9c6f99f4f72ed4144536 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -256,7 +256,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { +diff --git a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +index 8d13e60f40e1b760e9e69969dc3f37bc6c70dbe9..e70c3a8c9075b6c0bc73e6488d784dfe3b86e58d 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +@@ -279,7 +279,7 @@ public class TileEntityPiston extends TileEntity implements ITickable { IBlockData iblockdata = Block.b(this.a, (GeneratorAccess) this.world, this.position); if (iblockdata.isAir()) { diff --git a/Spigot-Server-Patches/0499-Fix-sand-duping.patch b/Spigot-Server-Patches/0499-Fix-sand-duping.patch index 2b9b035e50..e3e2417078 100644 --- a/Spigot-Server-Patches/0499-Fix-sand-duping.patch +++ b/Spigot-Server-Patches/0499-Fix-sand-duping.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Fix sand duping If the falling block dies during teleportation (entity#move), then we need to detect that by placing a check after the move. -diff --git a/src/main/java/net/minecraft/server/EntityFallingBlock.java b/src/main/java/net/minecraft/server/EntityFallingBlock.java -index 0fbcf454c2db2427055123424c6d10cfbb939c17..76aac1b131f314775e418339e434f4f2da2ad619 100644 ---- a/src/main/java/net/minecraft/server/EntityFallingBlock.java -+++ b/src/main/java/net/minecraft/server/EntityFallingBlock.java -@@ -64,6 +64,11 @@ public class EntityFallingBlock extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +index 411e3915c0aa00249aacb6658ed04309665d2fb4..62d8b53c024888aa43b8fddf8a475dfb8284a4cc 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityFallingBlock.java +@@ -103,6 +103,11 @@ public class EntityFallingBlock extends Entity { @Override public void tick() { @@ -22,7 +22,7 @@ index 0fbcf454c2db2427055123424c6d10cfbb939c17..76aac1b131f314775e418339e434f4f2 if (this.block.isAir()) { this.die(); } else { -@@ -86,6 +91,12 @@ public class EntityFallingBlock extends Entity { +@@ -125,6 +130,12 @@ public class EntityFallingBlock extends Entity { this.move(EnumMoveType.SELF, this.getMot()); diff --git a/Spigot-Server-Patches/0500-Prevent-position-desync-in-playerconnection-causing-.patch b/Spigot-Server-Patches/0500-Prevent-position-desync-in-playerconnection-causing-.patch index 0a03ef45da..a40e7d641a 100644 --- a/Spigot-Server-Patches/0500-Prevent-position-desync-in-playerconnection-causing-.patch +++ b/Spigot-Server-Patches/0500-Prevent-position-desync-in-playerconnection-causing-.patch @@ -13,11 +13,11 @@ to fix all exploits derieved from this usually unexpected behaviour, we need to move all of this dangerous logic outside of the move call and into an appropriate place in the tick method. -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 99dddcaac05cf6496fdfd3a824b42ff4336e00c5..747015df737074d5686e06083ff997286b0611c4 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1180,6 +1180,11 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index c42b981038fcca80de0ac293bef6a78697d3818f..8c8fca94487eb315def1afab43d3c709bfd2c55b 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1324,6 +1324,11 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.move(EnumMoveType.PLAYER, new Vec3D(d7, d8, d9)); this.player.setOnGround(packetplayinflying.b()); // CraftBukkit - SPIGOT-5810, SPIGOT-5835: reset by this.player.move diff --git a/Spigot-Server-Patches/0501-Fix-enderdragon-exp-dupe.patch b/Spigot-Server-Patches/0501-Fix-enderdragon-exp-dupe.patch index 94405b2a4e..6217196c77 100644 --- a/Spigot-Server-Patches/0501-Fix-enderdragon-exp-dupe.patch +++ b/Spigot-Server-Patches/0501-Fix-enderdragon-exp-dupe.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Fix enderdragon exp dupe Properly track death stage when unloading/loading in the dragon -diff --git a/src/main/java/net/minecraft/server/EntityEnderDragon.java b/src/main/java/net/minecraft/server/EntityEnderDragon.java -index 144ad80520487749a212c0b2c030386af53af14e..de53af8c01f8fa9636386737b6bc071b32f87cd1 100644 ---- a/src/main/java/net/minecraft/server/EntityEnderDragon.java -+++ b/src/main/java/net/minecraft/server/EntityEnderDragon.java -@@ -830,6 +830,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +diff --git a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +index 5168a40eb53565bb3028efe559601acf72bddae5..c296fcf80c2f3f210fa020416973ec8d5db541ba 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java ++++ b/src/main/java/net/minecraft/world/entity/boss/enderdragon/EntityEnderDragon.java +@@ -879,6 +879,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { public void saveData(NBTTagCompound nbttagcompound) { super.saveData(nbttagcompound); nbttagcompound.setInt("DragonPhase", this.bG.a().getControllerPhase().b()); @@ -18,7 +18,7 @@ index 144ad80520487749a212c0b2c030386af53af14e..de53af8c01f8fa9636386737b6bc071b } @Override -@@ -838,6 +839,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { +@@ -887,6 +888,7 @@ public class EntityEnderDragon extends EntityInsentient implements IMonster { if (nbttagcompound.hasKey("DragonPhase")) { this.bG.setControllerPhase(DragonControllerPhase.getById(nbttagcompound.getInt("DragonPhase"))); } diff --git a/Spigot-Server-Patches/0503-Expose-Arrow-getItemStack.patch b/Spigot-Server-Patches/0503-Expose-Arrow-getItemStack.patch index d8f23585d4..5bc5621e30 100644 --- a/Spigot-Server-Patches/0503-Expose-Arrow-getItemStack.patch +++ b/Spigot-Server-Patches/0503-Expose-Arrow-getItemStack.patch @@ -4,11 +4,11 @@ Date: Sat, 23 May 2020 10:31:11 -0400 Subject: [PATCH] Expose Arrow getItemStack -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 93084633d487684fb598038d148670fe6a00b3ed..402684ee2a42eefc843df663a1f3af9a8a66a0bb 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -520,6 +520,7 @@ public abstract class EntityArrow extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +index 5ecbe9135a71dd84e0722fa9c039c272a11d206f..4cd1ddec701252269de0ce8520ee492f1e1cbacb 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +@@ -558,6 +558,7 @@ public abstract class EntityArrow extends IProjectile { } } @@ -17,7 +17,7 @@ index 93084633d487684fb598038d148670fe6a00b3ed..402684ee2a42eefc843df663a1f3af9a @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java -index ddaa10704188a5a6862bcff783e492c19f4929e5..f310dccff5a11a2694faeabf017b0104362e38f7 100644 +index ea33a36dfa6f304946f5b998eb536678a9b2f98c..2ab41a24a22e736753276b95fa0d060017cca0bc 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftArrow.java @@ -103,6 +103,13 @@ public class CraftArrow extends AbstractProjectile implements AbstractArrow { diff --git a/Spigot-Server-Patches/0504-Add-and-implement-PlayerRecipeBookClickEvent.patch b/Spigot-Server-Patches/0504-Add-and-implement-PlayerRecipeBookClickEvent.patch index 3b2bb0dfe3..25bf672274 100644 --- a/Spigot-Server-Patches/0504-Add-and-implement-PlayerRecipeBookClickEvent.patch +++ b/Spigot-Server-Patches/0504-Add-and-implement-PlayerRecipeBookClickEvent.patch @@ -4,11 +4,11 @@ Date: Fri, 5 Jun 2020 18:24:06 -0400 Subject: [PATCH] Add and implement PlayerRecipeBookClickEvent -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 0b6eea023e7f1f1042b793a8d492bf71817de538..a227445b6c5c83d513d21614f7f1908d5b4bf632 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -2614,9 +2614,15 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 8c8fca94487eb315def1afab43d3c709bfd2c55b..3839a82328bd8d6f8e395b833c9bac6cc8564016 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -2758,9 +2758,15 @@ public class PlayerConnection implements PacketListenerPlayIn { PlayerConnectionUtils.ensureMainThread(packetplayinautorecipe, this, this.player.getWorldServer()); this.player.resetIdleTimer(); if (!this.player.isSpectator() && this.player.activeContainer.windowId == packetplayinautorecipe.b() && this.player.activeContainer.c(this.player) && this.player.activeContainer instanceof ContainerRecipeBook) { diff --git a/Spigot-Server-Patches/0505-Hide-sync-chunk-writes-behind-flag.patch b/Spigot-Server-Patches/0505-Hide-sync-chunk-writes-behind-flag.patch index 490fdece81..9b9dd4ede4 100644 --- a/Spigot-Server-Patches/0505-Hide-sync-chunk-writes-behind-flag.patch +++ b/Spigot-Server-Patches/0505-Hide-sync-chunk-writes-behind-flag.patch @@ -8,11 +8,11 @@ on harddrives. -DPaper.enable-sync-chunk-writes=true to enable -diff --git a/src/main/java/net/minecraft/server/DedicatedServerProperties.java b/src/main/java/net/minecraft/server/DedicatedServerProperties.java -index 205d56f88440789df8a028b3827dd388fea56f63..15a4f921b1ae2bbc66b7d58238b60151123a7eb3 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServerProperties.java -+++ b/src/main/java/net/minecraft/server/DedicatedServerProperties.java -@@ -105,7 +105,7 @@ public class DedicatedServerProperties extends PropertyManager { return MathHelper.clamp(integer, 1, 29999984); }, 29999984); diff --git a/Spigot-Server-Patches/0506-Limit-lightning-strike-effect-distance.patch b/Spigot-Server-Patches/0506-Limit-lightning-strike-effect-distance.patch index 5a5eccb0c4..779333c56d 100644 --- a/Spigot-Server-Patches/0506-Limit-lightning-strike-effect-distance.patch +++ b/Spigot-Server-Patches/0506-Limit-lightning-strike-effect-distance.patch @@ -35,11 +35,11 @@ index 1655bca0502e7b871de4addaa163536d86547a02..978062774c1db286bfb9b0ffdef19d88 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 7d9e3b636715106e467b383b9d1ab93407460971..180bfd4a60e18723b5fbae96123001284658afcb 100644 ---- a/src/main/java/net/minecraft/server/EntityLightning.java -+++ b/src/main/java/net/minecraft/server/EntityLightning.java -@@ -56,6 +56,17 @@ public class EntityLightning extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLightning.java b/src/main/java/net/minecraft/world/entity/EntityLightning.java +index 8946fcd93bd785a8c21683b932aa954fbf15d566..834ced9d9b385c8f1d66355244313d62a97d9c98 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLightning.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLightning.java +@@ -76,6 +76,17 @@ public class EntityLightning extends Entity { double deltaX = this.locX() - player.locX(); double deltaZ = this.locZ() - player.locZ(); double distanceSquared = deltaX * deltaX + deltaZ * deltaZ; @@ -57,7 +57,7 @@ index 7d9e3b636715106e467b383b9d1ab93407460971..180bfd4a60e18723b5fbae9612300128 if (distanceSquared > viewDistance * viewDistance) { double deltaLength = Math.sqrt(distanceSquared); double relativeX = player.locX() + (deltaX / deltaLength) * viewDistance; -@@ -66,7 +77,7 @@ public class EntityLightning extends Entity { +@@ -86,7 +97,7 @@ public class EntityLightning extends Entity { } } // CraftBukkit end diff --git a/Spigot-Server-Patches/0507-Add-permission-for-command-blocks.patch b/Spigot-Server-Patches/0507-Add-permission-for-command-blocks.patch index 6989f0fb89..d1f957641e 100644 --- a/Spigot-Server-Patches/0507-Add-permission-for-command-blocks.patch +++ b/Spigot-Server-Patches/0507-Add-permission-for-command-blocks.patch @@ -4,59 +4,11 @@ Date: Sat, 16 May 2020 10:05:30 +0200 Subject: [PATCH] Add permission for command blocks -diff --git a/src/main/java/net/minecraft/server/BlockCommand.java b/src/main/java/net/minecraft/server/BlockCommand.java -index dd7066d1a72f5c6f54c1f40a7b694deb827410dc..6b353a99c04e0312f520f8559c05ddaf51c26aaf 100644 ---- a/src/main/java/net/minecraft/server/BlockCommand.java -+++ b/src/main/java/net/minecraft/server/BlockCommand.java -@@ -105,7 +105,7 @@ public class BlockCommand extends BlockTileEntity { - public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { - TileEntity tileentity = world.getTileEntity(blockposition); - -- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { -+ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission - entityhuman.a((TileEntityCommand) tileentity); - return EnumInteractionResult.a(world.isClientSide); - } else { -diff --git a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -index e78809278b9159728722b2b33ad5dfae77e860ed..c12d7e1a399b3e4c576a0e32f22b3a439a5df369 100644 ---- a/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -+++ b/src/main/java/net/minecraft/server/CommandBlockListenerAbstract.java -@@ -178,7 +178,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { - } - - public EnumInteractionResult a(EntityHuman entityhuman) { -- if (!entityhuman.isCreativeAndOp()) { -+ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - return EnumInteractionResult.PASS; - } else { - if (entityhuman.getWorld().isClientSide) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 233070b1e169100d62a2dc80dc9d7178ca14ea0e..439b460216c90ff4e269240217d94e52d73d5132 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -652,7 +652,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); - if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); -- } else if (!this.player.isCreativeAndOp()) { -+ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); - } else { - CommandBlockListenerAbstract commandblocklistenerabstract = null; -@@ -715,7 +715,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); - if (!this.minecraftServer.getEnableCommandBlock()) { - this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); -- } else if (!this.player.isCreativeAndOp()) { -+ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission - this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); - } else { - CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 6ea691d81ea62bf05225baa303d974a6df0b822b..942b38aaf1845468852ac41e9fba230837f137e3 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -354,7 +354,7 @@ public class PlayerInteractManager { +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 3dcfb2326af92eb7a9cd16fd4725b3ae9acee17b..8b6367d3bb4cbb007bf68d957a6c1f701f5643b6 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -384,7 +384,7 @@ public class PlayerInteractManager { TileEntity tileentity = this.world.getTileEntity(blockposition); Block block = iblockdata.getBlock(); @@ -65,6 +17,54 @@ index 6ea691d81ea62bf05225baa303d974a6df0b822b..942b38aaf1845468852ac41e9fba2308 this.world.notify(blockposition, iblockdata, iblockdata, 3); return false; } else if (this.player.a((World) this.world, blockposition, this.gamemode)) { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 3839a82328bd8d6f8e395b833c9bac6cc8564016..a28441952e57e92a24a2933feb9188b13f15af2f 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -796,7 +796,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandblock, this, this.player.getWorldServer()); + if (!this.minecraftServer.getEnableCommandBlock()) { + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); +- } else if (!this.player.isCreativeAndOp()) { ++ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); + } else { + CommandBlockListenerAbstract commandblocklistenerabstract = null; +@@ -859,7 +859,7 @@ public class PlayerConnection implements PacketListenerPlayIn { + PlayerConnectionUtils.ensureMainThread(packetplayinsetcommandminecart, this, this.player.getWorldServer()); + if (!this.minecraftServer.getEnableCommandBlock()) { + this.player.sendMessage(new ChatMessage("advMode.notEnabled"), SystemUtils.b); +- } else if (!this.player.isCreativeAndOp()) { ++ } else if (!this.player.isCreativeAndOp() && !this.player.isCreative() && !this.player.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + this.player.sendMessage(new ChatMessage("advMode.notAllowed"), SystemUtils.b); + } else { + CommandBlockListenerAbstract commandblocklistenerabstract = packetplayinsetcommandminecart.a(this.player.world); +diff --git a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java +index 0f966c5defdda58fd7d31072b625f16928cddeb7..d92ec078e4df3a9d3f43f5d930890d1573bc4eac 100644 +--- a/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java ++++ b/src/main/java/net/minecraft/world/level/CommandBlockListenerAbstract.java +@@ -191,7 +191,7 @@ public abstract class CommandBlockListenerAbstract implements ICommandListener { + } + + public EnumInteractionResult a(EntityHuman entityhuman) { +- if (!entityhuman.isCreativeAndOp()) { ++ if (!entityhuman.isCreativeAndOp() && !entityhuman.isCreative() && !entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")) { // Paper - command block permission + return EnumInteractionResult.PASS; + } else { + if (entityhuman.getWorld().isClientSide) { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockCommand.java b/src/main/java/net/minecraft/world/level/block/BlockCommand.java +index ad50f86d11ff22f055ca9f26cd02a84e75c7d8c8..f7d22282a59277375d146e9459f9f43962dd7d09 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockCommand.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockCommand.java +@@ -128,7 +128,7 @@ public class BlockCommand extends BlockTileEntity { + public EnumInteractionResult interact(IBlockData iblockdata, World world, BlockPosition blockposition, EntityHuman entityhuman, EnumHand enumhand, MovingObjectPositionBlock movingobjectpositionblock) { + TileEntity tileentity = world.getTileEntity(blockposition); + +- if (tileentity instanceof TileEntityCommand && entityhuman.isCreativeAndOp()) { ++ if (tileentity instanceof TileEntityCommand && (entityhuman.isCreativeAndOp() || (entityhuman.isCreative() && entityhuman.getBukkitEntity().hasPermission("minecraft.commandblock")))) { // Paper - command block permission + entityhuman.a((TileEntityCommand) tileentity); + return EnumInteractionResult.a(world.isClientSide); + } else { diff --git a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java b/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java index 525ebf961e5da0687183a5e2ead23ed92cbd9d79..a4a809f302c5ff9c76cde5fc0add2ceec1bdf9b5 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/permissions/CraftDefaultPermissions.java diff --git a/Spigot-Server-Patches/0508-Ensure-Entity-AABB-s-are-never-invalid.patch b/Spigot-Server-Patches/0508-Ensure-Entity-AABB-s-are-never-invalid.patch index f34e3ff38e..a1e705e26b 100644 --- a/Spigot-Server-Patches/0508-Ensure-Entity-AABB-s-are-never-invalid.patch +++ b/Spigot-Server-Patches/0508-Ensure-Entity-AABB-s-are-never-invalid.patch @@ -4,11 +4,11 @@ Date: Sun, 10 May 2020 22:12:46 -0400 Subject: [PATCH] Ensure Entity AABB's are never invalid -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index feeb792e3357c14662a2a2dc5c294befd4bdc7c3..23e8de6d059a4976646184bc3a141d38291fadd1 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -389,7 +389,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 031b754079dc1944b232014c28c64cdb6bcad2fb..b0ef4810a4526feec57f8bceb7562aa7629d15af 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -474,7 +474,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public void setPosition(double d0, double d1, double d2) { this.setPositionRaw(d0, d1, d2); @@ -17,7 +17,7 @@ index feeb792e3357c14662a2a2dc5c294befd4bdc7c3..23e8de6d059a4976646184bc3a141d38 if (valid) ((WorldServer) world).chunkCheck(this); // CraftBukkit } -@@ -2904,6 +2904,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2989,6 +2989,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return new AxisAlignedBB(vec3d, vec3d1); } @@ -25,7 +25,7 @@ index feeb792e3357c14662a2a2dc5c294befd4bdc7c3..23e8de6d059a4976646184bc3a141d38 public void a(AxisAlignedBB axisalignedbb) { // CraftBukkit start - block invalid bounding boxes double minX = axisalignedbb.minX, -@@ -3342,6 +3343,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3427,6 +3428,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public void setPositionRaw(double d0, double d1, double d2) { diff --git a/Spigot-Server-Patches/0509-Optimize-WorldBorder-collision-checks-and-air.patch b/Spigot-Server-Patches/0509-Optimize-WorldBorder-collision-checks-and-air.patch index e622695b3c..84299812d0 100644 --- a/Spigot-Server-Patches/0509-Optimize-WorldBorder-collision-checks-and-air.patch +++ b/Spigot-Server-Patches/0509-Optimize-WorldBorder-collision-checks-and-air.patch @@ -4,11 +4,11 @@ Date: Sun, 10 May 2020 22:49:05 -0400 Subject: [PATCH] Optimize WorldBorder collision checks and air -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 23e8de6d059a4976646184bc3a141d38291fadd1..ad5139428e8cc10ed702dce3fa9c091c22eafa15 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -818,7 +818,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index b0ef4810a4526feec57f8bceb7562aa7629d15af..4a8f6c9a08c4e5012fd17978bf3b8e87a71f607b 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -903,7 +903,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne AxisAlignedBB axisalignedbb = this.getBoundingBox(); VoxelShapeCollision voxelshapecollision = VoxelShapeCollision.a(this); VoxelShape voxelshape = this.world.getWorldBorder().c(); @@ -17,11 +17,11 @@ index 23e8de6d059a4976646184bc3a141d38291fadd1..ad5139428e8cc10ed702dce3fa9c091c Stream stream1 = this.world.c(this, axisalignedbb.b(vec3d), (entity) -> { return true; }); -diff --git a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -index ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb..e841611bb7c36dffec44bb9e74a0a9657a113263 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -+++ b/src/main/java/net/minecraft/server/VoxelShapeSpliterator.java -@@ -128,10 +128,10 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { +diff --git a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java +index 1fe6aba0884755be3382d38cebfdd1916bd9180e..03b624e3f62a1b938efe2d5f7d8c2b58d362bbde 100644 +--- a/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java ++++ b/src/main/java/net/minecraft/world/level/VoxelShapeSpliterator.java +@@ -140,10 +140,10 @@ public class VoxelShapeSpliterator extends AbstractSpliterator { AxisAlignedBB axisalignedbb = this.a.getBoundingBox(); if (!a(worldborder, axisalignedbb)) { @@ -36,11 +36,23 @@ index ed0f3ddbcb7d6ce8a59ae3829f4cb11ae75046cb..e841611bb7c36dffec44bb9e74a0a965 return true; } } -diff --git a/src/main/java/net/minecraft/server/VoxelShapes.java b/src/main/java/net/minecraft/server/VoxelShapes.java -index 450957c41e144ef2b238051c4d5a242ca2b9ae83..e21c747b6c39155c44bf30860681d67b0b29fb12 100644 ---- a/src/main/java/net/minecraft/server/VoxelShapes.java -+++ b/src/main/java/net/minecraft/server/VoxelShapes.java -@@ -242,7 +242,7 @@ public final class VoxelShapes { +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +index 50e2085766caabec1125ca24a2117549efd1a354..bedaa9dd6390e81df5872c2dd6e202a038367bf6 100644 +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -52,6 +52,7 @@ public class WorldBorder { + return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); + } + ++ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER + public boolean a(AxisAlignedBB axisalignedbb) { + return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); + } +diff --git a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +index 2d7405d1fa7c8f378bebe86f5d0de57a129ed92d..858d4689e618c72250447adb61e0bcc3c156f8f3 100644 +--- a/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java ++++ b/src/main/java/net/minecraft/world/phys/shapes/VoxelShapes.java +@@ -252,7 +252,7 @@ public final class VoxelShapes { IBlockData iblockdata = iworldreader.getTypeIfLoaded(blockposition_mutableblockposition); // Paper if (iblockdata == null) return 0.0D; // Paper @@ -49,15 +61,3 @@ index 450957c41e144ef2b238051c4d5a242ca2b9ae83..e21c747b6c39155c44bf30860681d67b d0 = iblockdata.b((IBlockAccess) iworldreader, blockposition_mutableblockposition, voxelshapecollision).a(enumdirection_enumaxis2, axisalignedbb.d((double) (-blockposition_mutableblockposition.getX()), (double) (-blockposition_mutableblockposition.getY()), (double) (-blockposition_mutableblockposition.getZ())), d0); if (Math.abs(d0) < 1.0E-7D) { return 0.0D; -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index adab2bd76e7e99140218ddbdb00aa9c27c0d0183..f011869880fedae4b69e505491e8bdbc5f51dfba 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -42,6 +42,7 @@ public class WorldBorder { - return (double) chunkcoordintpair.f() > this.e() && (double) chunkcoordintpair.d() < this.g() && (double) chunkcoordintpair.g() > this.f() && (double) chunkcoordintpair.e() < this.h(); - } - -+ public final boolean isInBounds(AxisAlignedBB aabb) { return this.a(aabb); } // Paper - OBFHELPER - public boolean a(AxisAlignedBB axisalignedbb) { - return axisalignedbb.maxX > this.e() && axisalignedbb.minX < this.g() && axisalignedbb.maxZ > this.f() && axisalignedbb.minZ < this.h(); - } diff --git a/Spigot-Server-Patches/0510-Fix-Per-World-Difficulty-Remembering-Difficulty.patch b/Spigot-Server-Patches/0510-Fix-Per-World-Difficulty-Remembering-Difficulty.patch index fe799b998e..97b0c48a60 100644 --- a/Spigot-Server-Patches/0510-Fix-Per-World-Difficulty-Remembering-Difficulty.patch +++ b/Spigot-Server-Patches/0510-Fix-Per-World-Difficulty-Remembering-Difficulty.patch @@ -7,42 +7,11 @@ Fixes per world difficulty with /difficulty command and also makes it so that the server keeps the last difficulty used instead of restoring the server.properties every single load. -diff --git a/src/main/java/net/minecraft/server/CommandDifficulty.java b/src/main/java/net/minecraft/server/CommandDifficulty.java -index bc71070c670d1a64c60b9f19711a5e8a50ace56e..9efc743e028650ccc9cda5a2c9deb1836253b91d 100644 ---- a/src/main/java/net/minecraft/server/CommandDifficulty.java -+++ b/src/main/java/net/minecraft/server/CommandDifficulty.java -@@ -36,10 +36,11 @@ public class CommandDifficulty { - public static int a(CommandListenerWrapper commandlistenerwrapper, EnumDifficulty enumdifficulty) throws CommandSyntaxException { - MinecraftServer minecraftserver = commandlistenerwrapper.getServer(); - -- if (minecraftserver.getSaveData().getDifficulty() == enumdifficulty) { -+ WorldServer world = commandlistenerwrapper.getWorld(); // Paper -+ if (world.worldDataServer.getDifficulty() == enumdifficulty) { // Paper - throw CommandDifficulty.a.create(enumdifficulty.c()); - } else { -- minecraftserver.a(enumdifficulty, true); -+ minecraftserver.a(world, enumdifficulty, true); // Paper - commandlistenerwrapper.sendMessage(new ChatMessage("commands.difficulty.success", new Object[]{enumdifficulty.b()}), true); - return 0; - } -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index f5792b999ce42acb13ae9a62ceb2ddec39abe209..5504facd2e453238caa71d98743be5416d4dd4fe 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -323,7 +323,7 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer - - @Override - public void updateWorldSettings() { -- this.a(this.getDedicatedServerProperties().difficulty, true); -+ //this.a(this.getDedicatedServerProperties().difficulty, true); // Paper - Don't overwrite level.dat's difficulty, keep current - } - - @Override diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 89de6c1a2463b2ea3aefb31c22e277fe707555a3..cfe770b7b77bb08407b164b932b898dfbe869b28 100644 +index b1a05896c50787657421e4cf721b9100bb38706d..31a083730536177c5ff5ae463ca0b9780968a5d8 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1526,11 +1526,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +index d4cf5536883192c49636177cb782a9a2f514cd87..f3cd2b585c6cf1cf948de49a5608e04ee6eb9aab 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutChat.java +@@ -20,7 +20,7 @@ public class PacketPlayOutChat implements Packet { public PacketPlayOutChat(IChatBaseComponent ichatbasecomponent, ChatMessageType chatmessagetype, UUID uuid) { this.a = ichatbasecomponent; this.b = chatmessagetype; diff --git a/Spigot-Server-Patches/0514-Support-old-UUID-format-for-NBT.patch b/Spigot-Server-Patches/0514-Support-old-UUID-format-for-NBT.patch index 198a1cfd31..f33e33ece5 100644 --- a/Spigot-Server-Patches/0514-Support-old-UUID-format-for-NBT.patch +++ b/Spigot-Server-Patches/0514-Support-old-UUID-format-for-NBT.patch @@ -7,11 +7,11 @@ We have stored UUID in plenty of places that did not get DFU'd So just look for old format and load it if it exists. -diff --git a/src/main/java/net/minecraft/server/GameProfileSerializer.java b/src/main/java/net/minecraft/server/GameProfileSerializer.java -index 66d503a91665952b98c8cdc06c9ad10782b0558b..dca47422816e0ff5cf56ee73d0aa7e2f74a48060 100644 ---- a/src/main/java/net/minecraft/server/GameProfileSerializer.java -+++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java -@@ -28,6 +28,11 @@ public final class GameProfileSerializer { +diff --git a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java +index 0560d115288c67e46d921ce529e603f424e601f5..50515cd9287505fcc8ab52e47393fb1dc771bfc3 100644 +--- a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java ++++ b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java +@@ -41,6 +41,11 @@ public final class GameProfileSerializer { s = nbttagcompound.getString("Name"); } @@ -23,11 +23,11 @@ index 66d503a91665952b98c8cdc06c9ad10782b0558b..dca47422816e0ff5cf56ee73d0aa7e2f if (nbttagcompound.b("Id")) { uuid = nbttagcompound.a("Id"); } -diff --git a/src/main/java/net/minecraft/server/NBTTagCompound.java b/src/main/java/net/minecraft/server/NBTTagCompound.java -index 8dd91ddf9e1489ec035452c590cbd59afa44c18f..06d5acab794e3ee139a11f9b068e8a359c46db2c 100644 ---- a/src/main/java/net/minecraft/server/NBTTagCompound.java -+++ b/src/main/java/net/minecraft/server/NBTTagCompound.java -@@ -136,6 +136,12 @@ public class NBTTagCompound implements NBTBase { +diff --git a/src/main/java/net/minecraft/nbt/NBTTagCompound.java b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +index e37c82c3af7c0fea9c85f7bc8d7a4df648e723ff..b8a0bbac91c64254f7d4b0661a2365b6ece9bbc7 100644 +--- a/src/main/java/net/minecraft/nbt/NBTTagCompound.java ++++ b/src/main/java/net/minecraft/nbt/NBTTagCompound.java +@@ -142,6 +142,12 @@ public class NBTTagCompound implements NBTBase { public void setUUID(String prefix, UUID uuid) { a(prefix, uuid); } // Paper - OBFHELPER public void a(String s, UUID uuid) { @@ -40,7 +40,7 @@ index 8dd91ddf9e1489ec035452c590cbd59afa44c18f..06d5acab794e3ee139a11f9b068e8a35 this.map.put(s, GameProfileSerializer.a(uuid)); } -@@ -143,11 +149,21 @@ public class NBTTagCompound implements NBTBase { +@@ -149,11 +155,21 @@ public class NBTTagCompound implements NBTBase { @Nullable public UUID getUUID(String prefix) { return a(prefix); } // Paper - OBFHELPER @Nullable public UUID a(String s) { diff --git a/Spigot-Server-Patches/0515-Clean-up-duplicated-GameProfile-Properties.patch b/Spigot-Server-Patches/0515-Clean-up-duplicated-GameProfile-Properties.patch index 5d2c684b69..7309e30816 100644 --- a/Spigot-Server-Patches/0515-Clean-up-duplicated-GameProfile-Properties.patch +++ b/Spigot-Server-Patches/0515-Clean-up-duplicated-GameProfile-Properties.patch @@ -8,11 +8,11 @@ growing to large sizes and preventing login. This now automatically cleans up the extra properties. -diff --git a/src/main/java/net/minecraft/server/GameProfileSerializer.java b/src/main/java/net/minecraft/server/GameProfileSerializer.java -index dca47422816e0ff5cf56ee73d0aa7e2f74a48060..1fe44d4a1a1895f5715c720f9d7d7acb10e50f61 100644 ---- a/src/main/java/net/minecraft/server/GameProfileSerializer.java -+++ b/src/main/java/net/minecraft/server/GameProfileSerializer.java -@@ -47,8 +47,8 @@ public final class GameProfileSerializer { +diff --git a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java +index 50515cd9287505fcc8ab52e47393fb1dc771bfc3..a654ea9e43c4e7dd9cde1c47d0b07834f47aa751 100644 +--- a/src/main/java/net/minecraft/nbt/GameProfileSerializer.java ++++ b/src/main/java/net/minecraft/nbt/GameProfileSerializer.java +@@ -60,8 +60,8 @@ public final class GameProfileSerializer { while (iterator.hasNext()) { String s1 = (String) iterator.next(); NBTTagList nbttaglist = nbttagcompound1.getList(s1, 10); @@ -23,7 +23,7 @@ index dca47422816e0ff5cf56ee73d0aa7e2f74a48060..1fe44d4a1a1895f5715c720f9d7d7acb NBTTagCompound nbttagcompound2 = nbttaglist.getCompound(i); String s2 = nbttagcompound2.getString("Value"); -@@ -234,7 +234,7 @@ public final class GameProfileSerializer { +@@ -247,7 +247,7 @@ public final class GameProfileSerializer { Optional optional = iblockstate.b(nbttagcompound.getString(s)); if (optional.isPresent()) { @@ -32,7 +32,7 @@ index dca47422816e0ff5cf56ee73d0aa7e2f74a48060..1fe44d4a1a1895f5715c720f9d7d7acb } else { GameProfileSerializer.LOGGER.warn("Unable to read property: {} with value: {} for blockstate: {}", s, nbttagcompound.getString(s), nbttagcompound1.toString()); return s0; -@@ -264,8 +264,8 @@ public final class GameProfileSerializer { +@@ -277,8 +277,8 @@ public final class GameProfileSerializer { return nbttagcompound; } @@ -43,26 +43,26 @@ index dca47422816e0ff5cf56ee73d0aa7e2f74a48060..1fe44d4a1a1895f5715c720f9d7d7acb } public static NBTTagCompound a(DataFixer datafixer, DataFixTypes datafixtypes, NBTTagCompound nbttagcompound, int i) { -diff --git a/src/main/java/net/minecraft/server/ItemSkullPlayer.java b/src/main/java/net/minecraft/server/ItemSkullPlayer.java -index 28f1ce9031c73d09b55a5c6aac5d34e66e9f7c12..61f4cf9cc62a1b2ba59137b8682cb58834b4abcc 100644 ---- a/src/main/java/net/minecraft/server/ItemSkullPlayer.java -+++ b/src/main/java/net/minecraft/server/ItemSkullPlayer.java -@@ -53,6 +53,18 @@ public class ItemSkullPlayer extends ItemBlockWallable { +diff --git a/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java b/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java +index 70207d1ca5b971f829911b1231160f4664062da0..47eed24fa28db8c12ce98b6b72ca1671e13e9f52 100644 +--- a/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java ++++ b/src/main/java/net/minecraft/world/item/ItemSkullPlayer.java +@@ -59,6 +59,18 @@ public class ItemSkullPlayer extends ItemBlockWallable { return true; } else { // CraftBukkit start + // Paper start - clean up old duplicated properties + NBTTagCompound properties = nbttagcompound.getCompound("SkullOwner").getCompound("Properties"); + for (String key : properties.getKeys()) { -+ NBTTagList values = properties.getList(key, 10); ++ net.minecraft.nbt.NBTTagList values = properties.getList(key, 10); + if (values.size() > 1) { -+ NBTBase texture = values.get(values.size() - 1); -+ values = new NBTTagList(); ++ net.minecraft.nbt.NBTBase texture = values.get(values.size() - 1); ++ values = new net.minecraft.nbt.NBTTagList(); + values.add(texture); + properties.set(key, values); + } + } + // Paper end - NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts + net.minecraft.nbt.NBTTagList textures = nbttagcompound.getCompound("SkullOwner").getCompound("Properties").getList("textures", 10); // Safe due to method contracts for (int i = 0; i < textures.size(); i++) { if (textures.get(i) instanceof NBTTagCompound && !((NBTTagCompound) textures.get(i)).hasKeyOfType("Signature", 8) && ((NBTTagCompound) textures.get(i)).getString("Value").trim().isEmpty()) { diff --git a/Spigot-Server-Patches/0517-Remove-some-streams-from-structures.patch b/Spigot-Server-Patches/0517-Remove-some-streams-from-structures.patch index 9a130be253..11c5f23cf0 100644 --- a/Spigot-Server-Patches/0517-Remove-some-streams-from-structures.patch +++ b/Spigot-Server-Patches/0517-Remove-some-streams-from-structures.patch @@ -5,58 +5,19 @@ Subject: [PATCH] Remove some streams from structures This showed up a lot in the spark profiler, should have a low-medium performance improvement. -diff --git a/src/main/java/net/minecraft/server/BiomeBase.java b/src/main/java/net/minecraft/server/BiomeBase.java -index 260fd033c1017389a6f28447a6017b0ca15514d8..0854ac9ef586b378420d9899f3afd2755e6f9f33 100644 ---- a/src/main/java/net/minecraft/server/BiomeBase.java -+++ b/src/main/java/net/minecraft/server/BiomeBase.java -@@ -209,9 +209,11 @@ public final class BiomeBase { - int l1 = j1 << 4; - - try { -- structuremanager.a(SectionPosition.a(blockposition), structuregenerator).forEach((structurestart) -> { -- structurestart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); -- }); -+ // Paper start - remove structure streams -+ for (StructureStart structureStart : structuremanager.getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { -+ structureStart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); -+ } -+ // Paper end - } catch (Exception exception) { - CrashReport crashreport = CrashReport.a(exception, "Feature placement"); - -diff --git a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -index 4741d28aec73ffa1d5a9f60a4086eac3375c83b1..321ebe8891defb46f3ad3dfea37c9bb6e2025ad7 100644 ---- a/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -+++ b/src/main/java/net/minecraft/server/ChunkGeneratorAbstract.java -@@ -421,7 +421,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - while (iterator.hasNext()) { - StructureGenerator structuregenerator = (StructureGenerator) iterator.next(); - -- structuremanager.a(SectionPosition.a(chunkcoordintpair, 0), structuregenerator).forEach((structurestart) -> { -+ for (StructureStart structurestart : structuremanager.getFeatureStarts(SectionPosition.a(chunkcoordintpair, 0), structuregenerator)) { // Paper - remove structure streams - Iterator iterator1 = structurestart.d().iterator(); - - while (iterator1.hasNext()) { -@@ -453,7 +453,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { - } - } - -- }); -+ } // Paper - remove structure streams - } - - double[][][] adouble = new double[2][this.p + 1][this.o + 1]; -diff --git a/src/main/java/net/minecraft/server/StructureManager.java b/src/main/java/net/minecraft/server/StructureManager.java -index c434427ce7bd206ed5d2efa2560e593b1186c666..f199368a6d78b0cd52f11ca2c8509d729b918852 100644 ---- a/src/main/java/net/minecraft/server/StructureManager.java -+++ b/src/main/java/net/minecraft/server/StructureManager.java -@@ -1,12 +1,13 @@ - package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/StructureManager.java b/src/main/java/net/minecraft/world/level/StructureManager.java +index a6a3bd3d60c30859b5a59e057d430c826d93e83c..a21b19a8fc2ecf01a49f20b611280d878c1d9100 100644 +--- a/src/main/java/net/minecraft/world/level/StructureManager.java ++++ b/src/main/java/net/minecraft/world/level/StructureManager.java +@@ -1,6 +1,7 @@ + package net.minecraft.world.level; import com.mojang.datafixers.DataFixUtils; +import it.unimi.dsi.fastutil.objects.ObjectArrayList; // Paper import java.util.stream.Stream; import javax.annotation.Nullable; + import net.minecraft.core.BaseBlockPosition; +@@ -15,7 +16,7 @@ import net.minecraft.world.level.levelgen.structure.StructureStart; public class StructureManager { @@ -65,7 +26,7 @@ index c434427ce7bd206ed5d2efa2560e593b1186c666..f199368a6d78b0cd52f11ca2c8509d72 private final GeneratorSettings b; public StructureManager(GeneratorAccess generatoraccess, GeneratorSettings generatorsettings) { -@@ -32,6 +33,20 @@ public class StructureManager { +@@ -41,6 +42,20 @@ public class StructureManager { }); } @@ -86,7 +47,7 @@ index c434427ce7bd206ed5d2efa2560e593b1186c666..f199368a6d78b0cd52f11ca2c8509d72 @Nullable public StructureStart a(SectionPosition sectionposition, StructureGenerator structuregenerator, IStructureAccess istructureaccess) { return istructureaccess.a(structuregenerator); -@@ -50,13 +65,21 @@ public class StructureManager { +@@ -59,13 +74,21 @@ public class StructureManager { } public StructureStart a(BlockPosition blockposition, boolean flag, StructureGenerator structuregenerator) { @@ -115,3 +76,44 @@ index c434427ce7bd206ed5d2efa2560e593b1186c666..f199368a6d78b0cd52f11ca2c8509d72 } // Spigot start +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +index 7147cdda756ccb3d4f6880802128f68601783883..3a050fc7d7abeb3c85b6a5d4d3751cdd9a77c82f 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeBase.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeBase.java +@@ -238,9 +238,11 @@ public final class BiomeBase { + int l1 = j1 << 4; + + try { +- structuremanager.a(SectionPosition.a(blockposition), structuregenerator).forEach((structurestart) -> { +- structurestart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); +- }); ++ // Paper start - remove structure streams ++ for (StructureStart structureStart : structuremanager.getFeatureStarts(SectionPosition.a(blockposition), structuregenerator)) { ++ structureStart.a(regionlimitedworldaccess, structuremanager, chunkgenerator, seededrandom, new StructureBoundingBox(k1, l1, k1 + 15, l1 + 15), new ChunkCoordIntPair(i1, j1)); ++ } ++ // Paper end + } catch (Exception exception) { + CrashReport crashreport = CrashReport.a(exception, "Feature placement"); + +diff --git a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +index 700b32322e8d0fbb8ec2824e50a340be16b48f81..d842cb5a8fdcdd8f77c7b44cc83c8341f947d7b3 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/ChunkGeneratorAbstract.java +@@ -455,7 +455,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + while (iterator.hasNext()) { + StructureGenerator structuregenerator = (StructureGenerator) iterator.next(); + +- structuremanager.a(SectionPosition.a(chunkcoordintpair, 0), structuregenerator).forEach((structurestart) -> { ++ for (StructureStart structurestart : structuremanager.getFeatureStarts(SectionPosition.a(chunkcoordintpair, 0), structuregenerator)) { // Paper - remove structure streams + Iterator iterator1 = structurestart.d().iterator(); + + while (iterator1.hasNext()) { +@@ -487,7 +487,7 @@ public final class ChunkGeneratorAbstract extends ChunkGenerator { + } + } + +- }); ++ } // Paper - remove structure streams + } + + double[][][] adouble = new double[2][this.p + 1][this.o + 1]; diff --git a/Spigot-Server-Patches/0518-Remove-streams-from-classes-related-villager-gossip.patch b/Spigot-Server-Patches/0518-Remove-streams-from-classes-related-villager-gossip.patch index f9bc60312e..2e8b227335 100644 --- a/Spigot-Server-Patches/0518-Remove-streams-from-classes-related-villager-gossip.patch +++ b/Spigot-Server-Patches/0518-Remove-streams-from-classes-related-villager-gossip.patch @@ -4,10 +4,10 @@ Date: Wed, 1 Jul 2020 18:01:49 -0400 Subject: [PATCH] Remove streams from classes related villager gossip -diff --git a/src/main/java/net/minecraft/server/Reputation.java b/src/main/java/net/minecraft/server/Reputation.java -index 09d2fc5769089f6d29971d10de5b8209829baae8..7315cf5ee476ed45b4c2a56a723639b264672cb6 100644 ---- a/src/main/java/net/minecraft/server/Reputation.java -+++ b/src/main/java/net/minecraft/server/Reputation.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java +index 9cc3a18636a356977577076e96cb7be706c61abf..7d34d1157786227ac210edc1595a024ccb61a3e9 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/Reputation.java @@ -9,6 +9,7 @@ import com.mojang.serialization.DynamicOps; import it.unimi.dsi.fastutil.objects.Object2IntMap; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; @@ -16,7 +16,7 @@ index 09d2fc5769089f6d29971d10de5b8209829baae8..7315cf5ee476ed45b4c2a56a723639b2 import it.unimi.dsi.fastutil.objects.ObjectIterator; import java.util.Arrays; import java.util.Collection; -@@ -49,8 +50,21 @@ public class Reputation { +@@ -51,8 +52,21 @@ public class Reputation { }); } @@ -39,7 +39,7 @@ index 09d2fc5769089f6d29971d10de5b8209829baae8..7315cf5ee476ed45b4c2a56a723639b2 if (list.isEmpty()) { return Collections.emptyList(); -@@ -117,7 +131,7 @@ public class Reputation { +@@ -119,7 +133,7 @@ public class Reputation { } public Dynamic a(DynamicOps dynamicops) { @@ -48,7 +48,7 @@ index 09d2fc5769089f6d29971d10de5b8209829baae8..7315cf5ee476ed45b4c2a56a723639b2 return reputation_b.a(dynamicops); }).map(Dynamic::getValue))); } -@@ -142,18 +156,30 @@ public class Reputation { +@@ -144,18 +158,30 @@ public class Reputation { public static class a { // Paper - make public @@ -85,10 +85,10 @@ index 09d2fc5769089f6d29971d10de5b8209829baae8..7315cf5ee476ed45b4c2a56a723639b2 } public Stream a(UUID uuid) { -diff --git a/src/main/java/net/minecraft/server/ReputationType.java b/src/main/java/net/minecraft/server/ReputationType.java -index 23dfa1d13fe1e1e67bcae0d7556f4ea1cf3d090d..73ad45295efbdfb5bd37a7743e17f8f210d3efbf 100644 ---- a/src/main/java/net/minecraft/server/ReputationType.java -+++ b/src/main/java/net/minecraft/server/ReputationType.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java b/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java +index 89651e6e3bb1cfbb8eb8a120b3c3e553cd831a68..6036476aac4a81152e8b142445041ecdb2d6e5d1 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java ++++ b/src/main/java/net/minecraft/world/entity/ai/gossip/ReputationType.java @@ -11,7 +11,7 @@ public enum ReputationType { MAJOR_NEGATIVE("major_negative", -5, 100, 10, 10), MINOR_NEGATIVE("minor_negative", -1, 200, 20, 20), MINOR_POSITIVE("minor_positive", 1, 200, 1, 5), MAJOR_POSITIVE("major_positive", 5, 100, 0, 100), TRADING("trading", 1, 25, 2, 20); diff --git a/Spigot-Server-Patches/0520-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch b/Spigot-Server-Patches/0520-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch index c53214ae5c..c5d87e17db 100644 --- a/Spigot-Server-Patches/0520-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch +++ b/Spigot-Server-Patches/0520-Improve-EntityTargetLivingEntityEvent-for-1.16-mobs.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Improve EntityTargetLivingEntityEvent for 1.16 mobs CraftBukkit has a bug in their implementation and is incorrectly handling forget Also adds more target reasons for why it forgot target. -diff --git a/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java b/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java -index 2e1b817a639fdd46b07dc70150f246cac3b35232..d98f57d2025c488dc1884132678005b861566869 100644 ---- a/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java -+++ b/src/main/java/net/minecraft/server/BehaviorAttackTargetForget.java -@@ -27,15 +27,15 @@ public class BehaviorAttackTargetForget extends Beha +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java +index ad2e4be7483d39aeb7be3727aba6a5fe89ea9602..05c507270ff5b4c0d684d0fc4a69ee47618cd281 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorAttackTargetForget.java +@@ -33,15 +33,15 @@ public class BehaviorAttackTargetForget extends Beha protected void a(WorldServer worldserver, E e0, long i) { if (a((EntityLiving) e0)) { @@ -31,7 +31,7 @@ index 2e1b817a639fdd46b07dc70150f246cac3b35232..d98f57d2025c488dc1884132678005b8 } } -@@ -59,17 +59,20 @@ public class BehaviorAttackTargetForget extends Beha +@@ -65,17 +65,20 @@ public class BehaviorAttackTargetForget extends Beha return optional.isPresent() && !((EntityLiving) optional.get()).isAlive(); } diff --git a/Spigot-Server-Patches/0521-Add-entity-liquid-API.patch b/Spigot-Server-Patches/0521-Add-entity-liquid-API.patch index 4e63f6761f..bb696277f1 100644 --- a/Spigot-Server-Patches/0521-Add-entity-liquid-API.patch +++ b/Spigot-Server-Patches/0521-Add-entity-liquid-API.patch @@ -4,11 +4,11 @@ Date: Thu, 2 Jul 2020 18:11:43 -0500 Subject: [PATCH] Add entity liquid API -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index ad5139428e8cc10ed702dce3fa9c091c22eafa15..83a469447e39b801442769fcb5979e987e2adae9 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1075,12 +1075,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 4a8f6c9a08c4e5012fd17978bf3b8e87a71f607b..1aa2f0f5c021345643c13fd9b6ef0a070c34c43c 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1160,12 +1160,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.inWater; } @@ -23,7 +23,7 @@ index ad5139428e8cc10ed702dce3fa9c091c22eafa15..83a469447e39b801442769fcb5979e98 private boolean k() { return this.world.getType(this.getChunkCoordinates()).a(Blocks.BUBBLE_COLUMN); } -@@ -1094,6 +1095,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1179,6 +1180,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.isInWater() || this.isInRain() || this.k(); } @@ -31,7 +31,7 @@ index ad5139428e8cc10ed702dce3fa9c091c22eafa15..83a469447e39b801442769fcb5979e98 public boolean aH() { return this.isInWater() || this.k(); } -@@ -1236,6 +1238,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1321,6 +1323,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne return this.O == tag; } @@ -40,10 +40,10 @@ index ad5139428e8cc10ed702dce3fa9c091c22eafa15..83a469447e39b801442769fcb5979e98 return !this.justCreated && this.M.getDouble(TagsFluid.LAVA) > 0.0D; } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index 017410819a628c1b373f45ac5a0e9f00dd56639e..dc42bd1b2b89881789481d736a57011936857abf 100644 +index 27b90388cc21ffdccaabc8072ead1bd29f3e88c6..d76800778ccf05913ff887a566b3a2f11ec2d40b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1134,5 +1134,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1133,5 +1133,29 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason getEntitySpawnReason() { return getHandle().spawnReason; } diff --git a/Spigot-Server-Patches/0522-Update-itemstack-legacy-name-and-lore.patch b/Spigot-Server-Patches/0522-Update-itemstack-legacy-name-and-lore.patch index 07dcdf21e5..56899b1db6 100644 --- a/Spigot-Server-Patches/0522-Update-itemstack-legacy-name-and-lore.patch +++ b/Spigot-Server-Patches/0522-Update-itemstack-legacy-name-and-lore.patch @@ -4,11 +4,11 @@ Date: Wed, 1 Jul 2020 11:57:40 -0500 Subject: [PATCH] Update itemstack legacy name and lore -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index b6f771ed5032cd18b1bcc086a937f66996a26057..a3d8d8ec0e99435a58ab93a7b1f90d16be2a2289 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -83,6 +83,44 @@ public final class ItemStack { +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 3d5a4d662ae4880fa27bd681127ddf7d1f70b51c..8b5aaa18d278f20e32e25edddc2a10069c2ba5e6 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -137,6 +137,44 @@ public final class ItemStack { list.sort((Comparator) enchantSorter); // Paper } catch (Exception ignored) {} } @@ -53,7 +53,7 @@ index b6f771ed5032cd18b1bcc086a937f66996a26057..a3d8d8ec0e99435a58ab93a7b1f90d16 // Paper end public ItemStack(IMaterial imaterial) { -@@ -128,6 +166,7 @@ public final class ItemStack { +@@ -182,6 +220,7 @@ public final class ItemStack { // 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 @@ -61,7 +61,7 @@ index b6f771ed5032cd18b1bcc086a937f66996a26057..a3d8d8ec0e99435a58ab93a7b1f90d16 this.getItem().b(this.tag); // CraftBukkit end } -@@ -611,6 +650,7 @@ public final class ItemStack { +@@ -665,6 +704,7 @@ public final class ItemStack { } } diff --git a/Spigot-Server-Patches/0523-Spawn-player-in-correct-world-on-login.patch b/Spigot-Server-Patches/0523-Spawn-player-in-correct-world-on-login.patch index b7b02c20f7..5b7514dda2 100644 --- a/Spigot-Server-Patches/0523-Spawn-player-in-correct-world-on-login.patch +++ b/Spigot-Server-Patches/0523-Spawn-player-in-correct-world-on-login.patch @@ -4,11 +4,11 @@ Date: Fri, 3 Jul 2020 14:57:05 -0400 Subject: [PATCH] Spawn player in correct world on login -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6d6fb9012b67e1c93c0141eb59bdcfdf65de71db..a6ad5daf4118ed45301ed6098d53a94c5690c304 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -116,7 +116,18 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index ead0079e3d6f338c34f8589067c4d1bf0be2b83f..acaa3060aadf4f08f290b6de4ef80bb4905e6a4a 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -189,7 +189,18 @@ public abstract class PlayerList { }String lastKnownName = s; // Paper // CraftBukkit end diff --git a/Spigot-Server-Patches/0524-Add-PrepareResultEvent.patch b/Spigot-Server-Patches/0524-Add-PrepareResultEvent.patch index d3621cf5ec..8aec73fcee 100644 --- a/Spigot-Server-Patches/0524-Add-PrepareResultEvent.patch +++ b/Spigot-Server-Patches/0524-Add-PrepareResultEvent.patch @@ -7,11 +7,11 @@ Adds a new event for all crafting stations that generate a result slot item Anvil, Grindstone and Smithing now extend this event -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 1045bd6eaa977b0142b4496c3f872ffae767a0f1..73a057b074af938a03decb0a53784aff321411ab 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java -@@ -126,6 +126,7 @@ public abstract class Container { +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java +index e9733fd9dac89d31dbad391cb22a8c84216045db..e7c29d194d5c3e3b1b79228758f7a3d8aa060fbd 100644 +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java +@@ -142,6 +142,7 @@ public abstract class Container { return nonnulllist; } @@ -19,11 +19,11 @@ index 1045bd6eaa977b0142b4496c3f872ffae767a0f1..73a057b074af938a03decb0a53784aff public void c() { int i; -diff --git a/src/main/java/net/minecraft/server/ContainerAnvil.java b/src/main/java/net/minecraft/server/ContainerAnvil.java -index 24631b2bcb2a1d057c1fb6596ff401133c8b548a..fc2038df89f25c07f6f853f6df41fe9b203c3585 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvil.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvil.java -@@ -294,6 +294,7 @@ public class ContainerAnvil extends ContainerAnvilAbstract { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java +index ff618bbb3fc4acfce51f5e5e6a504a63e9ad77cd..ae5674ae9c539720a657838a640050cd3b4dc5b5 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvil.java +@@ -307,6 +307,7 @@ public class ContainerAnvil extends ContainerAnvilAbstract { } this.e(); @@ -31,11 +31,11 @@ index 24631b2bcb2a1d057c1fb6596ff401133c8b548a..fc2038df89f25c07f6f853f6df41fe9b } // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java b/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java -index 70f9c189cb92656ba07ef7c60cfff646c2980b9e..1b7724422fc5d6a99fe60837d1f48585775a933a 100644 ---- a/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java -+++ b/src/main/java/net/minecraft/server/ContainerAnvilAbstract.java -@@ -65,6 +65,7 @@ public abstract class ContainerAnvilAbstract extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java b/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java +index 949042d4e4a1a63c0477704265fe32c371543e8c..9d47f2253a8adbcecbbe3d8a0a42e62f1dac1408 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerAnvilAbstract.java +@@ -71,6 +71,7 @@ public abstract class ContainerAnvilAbstract extends Container { super.a(iinventory); if (iinventory == this.repairInventory) { this.e(); @@ -43,11 +43,11 @@ index 70f9c189cb92656ba07ef7c60cfff646c2980b9e..1b7724422fc5d6a99fe60837d1f48585 } } -diff --git a/src/main/java/net/minecraft/server/ContainerCartography.java b/src/main/java/net/minecraft/server/ContainerCartography.java -index b829a481394167593ccf7521770802531b9ed483..0dd8623591827cd29fdf7916bf9a4b182816f28a 100644 ---- a/src/main/java/net/minecraft/server/ContainerCartography.java -+++ b/src/main/java/net/minecraft/server/ContainerCartography.java -@@ -135,6 +135,7 @@ public class ContainerCartography extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerCartography.java b/src/main/java/net/minecraft/world/inventory/ContainerCartography.java +index ce3c22d6f05703874eedf634331ea92ef4c039bf..031e75dc1f3dd6fc1cee684e8e7a105b3e402127 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerCartography.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerCartography.java +@@ -148,6 +148,7 @@ public class ContainerCartography extends Container { this.a(itemstack, itemstack1, itemstack2); } @@ -55,11 +55,11 @@ index b829a481394167593ccf7521770802531b9ed483..0dd8623591827cd29fdf7916bf9a4b18 } private void a(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2) { -diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java -index b69adda272f6bfb7f1570c282a16b343c9a552e2..57b3c42b6b3fcf791591897fa12d12c2c396191c 100644 ---- a/src/main/java/net/minecraft/server/ContainerGrindstone.java -+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java -@@ -145,6 +145,7 @@ public class ContainerGrindstone extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +index fad7355a549aef811bca43be198af3d1c0a53980..1d5dcbbd3870eb8e1013a97f6ce882bfc096bf95 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +@@ -157,6 +157,7 @@ public class ContainerGrindstone extends Container { super.a(iinventory); if (iinventory == this.craftInventory) { this.e(); @@ -67,11 +67,11 @@ index b69adda272f6bfb7f1570c282a16b343c9a552e2..57b3c42b6b3fcf791591897fa12d12c2 } } -diff --git a/src/main/java/net/minecraft/server/ContainerLoom.java b/src/main/java/net/minecraft/server/ContainerLoom.java -index 9490f74ee426e162844432073b3d78a2b6cddb32..1fe21ca13a1eecb64cb2d3f4f18993e181d26ae2 100644 ---- a/src/main/java/net/minecraft/server/ContainerLoom.java -+++ b/src/main/java/net/minecraft/server/ContainerLoom.java -@@ -174,7 +174,8 @@ public class ContainerLoom extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java +index 350a9b6525a95a00e72e836f1cc9e1a6b99fdd7a..7980930cc712e37a788f894bf2d2ee2b1cfc1196 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java +@@ -190,7 +190,8 @@ public class ContainerLoom extends Container { } this.j(); @@ -81,11 +81,11 @@ index 9490f74ee426e162844432073b3d78a2b6cddb32..1fe21ca13a1eecb64cb2d3f4f18993e1 } @Override -diff --git a/src/main/java/net/minecraft/server/ContainerSmithing.java b/src/main/java/net/minecraft/server/ContainerSmithing.java -index a6bfc4a49ea0a789cea3706fdd6673837a4b0829..61ef3adcfb021e222042de62ad06a2e7d808f5b5 100644 ---- a/src/main/java/net/minecraft/server/ContainerSmithing.java -+++ b/src/main/java/net/minecraft/server/ContainerSmithing.java -@@ -68,6 +68,7 @@ public class ContainerSmithing extends ContainerAnvilAbstract { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java b/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java +index 1fc73bba0be98721ceebfc1e6b8b50000751ecd2..b6be0763a0e345e78e1e6faeaad1bbede698131a 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerSmithing.java +@@ -77,6 +77,7 @@ public class ContainerSmithing extends ContainerAnvilAbstract { org.bukkit.craftbukkit.event.CraftEventFactory.callPrepareSmithingEvent(getBukkitView(), itemstack); // CraftBukkit } @@ -93,11 +93,11 @@ index a6bfc4a49ea0a789cea3706fdd6673837a4b0829..61ef3adcfb021e222042de62ad06a2e7 } @Override -diff --git a/src/main/java/net/minecraft/server/ContainerStonecutter.java b/src/main/java/net/minecraft/server/ContainerStonecutter.java -index 1340520b773caec58d0730311626f2f99425ecfb..232a46021edcaa90d29dfa5e8b6857f4ab4a8eac 100644 ---- a/src/main/java/net/minecraft/server/ContainerStonecutter.java -+++ b/src/main/java/net/minecraft/server/ContainerStonecutter.java -@@ -143,6 +143,7 @@ public class ContainerStonecutter extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java +index cfcb2469569edd51bbb74ca8d7a35a1ec0ecb434..1589d9ca201d386d11d9fd57fa8ba6848bae215c 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java +@@ -156,6 +156,7 @@ public class ContainerStonecutter extends Container { this.a(iinventory, itemstack); } @@ -106,7 +106,7 @@ index 1340520b773caec58d0730311626f2f99425ecfb..232a46021edcaa90d29dfa5e8b6857f4 private void a(IInventory iinventory, ItemStack itemstack) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 57ade60b17472832f33286b7332ca273d835b138..e2dd012c646f25ef83a8b10896acc31611084df4 100644 +index 18fd2b60e0a6b8aeb753bf836e220b09c453b069..09e90303395eae93dc89fbe8cfe6a1357307bc92 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java @@ -1510,19 +1510,44 @@ public class CraftEventFactory { diff --git a/Spigot-Server-Patches/0525-Allow-delegation-to-vanilla-chunk-gen.patch b/Spigot-Server-Patches/0525-Allow-delegation-to-vanilla-chunk-gen.patch index b4939bde3b..93e032f20b 100644 --- a/Spigot-Server-Patches/0525-Allow-delegation-to-vanilla-chunk-gen.patch +++ b/Spigot-Server-Patches/0525-Allow-delegation-to-vanilla-chunk-gen.patch @@ -4,11 +4,11 @@ Date: Wed, 29 Apr 2020 02:10:32 +0200 Subject: [PATCH] Allow delegation to vanilla chunk gen -diff --git a/src/main/java/net/minecraft/server/ChunkConverter.java b/src/main/java/net/minecraft/server/ChunkConverter.java -index b51613040e4583ff056060b47b1f97a86ebcde51..5366314e5f889b5b8d7740bbd0f024d9b7b9d643 100644 ---- a/src/main/java/net/minecraft/server/ChunkConverter.java -+++ b/src/main/java/net/minecraft/server/ChunkConverter.java -@@ -17,7 +17,7 @@ import org.apache.logging.log4j.Logger; +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java b/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java +index 60ecd3a92af0f1968b10bb8babfb43147ef568d3..9077b70650d70dd294f53a1ef73e86e28ceaece9 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkConverter.java +@@ -36,7 +36,7 @@ import org.apache.logging.log4j.Logger; public class ChunkConverter { private static final Logger LOGGER = LogManager.getLogger(); @@ -17,7 +17,7 @@ index b51613040e4583ff056060b47b1f97a86ebcde51..5366314e5f889b5b8d7740bbd0f024d9 private static final EnumDirection8[] c = EnumDirection8.values(); private final EnumSet d; private final int[][] e; -@@ -303,7 +303,7 @@ public class ChunkConverter { +@@ -322,7 +322,7 @@ public class ChunkConverter { if ((Integer) iblockdata.get(BlockProperties.an) >= j) { generatoraccess.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockProperties.an, j), 18); if (i != 7) { @@ -27,7 +27,7 @@ index b51613040e4583ff056060b47b1f97a86ebcde51..5366314e5f889b5b8d7740bbd0f024d9 for (int l = 0; l < k; ++l) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 64a2ab7a33342c7a60f0bc14dd9256ba1ed62666..2535eb4af7f72e46f00c7b6d8c0991e725a01201 100644 +index d0c951878600a4227e558bc68d68098c59fb7b2b..f8d040ba6c8b3a1294a8ac8d55cbd09705d4be76 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2027,6 +2027,32 @@ public final class CraftServer implements Server { @@ -40,13 +40,13 @@ index 64a2ab7a33342c7a60f0bc14dd9256ba1ed62666..2535eb4af7f72e46f00c7b6d8c0991e7 + // get empty object + CraftChunkData data = (CraftChunkData) createChunkData(world); + // do bunch of vanilla shit -+ net.minecraft.server.WorldServer nmsWorld = ((CraftWorld) world).getHandle(); -+ net.minecraft.server.ProtoChunk protoChunk = new net.minecraft.server.ProtoChunk(new net.minecraft.server.ChunkCoordIntPair(x, z), net.minecraft.server.ChunkConverter.getEmptyConverter(), nmsWorld); -+ List list = new ArrayList<>(); ++ net.minecraft.server.level.WorldServer nmsWorld = ((CraftWorld) world).getHandle(); ++ net.minecraft.world.level.chunk.ProtoChunk protoChunk = new net.minecraft.world.level.chunk.ProtoChunk(new net.minecraft.world.level.ChunkCoordIntPair(x, z), net.minecraft.world.level.chunk.ChunkConverter.getEmptyConverter(), nmsWorld); ++ List list = new ArrayList<>(); + list.add(protoChunk); -+ net.minecraft.server.RegionLimitedWorldAccess genRegion = new net.minecraft.server.RegionLimitedWorldAccess(nmsWorld, list); ++ net.minecraft.server.level.RegionLimitedWorldAccess genRegion = new net.minecraft.server.level.RegionLimitedWorldAccess(nmsWorld, list); + // call vanilla generator, one feature after another. Order here is important! -+ net.minecraft.server.ChunkGenerator chunkGenerator = nmsWorld.getChunkProvider().chunkGenerator; ++ net.minecraft.world.level.chunk.ChunkGenerator chunkGenerator = nmsWorld.getChunkProvider().chunkGenerator; + if (chunkGenerator instanceof org.bukkit.craftbukkit.generator.CustomChunkGenerator) { + chunkGenerator = ((org.bukkit.craftbukkit.generator.CustomChunkGenerator) chunkGenerator).delegate; + } @@ -64,7 +64,7 @@ index 64a2ab7a33342c7a60f0bc14dd9256ba1ed62666..2535eb4af7f72e46f00c7b6d8c0991e7 public BossBar createBossBar(String title, BarColor color, BarStyle style, BarFlag... flags) { return new CraftBossBar(title, color, style, flags); diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index bb18740ebdf4a14ced9944efa82103b350b32ba5..948a59217cca0f8dfa9d3befb61e679a67bf29bc 100644 +index afca0038bb74ac53f07a25729a3c1542e244c6fd..d02281f954aac8d8b65f5d36ec70f0352e4c7cdd 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -19,7 +19,7 @@ import org.bukkit.material.MaterialData; @@ -90,15 +90,15 @@ index bb18740ebdf4a14ced9944efa82103b350b32ba5..948a59217cca0f8dfa9d3befb61e679a return tiles; } diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java -index 69429e267fbe3f7c31634f98e6fbbbd988d4451e..bd7985cf2dd932ffcca2be61ddba97ee3a8927d0 100644 +index 3e6d78a1fac2690ab7113f236a1442ae7ab6dd42..cbb241b420065e016e5bbc340d42c383d9da6478 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CustomChunkGenerator.java @@ -33,7 +33,7 @@ import org.bukkit.generator.ChunkGenerator.ChunkData; public class CustomChunkGenerator extends InternalChunkGenerator { -- private final net.minecraft.server.ChunkGenerator delegate; -+ public final net.minecraft.server.ChunkGenerator delegate; // Paper - public +- private final net.minecraft.world.level.chunk.ChunkGenerator delegate; ++ public final net.minecraft.world.level.chunk.ChunkGenerator delegate; // Paper - public private final ChunkGenerator generator; private final WorldServer world; private final Random random = new Random(); diff --git a/Spigot-Server-Patches/0526-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch b/Spigot-Server-Patches/0526-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch index 342ad42b46..ca08d71b30 100644 --- a/Spigot-Server-Patches/0526-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch +++ b/Spigot-Server-Patches/0526-Don-t-check-chunk-for-portal-on-world-gen-entity-add.patch @@ -4,11 +4,11 @@ Date: Sun, 5 Jul 2020 14:59:31 -0400 Subject: [PATCH] Don't check chunk for portal on world gen entity add -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 29baae49888f030d136e99c44a5a55494606e471..91c3d5adb98f0ba004db51ea51942655ba8852c0 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -2947,7 +2947,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index a0060264c3f31ab499d44d1055403af8eca07fff..f6f43ef74086bd963432a0f40e7e01b92387b437 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -3040,7 +3040,7 @@ public abstract class EntityLiving extends Entity { Entity entity = this.getVehicle(); super.stopRiding(suppressCancellation); // Paper - suppress diff --git a/Spigot-Server-Patches/0527-Optimize-NetworkManager-Exception-Handling.patch b/Spigot-Server-Patches/0527-Optimize-NetworkManager-Exception-Handling.patch index e0061a881a..ff8f67ddb0 100644 --- a/Spigot-Server-Patches/0527-Optimize-NetworkManager-Exception-Handling.patch +++ b/Spigot-Server-Patches/0527-Optimize-NetworkManager-Exception-Handling.patch @@ -4,11 +4,11 @@ Date: Sun, 5 Jul 2020 22:38:18 -0400 Subject: [PATCH] Optimize NetworkManager Exception Handling -diff --git a/src/main/java/net/minecraft/server/EnumProtocol.java b/src/main/java/net/minecraft/server/EnumProtocol.java -index 32f5470baa88c3dc80db1bb547e1c982ac90237d..64df649e8d209246cc836793160eb0a1506826f8 100644 ---- a/src/main/java/net/minecraft/server/EnumProtocol.java -+++ b/src/main/java/net/minecraft/server/EnumProtocol.java -@@ -129,6 +129,7 @@ public enum EnumProtocol { +diff --git a/src/main/java/net/minecraft/network/EnumProtocol.java b/src/main/java/net/minecraft/network/EnumProtocol.java +index 539084d087bc6bd38d333066d3f8238cf2b08900..2c26c28b07e86735de2b8e594cd83e9cba4f193b 100644 +--- a/src/main/java/net/minecraft/network/EnumProtocol.java ++++ b/src/main/java/net/minecraft/network/EnumProtocol.java +@@ -279,6 +279,7 @@ public enum EnumProtocol { @Nullable public Packet a(int i) { @@ -16,10 +16,10 @@ index 32f5470baa88c3dc80db1bb547e1c982ac90237d..64df649e8d209246cc836793160eb0a1 Supplier> supplier = (Supplier) this.b.get(i); return supplier != null ? (Packet) supplier.get() : null; -diff --git a/src/main/java/net/minecraft/server/PacketSplitter.java b/src/main/java/net/minecraft/server/PacketSplitter.java -index cdaa8be90d16b0e9e2f92a3e2ed120b856feab54..2aaa8770edfd8acc6861c23176e405863858b275 100644 ---- a/src/main/java/net/minecraft/server/PacketSplitter.java -+++ b/src/main/java/net/minecraft/server/PacketSplitter.java +diff --git a/src/main/java/net/minecraft/network/PacketSplitter.java b/src/main/java/net/minecraft/network/PacketSplitter.java +index 2c7de7ab6da2106394ec668cd7cb9be1f8dabeb3..e81bfd35b9a745eeb1457ceda5fda320654bd89a 100644 +--- a/src/main/java/net/minecraft/network/PacketSplitter.java ++++ b/src/main/java/net/minecraft/network/PacketSplitter.java @@ -9,11 +9,21 @@ import java.util.List; public class PacketSplitter extends ByteToMessageDecoder { @@ -43,11 +43,11 @@ index cdaa8be90d16b0e9e2f92a3e2ed120b856feab54..2aaa8770edfd8acc6861c23176e40586 for (int i = 0; i < abyte.length; ++i) { if (!bytebuf.isReadable()) { -diff --git a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -index eb3269e0ea3ce33d08e9eee3bca7cf434921e991..7ea293f38dedd6066601d94adbe175a31c502e1f 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -+++ b/src/main/java/net/minecraft/server/PlayerConnectionUtils.java -@@ -22,6 +22,21 @@ public class PlayerConnectionUtils { +diff --git a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java +index e47da20ab8ce4da34755e105bf55d8542fb50138..839fa47bea425edcd31bcbbef2535c1a5f118c71 100644 +--- a/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java ++++ b/src/main/java/net/minecraft/network/protocol/PlayerConnectionUtils.java +@@ -31,6 +31,21 @@ public class PlayerConnectionUtils { try (Timing ignored = timing.startTiming()) { // Paper - timings packet.a(t0); } // Paper - timings diff --git a/Spigot-Server-Patches/0528-Fix-Concurrency-issue-in-WeightedList.patch b/Spigot-Server-Patches/0528-Fix-Concurrency-issue-in-WeightedList.patch index 2714f9eaeb..9a961b6d30 100644 --- a/Spigot-Server-Patches/0528-Fix-Concurrency-issue-in-WeightedList.patch +++ b/Spigot-Server-Patches/0528-Fix-Concurrency-issue-in-WeightedList.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Fix Concurrency issue in WeightedList if multiple threads from worldgen sort at same time, it will crash. So make a copy of the list for sorting purposes. -diff --git a/src/main/java/net/minecraft/server/BehaviorGate.java b/src/main/java/net/minecraft/server/BehaviorGate.java -index 4a5b54b44958b7eddaf2cd7bd517647cca96fd62..46e910581210421c8699637431804dc2f43eb4a6 100644 ---- a/src/main/java/net/minecraft/server/BehaviorGate.java -+++ b/src/main/java/net/minecraft/server/BehaviorGate.java -@@ -12,7 +12,7 @@ public class BehaviorGate extends Behavior { +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java +index dc926f7e59fa350902d4a24aefc3df3eac7d75db..2d4345de154fb2d31f34695672ebdb4dac31b181 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/BehaviorGate.java +@@ -17,7 +17,7 @@ public class BehaviorGate extends Behavior { private final Set> b; private final BehaviorGate.Order c; private final BehaviorGate.Execution d; @@ -19,7 +19,7 @@ index 4a5b54b44958b7eddaf2cd7bd517647cca96fd62..46e910581210421c8699637431804dc2 public BehaviorGate(Map, MemoryStatus> map, Set> set, BehaviorGate.Order behaviorgate_order, BehaviorGate.Execution behaviorgate_execution, List, Integer>> list) { super(map); -@@ -60,10 +60,9 @@ public class BehaviorGate extends Behavior { +@@ -65,10 +65,9 @@ public class BehaviorGate extends Behavior { }).forEach((behavior) -> { behavior.g(worldserver, e0, i); }); @@ -31,7 +31,7 @@ index 4a5b54b44958b7eddaf2cd7bd517647cca96fd62..46e910581210421c8699637431804dc2 } @Override -@@ -110,7 +109,7 @@ public class BehaviorGate extends Behavior { +@@ -115,7 +114,7 @@ public class BehaviorGate extends Behavior { private final Consumer> c; @@ -40,10 +40,10 @@ index 4a5b54b44958b7eddaf2cd7bd517647cca96fd62..46e910581210421c8699637431804dc2 this.c = consumer; } -diff --git a/src/main/java/net/minecraft/server/WeightedList.java b/src/main/java/net/minecraft/server/WeightedList.java -index 73e5969b2a15f1639b6285286820e9f7871c7db8..5d9d58411f2fad9d5da703f964d269b4a7c2b205 100644 ---- a/src/main/java/net/minecraft/server/WeightedList.java -+++ b/src/main/java/net/minecraft/server/WeightedList.java +diff --git a/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java b/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java +index f6f8c68ff3642e28901094e8b501fcf8ec2cecd7..1ca9b0595ae9d914d23590ec0b0c2e857c39b250 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java ++++ b/src/main/java/net/minecraft/world/entity/ai/behavior/WeightedList.java @@ -6,7 +6,7 @@ import com.mojang.serialization.Codec; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; diff --git a/Spigot-Server-Patches/0529-Optimize-the-advancement-data-player-iteration-to-be.patch b/Spigot-Server-Patches/0529-Optimize-the-advancement-data-player-iteration-to-be.patch index 61640b9c4e..434cd1b5f5 100644 --- a/Spigot-Server-Patches/0529-Optimize-the-advancement-data-player-iteration-to-be.patch +++ b/Spigot-Server-Patches/0529-Optimize-the-advancement-data-player-iteration-to-be.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Optimize the advancement data player iteration to be O(N) diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index 57b9d13447a4f7804827c1bd41121c3069c696bd..d3387a4e16f81b820d40502d2c46ebb3db88f824 100644 +index 7d37626277823d5db05189c20bb1ebf91aa2a286..e1d3f7e63c731f9376900a86abe17282e9b55ded 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -439,6 +439,16 @@ public class AdvancementDataPlayer { +@@ -457,6 +457,16 @@ public class AdvancementDataPlayer { } private void e(Advancement advancement) { @@ -26,7 +26,7 @@ index 57b9d13447a4f7804827c1bd41121c3069c696bd..d3387a4e16f81b820d40502d2c46ebb3 boolean flag = this.f(advancement); boolean flag1 = this.h.contains(advancement); -@@ -454,15 +464,23 @@ public class AdvancementDataPlayer { +@@ -472,15 +482,23 @@ public class AdvancementDataPlayer { } if (flag != flag1 && advancement.b() != null) { diff --git a/Spigot-Server-Patches/0530-Fix-arrows-never-despawning-MC-125757.patch b/Spigot-Server-Patches/0530-Fix-arrows-never-despawning-MC-125757.patch index 27b610b975..38c97d91fd 100644 --- a/Spigot-Server-Patches/0530-Fix-arrows-never-despawning-MC-125757.patch +++ b/Spigot-Server-Patches/0530-Fix-arrows-never-despawning-MC-125757.patch @@ -8,11 +8,11 @@ state after the arrow has been alive for 200 ticks (10 seconds) instead of getting stuck in a never despawn state (bubble columns, etc). -diff --git a/src/main/java/net/minecraft/server/EntityArrow.java b/src/main/java/net/minecraft/server/EntityArrow.java -index 402684ee2a42eefc843df663a1f3af9a8a66a0bb..1e7f5957d879d1ba8cf2b29cf9397b8e204e4381 100644 ---- a/src/main/java/net/minecraft/server/EntityArrow.java -+++ b/src/main/java/net/minecraft/server/EntityArrow.java -@@ -133,6 +133,7 @@ public abstract class EntityArrow extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +index 4cd1ddec701252269de0ce8520ee492f1e1cbacb..2f8b3587f527620152609d5be342b328a7621e0f 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityArrow.java +@@ -171,6 +171,7 @@ public abstract class EntityArrow extends IProjectile { ++this.c; } else { @@ -20,7 +20,7 @@ index 402684ee2a42eefc843df663a1f3af9a8a66a0bb..1e7f5957d879d1ba8cf2b29cf9397b8e this.c = 0; Vec3D vec3d2 = this.getPositionVector(); -@@ -254,6 +255,7 @@ public abstract class EntityArrow extends IProjectile { +@@ -292,6 +293,7 @@ public abstract class EntityArrow extends IProjectile { } diff --git a/Spigot-Server-Patches/0531-Thread-Safe-Vanilla-Command-permission-checking.patch b/Spigot-Server-Patches/0531-Thread-Safe-Vanilla-Command-permission-checking.patch index 6ede8a920a..2786d49de2 100644 --- a/Spigot-Server-Patches/0531-Thread-Safe-Vanilla-Command-permission-checking.patch +++ b/Spigot-Server-Patches/0531-Thread-Safe-Vanilla-Command-permission-checking.patch @@ -9,7 +9,7 @@ to race conditions. Plus, .canUse we want to be safe for async anyways. diff --git a/src/main/java/com/mojang/brigadier/tree/CommandNode.java b/src/main/java/com/mojang/brigadier/tree/CommandNode.java -index 6976da79b20280fcd72dcfb8b48e2eb73257faf2..d9c47f3fc18266df3be1f564c01dfc3e26941380 100644 +index 7ef6c99d2235eed38197aa76bc9553d7efbe52a4..c0fac7369b111e65b896a15848ae22457e5e8914 100644 --- a/src/main/java/com/mojang/brigadier/tree/CommandNode.java +++ b/src/main/java/com/mojang/brigadier/tree/CommandNode.java @@ -75,10 +75,10 @@ public abstract class CommandNode implements Comparable> { @@ -25,11 +25,11 @@ index 6976da79b20280fcd72dcfb8b48e2eb73257faf2..d9c47f3fc18266df3be1f564c01dfc3e } } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/CommandListenerWrapper.java b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -index efe2391f1648f4f83e9b77fdc6d9d81653cf65b3..31543b38a7c46d93333c5f96fdb718b0a7a087b2 100644 ---- a/src/main/java/net/minecraft/server/CommandListenerWrapper.java -+++ b/src/main/java/net/minecraft/server/CommandListenerWrapper.java -@@ -34,7 +34,7 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys +diff --git a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java +index b5ee789c8dfb7f413ab60902ff3d2ef0cf8273cd..8402af32cc476d7f468842eb4f34c7521d72bcc8 100644 +--- a/src/main/java/net/minecraft/commands/CommandListenerWrapper.java ++++ b/src/main/java/net/minecraft/commands/CommandListenerWrapper.java +@@ -55,7 +55,7 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys private final ResultConsumer l; private final ArgumentAnchor.Anchor m; private final Vec2F n; @@ -38,7 +38,7 @@ index efe2391f1648f4f83e9b77fdc6d9d81653cf65b3..31543b38a7c46d93333c5f96fdb718b0 public CommandListenerWrapper(ICommandListener icommandlistener, Vec3D vec3d, Vec2F vec2f, WorldServer worldserver, int i, String s, IChatBaseComponent ichatbasecomponent, MinecraftServer minecraftserver, @Nullable Entity entity) { this(icommandlistener, vec3d, vec2f, worldserver, i, s, ichatbasecomponent, minecraftserver, entity, false, (commandcontext, flag, j) -> { -@@ -151,9 +151,11 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys +@@ -172,9 +172,11 @@ public class CommandListenerWrapper implements ICompletionProvider, com.destroys @Override public boolean hasPermission(int i) { // CraftBukkit start diff --git a/Spigot-Server-Patches/0532-Move-range-check-for-block-placing-up.patch b/Spigot-Server-Patches/0532-Move-range-check-for-block-placing-up.patch index 6f71e10cfe..35476db9fd 100644 --- a/Spigot-Server-Patches/0532-Move-range-check-for-block-placing-up.patch +++ b/Spigot-Server-Patches/0532-Move-range-check-for-block-placing-up.patch @@ -4,11 +4,11 @@ Date: Wed, 15 Jul 2020 19:34:11 -0700 Subject: [PATCH] Move range check for block placing up -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 61e6fc80fba8dbd0216ddcc25a5f287f7fad068d..01e18079989043c2c8c49ef1dba254122617261d 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1516,15 +1516,19 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 95f4d39f3c21933f440f8ee3e29fd8a533dfb4c1..e38e3b6f0efac9d7723706c2a03a1ce3e67a445f 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1660,15 +1660,19 @@ public class PlayerConnection implements PacketListenerPlayIn { BlockPosition blockposition = movingobjectpositionblock.getBlockPosition(); EnumDirection enumdirection = movingobjectpositionblock.getDirection(); diff --git a/Spigot-Server-Patches/0533-Fix-SPIGOT-5989.patch b/Spigot-Server-Patches/0533-Fix-SPIGOT-5989.patch index 295f65b976..639b0205ca 100644 --- a/Spigot-Server-Patches/0533-Fix-SPIGOT-5989.patch +++ b/Spigot-Server-Patches/0533-Fix-SPIGOT-5989.patch @@ -9,11 +9,11 @@ PlayerRespawnEvent, the anchor would still lose some charge. This fixes that by checking if the modified spawn location is still at a respawn anchor. -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 6c3d52cac1918b9f47cd70249f6f020d010ad8b8..faf82af08b00f74d3d835bd54b9c2864aa67ddd4 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -768,6 +768,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index acaa3060aadf4f08f290b6de4ef80bb4905e6a4a..3c122087ecf53c517df415464af2742168f988d0 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -843,6 +843,7 @@ public abstract class PlayerList { // Paper start boolean isBedSpawn = false; boolean isRespawn = false; @@ -21,7 +21,7 @@ index 6c3d52cac1918b9f47cd70249f6f020d010ad8b8..faf82af08b00f74d3d835bd54b9c2864 // Paper end // CraftBukkit start - fire PlayerRespawnEvent -@@ -778,7 +779,7 @@ public abstract class PlayerList { +@@ -853,7 +854,7 @@ public abstract class PlayerList { Optional optional; if (blockposition != null) { @@ -30,7 +30,7 @@ index 6c3d52cac1918b9f47cd70249f6f020d010ad8b8..faf82af08b00f74d3d835bd54b9c2864 } else { optional = Optional.empty(); } -@@ -821,7 +822,12 @@ public abstract class PlayerList { +@@ -896,7 +897,12 @@ public abstract class PlayerList { } // Spigot End @@ -44,7 +44,7 @@ index 6c3d52cac1918b9f47cd70249f6f020d010ad8b8..faf82af08b00f74d3d835bd54b9c2864 if (!flag) entityplayer.reset(); // SPIGOT-4785 isRespawn = true; // Paper } else { -@@ -859,8 +865,12 @@ public abstract class PlayerList { +@@ -934,8 +940,12 @@ public abstract class PlayerList { } // entityplayer1.syncInventory(); entityplayer1.setHealth(entityplayer1.getHealth()); diff --git a/Spigot-Server-Patches/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch b/Spigot-Server-Patches/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch index 22c95979c9..4330b194d5 100644 --- a/Spigot-Server-Patches/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch +++ b/Spigot-Server-Patches/0534-Fix-SPIGOT-5824-Bukkit-world-container-is-not-used.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5824 Bukkit world-container is not used diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index e79ed0b5702688aaa5a86dc5a511c32685c883d9..a2cfd23e537de64ca8af26853fdede59af64108d 100644 +index 949e374d1e3bdbe31b160ad5ab6c0153f16fb07e..9e453545c37750152debbf7a663b2ec55c54387f 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -92,11 +92,20 @@ public class Main { +@@ -131,11 +131,20 @@ public class Main { return; } diff --git a/Spigot-Server-Patches/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch b/Spigot-Server-Patches/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch index 9e12530490..7aba9efe37 100644 --- a/Spigot-Server-Patches/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch +++ b/Spigot-Server-Patches/0535-Fix-SPIGOT-5885-Unable-to-disable-advancements.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix SPIGOT-5885 Unable to disable advancements diff --git a/src/main/java/net/minecraft/server/Main.java b/src/main/java/net/minecraft/server/Main.java -index a2cfd23e537de64ca8af26853fdede59af64108d..1c6dbd29c8414b3e33aedcc50bee5b5d9ce134d1 100644 +index 9e453545c37750152debbf7a663b2ec55c54387f..4d8f976a2f9ba2b54c39978b83f7b3de55fc1979 100644 --- a/src/main/java/net/minecraft/server/Main.java +++ b/src/main/java/net/minecraft/server/Main.java -@@ -92,6 +92,7 @@ public class Main { +@@ -131,6 +131,7 @@ public class Main { return; } diff --git a/Spigot-Server-Patches/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch b/Spigot-Server-Patches/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch index e5620cb419..b7ef24fea8 100644 --- a/Spigot-Server-Patches/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch +++ b/Spigot-Server-Patches/0536-Fix-AdvancementDataPlayer-leak-due-from-quitting-ear.patch @@ -8,26 +8,11 @@ Move the criterion storage to the AdvancementDataPlayer object itself, so the criterion object stores no references - and thus needs no cleanup. -diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index d3387a4e16f81b820d40502d2c46ebb3db88f824..17789407b9e86896a963a305a13357286aa5f319 100644 ---- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -+++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -51,6 +51,10 @@ public class AdvancementDataPlayer { - private Advancement l; - private boolean m = true; - -+ // Paper start - fix advancement data player leakage -+ final Map> criterionData = Maps.newIdentityHashMap(); -+ // Paper end - fix advancement data player leakage -+ - public AdvancementDataPlayer(DataFixer datafixer, PlayerList playerlist, AdvancementDataWorld advancementdataworld, File file, EntityPlayer entityplayer) { - this.d = datafixer; - this.e = playerlist; -diff --git a/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java b/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java -index 2419c57f90f40516cb4b4cedcda2c7d58523c3bc..5fd81933f8ba30d165fb3fdf25aaf94917637539 100644 ---- a/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java -+++ b/src/main/java/net/minecraft/server/CriterionTriggerAbstract.java -@@ -12,25 +12,25 @@ import java.util.function.Predicate; +diff --git a/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java b/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java +index c2ee816af000f0c94782d704e6372cd93fd34bb3..c6388223daa26b200dc16cd562bcef19a5a59c8f 100644 +--- a/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java ++++ b/src/main/java/net/minecraft/advancements/critereon/CriterionTriggerAbstract.java +@@ -16,25 +16,25 @@ import net.minecraft.world.level.storage.loot.LootTableInfo; public abstract class CriterionTriggerAbstract implements CriterionTrigger { @@ -57,7 +42,7 @@ index 2419c57f90f40516cb4b4cedcda2c7d58523c3bc..5fd81933f8ba30d165fb3fdf25aaf949 } } -@@ -38,7 +38,7 @@ public abstract class CriterionTriggerAbstract predicate) { AdvancementDataPlayer advancementdataplayer = entityplayer.getAdvancementData(); @@ -75,7 +60,7 @@ index 2419c57f90f40516cb4b4cedcda2c7d58523c3bc..5fd81933f8ba30d165fb3fdf25aaf949 if (set != null && !set.isEmpty()) { LootTableInfo loottableinfo = CriterionConditionEntity.b(entityplayer, entityplayer); -@@ -63,7 +63,7 @@ public abstract class CriterionTriggerAbstract> criterionData = Maps.newIdentityHashMap(); ++ // Paper end - fix advancement data player leakage ++ + public AdvancementDataPlayer(DataFixer datafixer, PlayerList playerlist, AdvancementDataWorld advancementdataworld, File file, EntityPlayer entityplayer) { + this.d = datafixer; + this.e = playerlist; diff --git a/Spigot-Server-Patches/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch b/Spigot-Server-Patches/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch index bb14b81553..73d1a2f6fb 100644 --- a/Spigot-Server-Patches/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch +++ b/Spigot-Server-Patches/0537-Add-missing-strikeLighting-call-to-World-spigot-stri.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add missing strikeLighting call to diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 602f0aa24adb641933c026aaba7d3245df628bbc..ceed6ffdb0368e521b5d369d45da0ca83e61ad3b 100644 +index 0a9bdf5e2665aa379cd6c887c534189d8a197191..5f23438b0031d57c49a8c7a7ccbd0f87a2d76875 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2628,6 +2628,7 @@ public class CraftWorld implements World { +@@ -2626,6 +2626,7 @@ public class CraftWorld implements World { lightning.teleportAndSync( loc.getX(), loc.getY(), loc.getZ() ); lightning.isEffect = true; lightning.isSilent = isSilent; diff --git a/Spigot-Server-Patches/0538-Fix-some-rails-connecting-improperly.patch b/Spigot-Server-Patches/0538-Fix-some-rails-connecting-improperly.patch index f94ef9cece..9241cffb87 100644 --- a/Spigot-Server-Patches/0538-Fix-some-rails-connecting-improperly.patch +++ b/Spigot-Server-Patches/0538-Fix-some-rails-connecting-improperly.patch @@ -4,11 +4,11 @@ Date: Fri, 24 Jul 2020 15:56:05 -0700 Subject: [PATCH] Fix some rails connecting improperly -diff --git a/src/main/java/net/minecraft/server/BlockMinecartDetector.java b/src/main/java/net/minecraft/server/BlockMinecartDetector.java -index 9681e08edf34f17806819115336874b574b880bc..77fde30769860828b6f16eefb186962c140beaae 100644 ---- a/src/main/java/net/minecraft/server/BlockMinecartDetector.java -+++ b/src/main/java/net/minecraft/server/BlockMinecartDetector.java -@@ -51,6 +51,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java b/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java +index 61c4a57174237f5f77d841bb2274ace6297db8a4..27573a0334b06f4b6ada672057695d8f8a2bcfc4 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockMinecartDetector.java +@@ -71,6 +71,7 @@ public class BlockMinecartDetector extends BlockMinecartTrackAbstract { private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { if (this.canPlace(iblockdata, world, blockposition)) { @@ -16,11 +16,11 @@ index 9681e08edf34f17806819115336874b574b880bc..77fde30769860828b6f16eefb186962c boolean flag = (Boolean) iblockdata.get(BlockMinecartDetector.POWERED); boolean flag1 = false; List list = this.a(world, blockposition, EntityMinecartAbstract.class, (Predicate) null); -diff --git a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -index 5609eeec9a7991167b57b724fa3279d3e8bf6b94..0de3fa45487e996b79d1031c9ee4b0728cfe1bcf 100644 ---- a/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockMinecartTrackAbstract.java -@@ -46,6 +46,7 @@ public abstract class BlockMinecartTrackAbstract extends Block { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java +index f65a53347f26affd1ce8d79527a6486e6bf8fbdd..0545dd68ea1f0a27739fac1a358c7def849e6b6a 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockMinecartTrackAbstract.java +@@ -62,6 +62,7 @@ public abstract class BlockMinecartTrackAbstract extends Block { iblockdata = this.a(world, blockposition, iblockdata, true); if (this.c) { iblockdata.doPhysics(world, blockposition, this, blockposition, flag); @@ -28,11 +28,11 @@ index 5609eeec9a7991167b57b724fa3279d3e8bf6b94..0de3fa45487e996b79d1031c9ee4b072 } return iblockdata; -diff --git a/src/main/java/net/minecraft/server/MinecartTrackLogic.java b/src/main/java/net/minecraft/server/MinecartTrackLogic.java -index 10bc2165159514d484e73a3acd08ca5929be72f2..e0be3a425aae51e1aced8eb6d8a5e84fc9315e3a 100644 ---- a/src/main/java/net/minecraft/server/MinecartTrackLogic.java -+++ b/src/main/java/net/minecraft/server/MinecartTrackLogic.java -@@ -7,13 +7,19 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java b/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java +index 8a8e3af0290a9483ee59d5fab061a9a9f5613f0a..436cfcde89aa780bcd58150f6167a365d8d955bc 100644 +--- a/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java ++++ b/src/main/java/net/minecraft/world/level/block/MinecartTrackLogic.java +@@ -12,13 +12,19 @@ import net.minecraft.world.level.block.state.properties.BlockPropertyTrackPositi public class MinecartTrackLogic { @@ -55,7 +55,7 @@ index 10bc2165159514d484e73a3acd08ca5929be72f2..e0be3a425aae51e1aced8eb6d8a5e84f public MinecartTrackLogic(World world, BlockPosition blockposition, IBlockData iblockdata) { this.a = world; this.b = blockposition; -@@ -148,6 +154,11 @@ public class MinecartTrackLogic { +@@ -153,6 +159,11 @@ public class MinecartTrackLogic { } private void c(MinecartTrackLogic minecarttracklogic) { @@ -67,7 +67,7 @@ index 10bc2165159514d484e73a3acd08ca5929be72f2..e0be3a425aae51e1aced8eb6d8a5e84f this.f.add(minecarttracklogic.b); BlockPosition blockposition = this.b.north(); BlockPosition blockposition1 = this.b.south(); -@@ -342,11 +353,16 @@ public class MinecartTrackLogic { +@@ -347,11 +358,16 @@ public class MinecartTrackLogic { this.d = (IBlockData) this.d.set(this.c.d(), blockpropertytrackposition1); if (flag1 || this.a.getType(this.b) != this.d) { this.a.setTypeAndData(this.b, this.d, 3); @@ -85,7 +85,7 @@ index 10bc2165159514d484e73a3acd08ca5929be72f2..e0be3a425aae51e1aced8eb6d8a5e84f minecarttracklogic.d(); if (minecarttracklogic.b(this)) { minecarttracklogic.c(this); -@@ -359,6 +375,6 @@ public class MinecartTrackLogic { +@@ -364,6 +380,6 @@ public class MinecartTrackLogic { } public IBlockData c() { diff --git a/Spigot-Server-Patches/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch b/Spigot-Server-Patches/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch index 7cc6c0c256..f274992699 100644 --- a/Spigot-Server-Patches/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch +++ b/Spigot-Server-Patches/0539-Optimize-Pathfinder-Remove-Streams-Optimized-collect.patch @@ -15,11 +15,11 @@ Optimize collection by creating a list instead of a set of the key and value. This lets us get faster foreach iteration, as well as avoids map lookups on the values when needed. -diff --git a/src/main/java/net/minecraft/server/Pathfinder.java b/src/main/java/net/minecraft/server/Pathfinder.java -index b31d1f73ce0f067e352868b53eab7557c34b17eb..997982136cdd2a0d922e501473e0d4d1aabf567a 100644 ---- a/src/main/java/net/minecraft/server/Pathfinder.java -+++ b/src/main/java/net/minecraft/server/Pathfinder.java -@@ -30,9 +30,12 @@ public class Pathfinder { +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java +index 5784be69098805e4d550a0923ac8daa5aada73f9..76e19f3a4ae988f6f3b59763d639fa5e084fa0bf 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/Pathfinder.java +@@ -33,9 +33,12 @@ public class Pathfinder { this.d.a(); this.c.a(chunkcache, entityinsentient); PathPoint pathpoint = this.c.b(); @@ -35,7 +35,7 @@ index b31d1f73ce0f067e352868b53eab7557c34b17eb..997982136cdd2a0d922e501473e0d4d1 PathEntity pathentity = this.a(pathpoint, map, f, i, f1); this.c.a(); -@@ -40,17 +43,17 @@ public class Pathfinder { +@@ -43,17 +46,17 @@ public class Pathfinder { } @Nullable @@ -57,7 +57,7 @@ index b31d1f73ce0f067e352868b53eab7557c34b17eb..997982136cdd2a0d922e501473e0d4d1 int k = (int) ((float) this.b * f1); while (!this.d.e()) { -@@ -62,14 +65,15 @@ public class Pathfinder { +@@ -65,14 +68,15 @@ public class Pathfinder { PathPoint pathpoint1 = this.d.c(); pathpoint1.i = true; @@ -78,7 +78,7 @@ index b31d1f73ce0f067e352868b53eab7557c34b17eb..997982136cdd2a0d922e501473e0d4d1 } } -@@ -90,7 +94,7 @@ public class Pathfinder { +@@ -93,7 +97,7 @@ public class Pathfinder { if (pathpoint2.j < f && (!pathpoint2.c() || f3 < pathpoint2.e)) { pathpoint2.h = pathpoint1; pathpoint2.e = f3; @@ -87,7 +87,7 @@ index b31d1f73ce0f067e352868b53eab7557c34b17eb..997982136cdd2a0d922e501473e0d4d1 if (pathpoint2.c()) { this.d.a(pathpoint2, pathpoint2.e + pathpoint2.f); } else { -@@ -102,28 +106,29 @@ public class Pathfinder { +@@ -105,28 +109,29 @@ public class Pathfinder { } } diff --git a/Spigot-Server-Patches/0540-Incremental-player-saving.patch b/Spigot-Server-Patches/0540-Incremental-player-saving.patch index 62aa09b869..43ff7c07a7 100644 --- a/Spigot-Server-Patches/0540-Incremental-player-saving.patch +++ b/Spigot-Server-Patches/0540-Incremental-player-saving.patch @@ -24,23 +24,11 @@ index b67ba8f75e4a3358d7c2462918b85b0bf9b5a922..fdbd8b89bb8bf3b61f60b812b90483c9 + } + } } -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index a7f39878829f1c901934fb2d8b53d906295112e9..8436b7be989bf08c8ec1f0d646b20e777a0ebd55 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -45,6 +45,7 @@ import org.bukkit.inventory.MainHand; - public class EntityPlayer extends EntityHuman implements ICrafting { - - private static final Logger LOGGER = LogManager.getLogger(); -+ public long lastSave = MinecraftServer.currentTick; // Paper - public PlayerConnection playerConnection; - public NetworkManager networkManager; // Paper - public final MinecraftServer server; diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index cfe770b7b77bb08407b164b932b898dfbe869b28..641c31597cad47c4950d5453e85ce692ab13d2fd 100644 +index 31a083730536177c5ff5ae463ca0b9780968a5d8..1f7435c78b1b522ba76a43440cf3a4e62ae0e0ee 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1228,9 +1228,15 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0 && this.ticks % autosavePeriod == 0) { // CraftBukkit // Paper - move down //MinecraftServer.LOGGER.debug("Autosave started"); // Paper serverAutoSave = (autosavePeriod > 0 && this.ticks % autosavePeriod == 0); // Paper @@ -58,11 +46,23 @@ index cfe770b7b77bb08407b164b932b898dfbe869b28..641c31597cad47c4950d5453e85ce692 }// Paper // Paper start for (WorldServer world : getWorlds()) { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index faf82af08b00f74d3d835bd54b9c2864aa67ddd4..086ada9b6a1d590356919fda078c777bd95f9f44 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -480,6 +480,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 9c30a74dae5df5a187b3384e36cdabc227edd1b9..8e75c55460aba3885f52f7b0dc6e320101d402ba 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -172,6 +172,7 @@ import org.bukkit.inventory.MainHand; + public class EntityPlayer extends EntityHuman implements ICrafting { + + private static final Logger LOGGER = LogManager.getLogger(); ++ public long lastSave = MinecraftServer.currentTick; // Paper + public PlayerConnection playerConnection; + public NetworkManager networkManager; // Paper + public final MinecraftServer server; +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 3c122087ecf53c517df415464af2742168f988d0..9349997bb63be6ffca4993f378fb4d20e98d65ba 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -555,6 +555,7 @@ public abstract class PlayerList { protected void savePlayerFile(EntityPlayer entityplayer) { if (!entityplayer.getBukkitEntity().isPersistent()) return; // CraftBukkit if (!entityplayer.didPlayerJoinEvent) return; // Paper - If we never fired PJE, we disconnected during login. Data has not changed, and additionally, our saved vehicle is not loaded! If we save now, we will lose our vehicle (CraftBukkit bug) @@ -70,7 +70,7 @@ index faf82af08b00f74d3d835bd54b9c2864aa67ddd4..086ada9b6a1d590356919fda078c777b this.playerFileData.save(entityplayer); ServerStatisticManager serverstatisticmanager = (ServerStatisticManager) entityplayer.getStatisticManager(); // CraftBukkit -@@ -1139,10 +1140,21 @@ public abstract class PlayerList { +@@ -1214,10 +1215,21 @@ public abstract class PlayerList { } public void savePlayers() { diff --git a/Spigot-Server-Patches/0541-Import-fastutil-classes.patch b/Spigot-Server-Patches/0541-Import-fastutil-classes.patch index 78a19c3ace..a367d82509 100644 --- a/Spigot-Server-Patches/0541-Import-fastutil-classes.patch +++ b/Spigot-Server-Patches/0541-Import-fastutil-classes.patch @@ -4,19 +4,19 @@ Date: Wed, 12 Aug 2020 11:33:04 +0200 Subject: [PATCH] Import fastutil classes -diff --git a/src/main/java/net/minecraft/server/DataWatcher.java b/src/main/java/net/minecraft/server/DataWatcher.java -index be8e705fc3f2c31e4f84f59c977488d8ecd9cae1..e69093b411f76ea4090789576f8fb6635bd02ca5 100644 ---- a/src/main/java/net/minecraft/server/DataWatcher.java -+++ b/src/main/java/net/minecraft/server/DataWatcher.java -@@ -12,6 +12,7 @@ import java.util.Map; - import java.util.concurrent.locks.ReadWriteLock; - import java.util.concurrent.locks.ReentrantReadWriteLock; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/network/syncher/DataWatcher.java b/src/main/java/net/minecraft/network/syncher/DataWatcher.java +index 3cdae5409989ea4bad8311b0083517b7815caae1..bb09b7be91b488ebc336b2b6f5deafc0ccab27a4 100644 +--- a/src/main/java/net/minecraft/network/syncher/DataWatcher.java ++++ b/src/main/java/net/minecraft/network/syncher/DataWatcher.java +@@ -17,6 +17,7 @@ import net.minecraft.CrashReportSystemDetails; + import net.minecraft.ReportedException; + import net.minecraft.network.PacketDataSerializer; + import net.minecraft.world.entity.Entity; +import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; // Paper import org.apache.commons.lang3.ObjectUtils; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -21,7 +22,7 @@ public class DataWatcher { +@@ -26,7 +27,7 @@ public class DataWatcher { private static final Logger LOGGER = LogManager.getLogger(); private static final Map, Integer> b = Maps.newHashMap(); private final Entity entity; diff --git a/Spigot-Server-Patches/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch b/Spigot-Server-Patches/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch index 39d5b13619..9a6e701328 100644 --- a/Spigot-Server-Patches/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch +++ b/Spigot-Server-Patches/0542-Don-t-mark-null-chunk-sections-for-block-updates.patch @@ -4,11 +4,11 @@ Date: Fri, 14 Aug 2020 23:41:19 +0200 Subject: [PATCH] Don't mark null chunk sections for block updates -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index afea606641c27e2ea8769455833b96e3f012e78e..b374ea7d4a1a2ed3149a2c945e009d5558e1ab4c 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -424,6 +424,7 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index b19c3bdbf64dc44f01487a3d17236a03a95708b5..dbd3d021f42ca45edbb061ce29746bc84331a0ad 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -449,6 +449,7 @@ public class PlayerChunk { this.a(world, blockposition, iblockdata); } else { ChunkSection chunksection = chunk.getSections()[sectionposition.getY()]; diff --git a/Spigot-Server-Patches/0543-Remove-armour-stand-double-add-to-world.patch b/Spigot-Server-Patches/0543-Remove-armour-stand-double-add-to-world.patch index af664862c7..835c6e761b 100644 --- a/Spigot-Server-Patches/0543-Remove-armour-stand-double-add-to-world.patch +++ b/Spigot-Server-Patches/0543-Remove-armour-stand-double-add-to-world.patch @@ -4,11 +4,11 @@ Date: Fri, 14 Aug 2020 23:59:26 +0200 Subject: [PATCH] Remove armour stand double add to world -diff --git a/src/main/java/net/minecraft/server/ItemArmorStand.java b/src/main/java/net/minecraft/server/ItemArmorStand.java -index 73b92c8a715ce1e9bbbdde7e94a605df76979960..c9a5d3b583076cf8f2f32b12c142beb3f5e22dc0 100644 ---- a/src/main/java/net/minecraft/server/ItemArmorStand.java -+++ b/src/main/java/net/minecraft/server/ItemArmorStand.java -@@ -33,7 +33,7 @@ public class ItemArmorStand extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemArmorStand.java b/src/main/java/net/minecraft/world/item/ItemArmorStand.java +index dd0dc2a321f2f99cbf1060e47deec0f690d6b948..cd46df5485ebfd597ea72360a27872d46174ee19 100644 +--- a/src/main/java/net/minecraft/world/item/ItemArmorStand.java ++++ b/src/main/java/net/minecraft/world/item/ItemArmorStand.java +@@ -53,7 +53,7 @@ public class ItemArmorStand extends Item { return EnumInteractionResult.FAIL; } @@ -17,7 +17,7 @@ index 73b92c8a715ce1e9bbbdde7e94a605df76979960..c9a5d3b583076cf8f2f32b12c142beb3 float f = (float) MathHelper.d((MathHelper.g(itemactioncontext.h() - 180.0F) + 22.5F) / 45.0F) * 45.0F; entityarmorstand.setPositionRotation(entityarmorstand.locX(), entityarmorstand.locY(), entityarmorstand.locZ(), f, 0.0F); -@@ -43,7 +43,7 @@ public class ItemArmorStand extends Item { +@@ -63,7 +63,7 @@ public class ItemArmorStand extends Item { return EnumInteractionResult.FAIL; } // CraftBukkit end diff --git a/Spigot-Server-Patches/0544-Fix-MC-187716-Use-configured-height.patch b/Spigot-Server-Patches/0544-Fix-MC-187716-Use-configured-height.patch index cad3812f33..ba23e86875 100644 --- a/Spigot-Server-Patches/0544-Fix-MC-187716-Use-configured-height.patch +++ b/Spigot-Server-Patches/0544-Fix-MC-187716-Use-configured-height.patch @@ -4,11 +4,11 @@ Date: Sat, 15 Aug 2020 08:04:49 -0500 Subject: [PATCH] Fix MC-187716 Use configured height -diff --git a/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java b/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java -index 6677740edb41901d6f8f92b6339e04b4e22cb6b6..dd3511d520cc385e4e89773e12d0e35aae8ecf3d 100644 ---- a/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java -+++ b/src/main/java/net/minecraft/server/WorldGenSurfaceNether.java -@@ -29,7 +29,7 @@ public class WorldGenSurfaceNether extends WorldGenSurface g = a(IRegistry.aw, () -> { return ProcessorLists.b; }); @@ -23,7 +23,7 @@ index 30db8342893e0af3028fbd8766642407cc109a5d..691f256427825a8e6b3eeaf317da2405 private static IRegistry a(ResourceKey> resourcekey, Supplier supplier) { return a(resourcekey, Lifecycle.stable(), supplier); -@@ -46,9 +46,9 @@ public class RegistryGeneration { +@@ -66,9 +66,9 @@ public class RegistryGeneration { MinecraftKey minecraftkey = resourcekey.a(); RegistryGeneration.k.put(minecraftkey, supplier); @@ -35,7 +35,7 @@ index 30db8342893e0af3028fbd8766642407cc109a5d..691f256427825a8e6b3eeaf317da2405 } public static T a(IRegistry iregistry, String s, T t0) { -@@ -56,11 +56,11 @@ public class RegistryGeneration { +@@ -76,11 +76,11 @@ public class RegistryGeneration { } public static T a(IRegistry iregistry, MinecraftKey minecraftkey, T t0) { diff --git a/Spigot-Server-Patches/0551-Add-setMaxPlayers-API.patch b/Spigot-Server-Patches/0551-Add-setMaxPlayers-API.patch index 5184700995..2d9c2e6a83 100644 --- a/Spigot-Server-Patches/0551-Add-setMaxPlayers-API.patch +++ b/Spigot-Server-Patches/0551-Add-setMaxPlayers-API.patch @@ -4,11 +4,11 @@ Date: Sat, 22 Aug 2020 23:59:30 +0200 Subject: [PATCH] Add #setMaxPlayers API -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 086ada9b6a1d590356919fda078c777bd95f9f44..f7b17c80480e7d4650fe7210936923c6c3f8b45c 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -64,7 +64,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 9349997bb63be6ffca4993f378fb4d20e98d65ba..8214bd759b306f86d44a53b2aa07dc053f72f282 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -137,7 +137,7 @@ public abstract class PlayerList { public final WorldNBTStorage playerFileData; private boolean hasWhitelist; private final IRegistryCustom.Dimension s; @@ -18,7 +18,7 @@ index 086ada9b6a1d590356919fda078c777bd95f9f44..f7b17c80480e7d4650fe7210936923c6 private EnumGamemode u; private boolean v; diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index 9d973152562bddd3546e875614361eaa8a468b22..f3e787d6cb46854c6e0dae7404dd56d34c9119be 100644 +index f8d040ba6c8b3a1294a8ac8d55cbd09705d4be76..1199644c6342379df21840aa144e731e9e9245ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -618,6 +618,13 @@ public final class CraftServer implements Server { diff --git a/Spigot-Server-Patches/0553-Don-t-require-FACING-data.patch b/Spigot-Server-Patches/0553-Don-t-require-FACING-data.patch index 65c8d69860..00f9b23e6f 100644 --- a/Spigot-Server-Patches/0553-Don-t-require-FACING-data.patch +++ b/Spigot-Server-Patches/0553-Don-t-require-FACING-data.patch @@ -4,11 +4,11 @@ Date: Sun, 23 Aug 2020 19:01:04 +0200 Subject: [PATCH] Don't require FACING data -diff --git a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java -index ca5eae350b971e93df708a29c426609423645430..40ac372281ba19cb776c14ffc957481367148f27 100644 ---- a/src/main/java/net/minecraft/server/DispenseBehaviorItem.java -+++ b/src/main/java/net/minecraft/server/DispenseBehaviorItem.java -@@ -7,20 +7,22 @@ import org.bukkit.event.block.BlockDispenseEvent; +diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java b/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java +index 979b862284ecd0dc504ee8a7018b27ff569b7b85..3d14ec72bb9babdf6b24aca3bde06d8b54815f9d 100644 +--- a/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java ++++ b/src/main/java/net/minecraft/core/dispenser/DispenseBehaviorItem.java +@@ -15,20 +15,22 @@ import org.bukkit.event.block.BlockDispenseEvent; // CraftBukkit end public class DispenseBehaviorItem implements IDispenseBehavior { diff --git a/Spigot-Server-Patches/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch b/Spigot-Server-Patches/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch index 98e61e0580..5b646d10ba 100644 --- a/Spigot-Server-Patches/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch +++ b/Spigot-Server-Patches/0554-Fix-SpawnChangeEvent-not-firing-for-all-use-cases.patch @@ -4,11 +4,11 @@ Date: Sat, 22 Aug 2020 23:36:21 +0200 Subject: [PATCH] Fix SpawnChangeEvent not firing for all use-cases -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index d2edfc8053a3db0a8e27f408bd467b193d8f9d9c..dbba898b226d72d3b88695d62c711256d7e3aee2 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1875,12 +1875,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 2181fbc31e96c74679185a49abbb3d7a2d5b6e9f..9f16a524b435c93edea0c8e2b4ebd5bbe63d34f8 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1984,12 +1984,14 @@ public class WorldServer extends World implements GeneratorAccessSeed { } // Paper end @@ -24,10 +24,10 @@ index d2edfc8053a3db0a8e27f408bd467b193d8f9d9c..dbba898b226d72d3b88695d62c711256 // if this keepSpawnInMemory is false a plugin has already removed our tickets, do not re-add this.removeTicketsForSpawn(this.paperConfig.keepLoadedRange, prevSpawn); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index ceed6ffdb0368e521b5d369d45da0ca83e61ad3b..12c6be2ac4a77428ba7bd3cff2cebea148006692 100644 +index 5f23438b0031d57c49a8c7a7ccbd0f87a2d76875..aea493db53d6a3c98f081ba72b1b03b7e2cdd8e5 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -389,11 +389,13 @@ public class CraftWorld implements World { +@@ -387,11 +387,13 @@ public class CraftWorld implements World { public boolean setSpawnLocation(int x, int y, int z, float angle) { try { Location previousLocation = getSpawnLocation(); diff --git a/Spigot-Server-Patches/0555-Add-moon-phase-API.patch b/Spigot-Server-Patches/0555-Add-moon-phase-API.patch index 5cee350e45..671f1533a0 100644 --- a/Spigot-Server-Patches/0555-Add-moon-phase-API.patch +++ b/Spigot-Server-Patches/0555-Add-moon-phase-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add moon phase API diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 12c6be2ac4a77428ba7bd3cff2cebea148006692..d7954f55061e677b00d27be4b8d0890af75a3aad 100644 +index aea493db53d6a3c98f081ba72b1b03b7e2cdd8e5..82d478cfa296be9c8d19e8dbd8d3485443108e40 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -328,6 +328,11 @@ public class CraftWorld implements World { +@@ -326,6 +326,11 @@ public class CraftWorld implements World { public int getPlayerCount() { return world.players.size(); } diff --git a/Spigot-Server-Patches/0556-Prevent-headless-pistons-from-being-created.patch b/Spigot-Server-Patches/0556-Prevent-headless-pistons-from-being-created.patch index ddedd1fd7e..8879901b52 100644 --- a/Spigot-Server-Patches/0556-Prevent-headless-pistons-from-being-created.patch +++ b/Spigot-Server-Patches/0556-Prevent-headless-pistons-from-being-created.patch @@ -22,11 +22,11 @@ index fdbd8b89bb8bf3b61f60b812b90483c98a3d5ccb..faa1b775e45563b93ac1d5b904938b1f public static int playerAutoSaveRate = -1; public static int maxPlayerAutoSavePerTick = 10; private static void playerAutoSaveRate() { -diff --git a/src/main/java/net/minecraft/server/Explosion.java b/src/main/java/net/minecraft/server/Explosion.java -index 72de544c0782e4daff222a0ca04e5bc870cf148c..5ca4d03215c979a4d122a32178a1859b4d9c3334 100644 ---- a/src/main/java/net/minecraft/server/Explosion.java -+++ b/src/main/java/net/minecraft/server/Explosion.java -@@ -135,6 +135,15 @@ public class Explosion { +diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java +index 0b3479aae8f7cad7bd0b8b64aa2dead43baf4c56..61ac9a68c864fdbb75137767eafdb96efdee640d 100644 +--- a/src/main/java/net/minecraft/world/level/Explosion.java ++++ b/src/main/java/net/minecraft/world/level/Explosion.java +@@ -163,6 +163,15 @@ public class Explosion { if (f > 0.0F && this.l.a(this, this.world, blockposition, iblockdata, f) && blockposition.getY() < 256 && blockposition.getY() >= 0) { // CraftBukkit - don't wrap explosions set.add(blockposition); @@ -42,11 +42,11 @@ index 72de544c0782e4daff222a0ca04e5bc870cf148c..5ca4d03215c979a4d122a32178a1859b } d4 += d0 * 0.30000001192092896D; -diff --git a/src/main/java/net/minecraft/server/TileEntityPiston.java b/src/main/java/net/minecraft/server/TileEntityPiston.java -index 7d86f0fe55063f6875db9c6f99f4f72ed4144536..b0d52d7405ca24938ca753897f89e6fad575d04d 100644 ---- a/src/main/java/net/minecraft/server/TileEntityPiston.java -+++ b/src/main/java/net/minecraft/server/TileEntityPiston.java -@@ -42,6 +42,8 @@ public class TileEntityPiston extends TileEntity implements ITickable { +diff --git a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +index e70c3a8c9075b6c0bc73e6488d784dfe3b86e58d..58c7a52612fe0f5c1e4ddacc0bf93cd81f1286b8 100644 +--- a/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java ++++ b/src/main/java/net/minecraft/world/level/block/piston/TileEntityPiston.java +@@ -65,6 +65,8 @@ public class TileEntityPiston extends TileEntity implements ITickable { return this.b; } diff --git a/Spigot-Server-Patches/0558-Add-BellRingEvent.patch b/Spigot-Server-Patches/0558-Add-BellRingEvent.patch index 11a361bebd..45e1a91e9f 100644 --- a/Spigot-Server-Patches/0558-Add-BellRingEvent.patch +++ b/Spigot-Server-Patches/0558-Add-BellRingEvent.patch @@ -6,19 +6,19 @@ Subject: [PATCH] Add BellRingEvent Add a new event, BellRingEvent, to trigger whenever a player rings a village bell. Passes along the bell block and the player who rang it. -diff --git a/src/main/java/net/minecraft/server/BlockBell.java b/src/main/java/net/minecraft/server/BlockBell.java -index 2ef899c761120a9fd6a9edcca23dea62d58688e6..25c72672eb2c5268d0dc13e29b30efbb9b519cd4 100644 ---- a/src/main/java/net/minecraft/server/BlockBell.java -+++ b/src/main/java/net/minecraft/server/BlockBell.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockBell.java b/src/main/java/net/minecraft/world/level/block/BlockBell.java +index 687f7acd8254294b568c9adf3e72d02d12551381..60beeeff73efc155029c5f214ead3f520f2c3bac 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockBell.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockBell.java @@ -1,5 +1,7 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import io.papermc.paper.event.block.BellRingEvent; + import javax.annotation.Nullable; - - public class BlockBell extends BlockTileEntity { -@@ -58,7 +60,7 @@ public class BlockBell extends BlockTileEntity { + import net.minecraft.core.BlockPosition; + import net.minecraft.core.EnumDirection; +@@ -89,7 +91,7 @@ public class BlockBell extends BlockTileEntity { boolean flag1 = !flag || this.a(iblockdata, enumdirection, movingobjectpositionblock.getPos().y - (double) blockposition.getY()); if (flag1) { @@ -27,7 +27,7 @@ index 2ef899c761120a9fd6a9edcca23dea62d58688e6..25c72672eb2c5268d0dc13e29b30efbb if (flag2 && entityhuman != null) { entityhuman.a(StatisticList.BELL_RING); -@@ -92,6 +94,11 @@ public class BlockBell extends BlockTileEntity { +@@ -123,6 +125,11 @@ public class BlockBell extends BlockTileEntity { } public boolean a(World world, BlockPosition blockposition, @Nullable EnumDirection enumdirection) { @@ -39,7 +39,7 @@ index 2ef899c761120a9fd6a9edcca23dea62d58688e6..25c72672eb2c5268d0dc13e29b30efbb TileEntity tileentity = world.getTileEntity(blockposition); if (!world.isClientSide && tileentity instanceof TileEntityBell) { -@@ -99,6 +106,7 @@ public class BlockBell extends BlockTileEntity { +@@ -130,6 +137,7 @@ public class BlockBell extends BlockTileEntity { enumdirection = (EnumDirection) world.getType(blockposition).get(BlockBell.a); } diff --git a/Spigot-Server-Patches/0559-Add-zombie-targets-turtle-egg-config.patch b/Spigot-Server-Patches/0559-Add-zombie-targets-turtle-egg-config.patch index feb1bd6db7..2d5c7f12aa 100644 --- a/Spigot-Server-Patches/0559-Add-zombie-targets-turtle-egg-config.patch +++ b/Spigot-Server-Patches/0559-Add-zombie-targets-turtle-egg-config.patch @@ -18,11 +18,11 @@ index 978062774c1db286bfb9b0ffdef19d880b1f249b..36ecdfce84141ac731b827e469ac842f + zombiesTargetTurtleEggs = getBoolean("zombies-target-turtle-eggs", zombiesTargetTurtleEggs); + } } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 555c74feb0d678d8f05d89e274f4736fc35ffebf..3e0b12fef4e0aa5bf8a9b905b829e2a305a53d12 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -45,7 +45,7 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index 3d8d4a43e6cd554b6f1eeafa1c8d43cef877139a..87acbdee03edf8bc35f4b3bcb9b82855ed4a3c33 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -107,7 +107,7 @@ public class EntityZombie extends EntityMonster { @Override protected void initPathfinder() { diff --git a/Spigot-Server-Patches/0560-Buffer-joins-to-world.patch b/Spigot-Server-Patches/0560-Buffer-joins-to-world.patch index 6393199676..adeb4f3f7f 100644 --- a/Spigot-Server-Patches/0560-Buffer-joins-to-world.patch +++ b/Spigot-Server-Patches/0560-Buffer-joins-to-world.patch @@ -21,11 +21,11 @@ index faa1b775e45563b93ac1d5b904938b1f5ad8d80c..545948f20efd6c8dd42140b565af94cd + maxJoinsPerTick = getInt("settings.max-joins-per-tick", 3); + } } -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index 06d8ad7f57aa629c3c6060545a45411343affc81..fc4ad72ffaed5e747cfecc71e9ac8ee2b556ce31 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -365,10 +365,22 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index 54a90c51f3090d0d2d6ea72b152829bc11d3ffbc..b865e759ff522051c20534fea726d8610b7694ca 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -375,10 +375,22 @@ public class NetworkManager extends SimpleChannelInboundHandler> { } // Paper end diff --git a/Spigot-Server-Patches/0561-Optimize-redstone-algorithm.patch b/Spigot-Server-Patches/0561-Optimize-redstone-algorithm.patch index f3f1f5c334..ca54b1f7fb 100644 --- a/Spigot-Server-Patches/0561-Optimize-redstone-algorithm.patch +++ b/Spigot-Server-Patches/0561-Optimize-redstone-algorithm.patch @@ -958,19 +958,39 @@ index 0000000000000000000000000000000000000000..b69803cbf2db2781aa050b145bf88468 + return i > strength ? i : strength; + } +} -diff --git a/src/main/java/net/minecraft/server/BlockRedstoneWire.java b/src/main/java/net/minecraft/server/BlockRedstoneWire.java -index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd484fd6cf79 100644 ---- a/src/main/java/net/minecraft/server/BlockRedstoneWire.java -+++ b/src/main/java/net/minecraft/server/BlockRedstoneWire.java +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index ada4a04506a32421bd4b9e661dfe87aa8a2b98bd..1aa9b47287b4b8e8516fcf3ead96c03a84e47b0f 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -651,6 +651,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + + } + ++ public void neighborChanged(BlockPosition pos, Block blockIn, BlockPosition fromPos) { a(pos, blockIn, fromPos); } // Paper - OBFHELPER + public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { + if (!this.isClientSide) { + IBlockData iblockdata = this.getType(blockposition); +@@ -1279,6 +1280,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); + } + ++ public int isBlockIndirectlyGettingPowered(BlockPosition pos) { return this.s(pos); } // Paper - OBFHELPER + public int s(BlockPosition blockposition) { + int i = 0; + EnumDirection[] aenumdirection = World.a; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java b/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java +index 60f0e582199472f9c5ef26e12ee1da0c3867254e..71ba55d36f5bc8a417930015c31553b30cf3e8dd 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockRedstoneWire.java @@ -1,5 +1,7 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import com.destroystokyo.paper.PaperConfig; +import com.destroystokyo.paper.util.RedstoneWireTurbo; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; import com.google.common.collect.Sets; -@@ -25,7 +27,7 @@ public class BlockRedstoneWire extends Block { +@@ -50,7 +52,7 @@ public class BlockRedstoneWire extends Block { private final Map j = Maps.newHashMap(); private static final Vector3fa[] k = new Vector3fa[16]; private final IBlockData o; @@ -979,7 +999,7 @@ index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd48 public BlockRedstoneWire(BlockBase.Info blockbase_info) { super(blockbase_info); -@@ -212,6 +214,121 @@ public class BlockRedstoneWire extends Block { +@@ -237,6 +239,121 @@ public class BlockRedstoneWire extends Block { return iblockdata.d(iblockaccess, blockposition, EnumDirection.UP) || iblockdata.a(Blocks.HOPPER); } @@ -1101,7 +1121,7 @@ index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd48 private void a(World world, BlockPosition blockposition, IBlockData iblockdata) { int i = this.a(world, blockposition); -@@ -281,6 +398,8 @@ public class BlockRedstoneWire extends Block { +@@ -306,6 +423,8 @@ public class BlockRedstoneWire extends Block { return Math.max(i, j - 1); } @@ -1110,7 +1130,7 @@ index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd48 private int o(IBlockData iblockdata) { return iblockdata.a((Block) this) ? (Integer) iblockdata.get(BlockRedstoneWire.POWER) : 0; } -@@ -303,7 +422,7 @@ public class BlockRedstoneWire extends Block { +@@ -328,7 +447,7 @@ public class BlockRedstoneWire extends Block { @Override public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { if (!iblockdata1.a(iblockdata.getBlock()) && !world.isClientSide) { @@ -1119,7 +1139,7 @@ index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd48 Iterator iterator = EnumDirection.EnumDirectionLimit.VERTICAL.iterator(); while (iterator.hasNext()) { -@@ -330,7 +449,7 @@ public class BlockRedstoneWire extends Block { +@@ -355,7 +474,7 @@ public class BlockRedstoneWire extends Block { world.applyPhysics(blockposition.shift(enumdirection), this); } @@ -1128,7 +1148,7 @@ index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd48 this.d(world, blockposition); } } -@@ -365,7 +484,7 @@ public class BlockRedstoneWire extends Block { +@@ -390,7 +509,7 @@ public class BlockRedstoneWire extends Block { public void doPhysics(IBlockData iblockdata, World world, BlockPosition blockposition, Block block, BlockPosition blockposition1, boolean flag) { if (!world.isClientSide) { if (iblockdata.canPlace(world, blockposition)) { @@ -1137,23 +1157,3 @@ index 7b3ccded0451f7b6634aeca0bdc1b5cc94f52b96..7f9ca45d403000d26d84198d8f88cd48 } else { c(iblockdata, world, blockposition); world.a(blockposition, false); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index f2944dcf6b83b530124d53743a3d58b68ecec6f8..b91f1a4623a7d2d49bdd4265df3b1cfcdcb0ef88 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -599,6 +599,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - - } - -+ public void neighborChanged(BlockPosition pos, Block blockIn, BlockPosition fromPos) { a(pos, blockIn, fromPos); } // Paper - OBFHELPER - public void a(BlockPosition blockposition, Block block, BlockPosition blockposition1) { - if (!this.isClientSide) { - IBlockData iblockdata = this.getType(blockposition); -@@ -1227,6 +1228,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return this.getBlockFacePower(blockposition.down(), EnumDirection.DOWN) > 0 ? true : (this.getBlockFacePower(blockposition.up(), EnumDirection.UP) > 0 ? true : (this.getBlockFacePower(blockposition.north(), EnumDirection.NORTH) > 0 ? true : (this.getBlockFacePower(blockposition.south(), EnumDirection.SOUTH) > 0 ? true : (this.getBlockFacePower(blockposition.west(), EnumDirection.WEST) > 0 ? true : this.getBlockFacePower(blockposition.east(), EnumDirection.EAST) > 0)))); - } - -+ public int isBlockIndirectlyGettingPowered(BlockPosition pos) { return this.s(pos); } // Paper - OBFHELPER - public int s(BlockPosition blockposition) { - int i = 0; - EnumDirection[] aenumdirection = World.a; diff --git a/Spigot-Server-Patches/0562-Fix-hex-colors-not-working-in-some-kick-messages.patch b/Spigot-Server-Patches/0562-Fix-hex-colors-not-working-in-some-kick-messages.patch index 90bbed9558..9685f44699 100644 --- a/Spigot-Server-Patches/0562-Fix-hex-colors-not-working-in-some-kick-messages.patch +++ b/Spigot-Server-Patches/0562-Fix-hex-colors-not-working-in-some-kick-messages.patch @@ -4,11 +4,11 @@ Date: Thu, 27 Aug 2020 16:57:25 -0400 Subject: [PATCH] Fix hex colors not working in some kick messages -diff --git a/src/main/java/net/minecraft/server/HandshakeListener.java b/src/main/java/net/minecraft/server/HandshakeListener.java -index a9337dc61d6370453a15ad284e44ad071e00572f..5843632fedafbd3e5cafd799cc779c39c9866c76 100644 ---- a/src/main/java/net/minecraft/server/HandshakeListener.java -+++ b/src/main/java/net/minecraft/server/HandshakeListener.java -@@ -35,7 +35,7 @@ public class HandshakeListener implements PacketHandshakingInListener { +diff --git a/src/main/java/net/minecraft/server/network/HandshakeListener.java b/src/main/java/net/minecraft/server/network/HandshakeListener.java +index 6d001843d8f899e91f19c384ddf57e6987bfb79e..b97d289afdff81d9959e238639f4e3e186f8e9c8 100644 +--- a/src/main/java/net/minecraft/server/network/HandshakeListener.java ++++ b/src/main/java/net/minecraft/server/network/HandshakeListener.java +@@ -46,7 +46,7 @@ public class HandshakeListener implements PacketHandshakingInListener { synchronized (throttleTracker) { if (throttleTracker.containsKey(address) && !"127.0.0.1".equals(address.getHostAddress()) && currentTime - throttleTracker.get(address) < connectionThrottle) { throttleTracker.put(address, currentTime); @@ -17,7 +17,7 @@ index a9337dc61d6370453a15ad284e44ad071e00572f..5843632fedafbd3e5cafd799cc779c39 this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage)); this.c.close(chatmessage); return; -@@ -61,12 +61,12 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -72,12 +72,12 @@ public class HandshakeListener implements PacketHandshakingInListener { } // CraftBukkit end if (packethandshakinginsetprotocol.c() != SharedConstants.getGameVersion().getProtocolVersion()) { @@ -33,7 +33,7 @@ index a9337dc61d6370453a15ad284e44ad071e00572f..5843632fedafbd3e5cafd799cc779c39 } this.c.sendPacket(new PacketLoginOutDisconnect(chatmessage)); -@@ -83,7 +83,7 @@ public class HandshakeListener implements PacketHandshakingInListener { +@@ -94,7 +94,7 @@ public class HandshakeListener implements PacketHandshakingInListener { if (event.callEvent()) { // If we've failed somehow, let the client know so and go no further. if (event.isFailed()) { @@ -42,11 +42,11 @@ index a9337dc61d6370453a15ad284e44ad071e00572f..5843632fedafbd3e5cafd799cc779c39 this.getNetworkManager().sendPacket(new PacketLoginOutDisconnect(chatmessage)); this.getNetworkManager().close(chatmessage); return; -diff --git a/src/main/java/net/minecraft/server/LoginListener.java b/src/main/java/net/minecraft/server/LoginListener.java -index bdd4766976902e11411728e6faa93b7e43a7ba22..6be12b7ae8501c22a7c544638c44fc6faedd5b07 100644 ---- a/src/main/java/net/minecraft/server/LoginListener.java -+++ b/src/main/java/net/minecraft/server/LoginListener.java -@@ -86,14 +86,7 @@ public class LoginListener implements PacketLoginInListener { +diff --git a/src/main/java/net/minecraft/server/network/LoginListener.java b/src/main/java/net/minecraft/server/network/LoginListener.java +index 6bfb703ffafd707fb83743abc7d1bfbb96f867f1..d3863d73e80fb1252ea39cfb4c8ed2c76d39c28d 100644 +--- a/src/main/java/net/minecraft/server/network/LoginListener.java ++++ b/src/main/java/net/minecraft/server/network/LoginListener.java +@@ -104,14 +104,7 @@ public class LoginListener implements PacketLoginInListener { // CraftBukkit start @Deprecated public void disconnect(String s) { diff --git a/Spigot-Server-Patches/0563-PortalCreateEvent-needs-to-know-its-entity.patch b/Spigot-Server-Patches/0563-PortalCreateEvent-needs-to-know-its-entity.patch index efafc39257..c74d6db2e0 100644 --- a/Spigot-Server-Patches/0563-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/Spigot-Server-Patches/0563-PortalCreateEvent-needs-to-know-its-entity.patch @@ -4,28 +4,24 @@ Date: Fri, 21 Aug 2020 20:57:54 +0200 Subject: [PATCH] PortalCreateEvent needs to know its entity -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index 1c06647fb6f8e757ca7a737a371cb1dec2aeb80e..868d942d83d57b07523f82252815ffd3593273bb 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -68,6 +68,12 @@ public abstract class BlockBase { - PacketDebug.a(world, blockposition); - } +diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java +index 8b5aaa18d278f20e32e25edddc2a10069c2ba5e6..81c7aed22bd63179e6016de801497d17d804e301 100644 +--- a/src/main/java/net/minecraft/world/item/ItemStack.java ++++ b/src/main/java/net/minecraft/world/item/ItemStack.java +@@ -367,7 +367,7 @@ public final class ItemStack { + IBlockData block = world.getType(newblockposition); -+ // Paper start - add ItemActionContext param -+ @Deprecated -+ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) { -+ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag); -+ } -+ // Paper end - @Deprecated - public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { - org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot -diff --git a/src/main/java/net/minecraft/server/BlockFire.java b/src/main/java/net/minecraft/server/BlockFire.java -index e5d75a8a93ffe7bc3747b48210eea6189a956d54..0e6ce21db67447d0eb84eb1633653decc172b2da 100644 ---- a/src/main/java/net/minecraft/server/BlockFire.java -+++ b/src/main/java/net/minecraft/server/BlockFire.java -@@ -343,8 +343,10 @@ public class BlockFire extends BlockFireAbstract { + if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically +- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true); ++ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext + } + + world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFire.java b/src/main/java/net/minecraft/world/level/block/BlockFire.java +index f940d93c5bceb4b130a40c1cde06ab8d2e82cd74..c695528d7e69fea5c168951583fea5841ddb80f1 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFire.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFire.java +@@ -363,8 +363,10 @@ public class BlockFire extends BlockFireAbstract { } @Override @@ -38,11 +34,11 @@ index e5d75a8a93ffe7bc3747b48210eea6189a956d54..0e6ce21db67447d0eb84eb1633653dec world.getBlockTickList().a(blockposition, this, a(world.random)); } -diff --git a/src/main/java/net/minecraft/server/BlockFireAbstract.java b/src/main/java/net/minecraft/server/BlockFireAbstract.java -index 7e95b150c4c87445ec221f1b9b7d2e7f7899688b..691346f69e5afd2eb96411c485ba8071d491d12a 100644 ---- a/src/main/java/net/minecraft/server/BlockFireAbstract.java -+++ b/src/main/java/net/minecraft/server/BlockFireAbstract.java -@@ -52,14 +52,17 @@ public abstract class BlockFireAbstract extends Block { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java +index b86513497b7ca8bde84176f5228ef9c479a73abb..2ddedcf3e56b8958671b81e6fe8768535951ee25 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFireAbstract.java +@@ -66,14 +66,17 @@ public abstract class BlockFireAbstract extends Block { super.a(iblockdata, world, blockposition, entity); } @@ -62,11 +58,28 @@ index 7e95b150c4c87445ec221f1b9b7d2e7f7899688b..691346f69e5afd2eb96411c485ba8071 return; } } -diff --git a/src/main/java/net/minecraft/server/BlockPortalShape.java b/src/main/java/net/minecraft/server/BlockPortalShape.java -index b7635ab1625c5b2540e44aafc2b908749820f7e2..6ef81aeb4c63bc6c23163796dbd977602ca2f540 100644 ---- a/src/main/java/net/minecraft/server/BlockPortalShape.java -+++ b/src/main/java/net/minecraft/server/BlockPortalShape.java -@@ -162,7 +162,10 @@ public class BlockPortalShape { +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index 1fcbb2e78904aa9f6ab870d7e2bc95ae25fbd33a..ffb5dc4fabb9249dfc1c8521025eaad0d6205329 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -119,6 +119,12 @@ public abstract class BlockBase { + PacketDebug.a(world, blockposition); + } + ++ // Paper start - add ItemActionContext param ++ @Deprecated ++ public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag, ItemActionContext itemActionContext) { ++ this.onPlace(iblockdata, world, blockposition, iblockdata1, flag); ++ } ++ // Paper end + @Deprecated + public void onPlace(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { + org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot +diff --git a/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java b/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java +index 9f7ff56e43a3dc0cc57ed3a2c6dbc729afafa1f8..1a5845a0da039fafca7ef08f968fe3b800e01991 100644 +--- a/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java ++++ b/src/main/java/net/minecraft/world/level/portal/BlockPortalShape.java +@@ -177,7 +177,10 @@ public class BlockPortalShape { } // CraftBukkit start - return boolean @@ -78,7 +91,7 @@ index b7635ab1625c5b2540e44aafc2b908749820f7e2..6ef81aeb4c63bc6c23163796dbd97760 org.bukkit.World bworld = this.b.getMinecraftWorld().getWorld(); // Copy below for loop -@@ -174,7 +177,7 @@ public class BlockPortalShape { +@@ -189,7 +192,7 @@ public class BlockPortalShape { blocks.add(state); }); @@ -87,16 +100,3 @@ index b7635ab1625c5b2540e44aafc2b908749820f7e2..6ef81aeb4c63bc6c23163796dbd97760 this.b.getMinecraftWorld().getMinecraftServer().server.getPluginManager().callEvent(event); if (event.isCancelled()) { -diff --git a/src/main/java/net/minecraft/server/ItemStack.java b/src/main/java/net/minecraft/server/ItemStack.java -index a3d8d8ec0e99435a58ab93a7b1f90d16be2a2289..afa1dc693bc2e2e68294a1d3dec1c078ea95b286 100644 ---- a/src/main/java/net/minecraft/server/ItemStack.java -+++ b/src/main/java/net/minecraft/server/ItemStack.java -@@ -313,7 +313,7 @@ public final class ItemStack { - IBlockData block = world.getType(newblockposition); - - if (!(block.getBlock() instanceof BlockTileEntity)) { // Containers get placed automatically -- block.getBlock().onPlace(block, world, newblockposition, oldBlock, true); -+ block.getBlock().onPlace(block, world, newblockposition, oldBlock, true, itemactioncontext); // Paper - pass itemactioncontext - } - - world.notifyAndUpdatePhysics(newblockposition, null, oldBlock, block, world.getType(newblockposition), updateFlag, 512); // send null chunk as chunk.k() returns false by this point diff --git a/Spigot-Server-Patches/0565-Add-more-Evoker-API.patch b/Spigot-Server-Patches/0565-Add-more-Evoker-API.patch index 9d89403425..2b3c0ab1e9 100644 --- a/Spigot-Server-Patches/0565-Add-more-Evoker-API.patch +++ b/Spigot-Server-Patches/0565-Add-more-Evoker-API.patch @@ -4,11 +4,11 @@ Date: Sun, 23 Aug 2020 15:28:35 +0200 Subject: [PATCH] Add more Evoker API -diff --git a/src/main/java/net/minecraft/server/EntityEvoker.java b/src/main/java/net/minecraft/server/EntityEvoker.java -index 757cae8d6de2ff90efa9402c24172b17b1ef266d..f40fbef32f2fc1f37f2065ad598f013766cf12f2 100644 ---- a/src/main/java/net/minecraft/server/EntityEvoker.java -+++ b/src/main/java/net/minecraft/server/EntityEvoker.java -@@ -5,7 +5,7 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java b/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java +index 64bfd84e8a5a0c2b1fec7044b688c7cc1083f18a..2aa6b6ca93c25c59ad224348aad1bb34d9bbc6a3 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityEvoker.java +@@ -40,7 +40,7 @@ import net.minecraft.world.phys.shapes.VoxelShape; public class EntityEvoker extends EntityIllagerWizard { @@ -17,7 +17,7 @@ index 757cae8d6de2ff90efa9402c24172b17b1ef266d..f40fbef32f2fc1f37f2065ad598f0137 public EntityEvoker(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -24,7 +24,7 @@ public class EntityEvoker extends EntityIllagerWizard { +@@ -59,7 +59,7 @@ public class EntityEvoker extends EntityIllagerWizard { this.goalSelector.a(8, new PathfinderGoalRandomStroll(this, 0.6D)); this.goalSelector.a(9, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 3.0F, 1.0F)); this.goalSelector.a(10, new PathfinderGoalLookAtPlayer(this, EntityInsentient.class, 8.0F)); @@ -27,7 +27,7 @@ index 757cae8d6de2ff90efa9402c24172b17b1ef266d..f40fbef32f2fc1f37f2065ad598f0137 this.targetSelector.a(3, (new PathfinderGoalNearestAttackableTarget<>(this, EntityVillagerAbstract.class, false)).a(300)); this.targetSelector.a(3, new PathfinderGoalNearestAttackableTarget<>(this, EntityIronGolem.class, false)); diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java -index 0636d264731f1f346360ffecb4271b5e561b8eaf..bc397f34f3d0819b9568322872e0238ef8fd22a7 100644 +index 5e8e9d95068342661a962aae9878a7eafaa06207..081e038b8e6ec4c08f29f46ed00b14694a8c47a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEvoker.java @@ -36,4 +36,17 @@ public class CraftEvoker extends CraftSpellcaster implements Evoker { diff --git a/Spigot-Server-Patches/0566-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch b/Spigot-Server-Patches/0566-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch index 919738e3ba..537c52b0d5 100644 --- a/Spigot-Server-Patches/0566-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch +++ b/Spigot-Server-Patches/0566-Add-a-way-to-get-translation-keys-for-blocks-entitie.patch @@ -5,23 +5,11 @@ Subject: [PATCH] Add a way to get translation keys for blocks, entities and materials -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 5b35100d9d44f0ae5d547fdad85de9e5ee73f5b5..431e362138f4e186b3f6092137f8f36e9615801f 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -279,6 +279,7 @@ public class Block extends BlockBase implements IMaterial { - return !this.material.isBuildable() && !this.material.isLiquid(); - } - -+ public String getDescriptionId() { return i(); } // Paper - OBFHELPER - public String i() { - if (this.name == null) { - this.name = SystemUtils.a("block", IRegistry.BLOCK.getKey(this)); -diff --git a/src/main/java/net/minecraft/server/EntityTypes.java b/src/main/java/net/minecraft/server/EntityTypes.java -index c49e7ec418eedac45182de67cb673839dc7e27c2..93b5a6471cde31739d2bd5f2a9fc0e0d974d0eb0 100644 ---- a/src/main/java/net/minecraft/server/EntityTypes.java -+++ b/src/main/java/net/minecraft/server/EntityTypes.java -@@ -147,6 +147,7 @@ public class EntityTypes { +diff --git a/src/main/java/net/minecraft/world/entity/EntityTypes.java b/src/main/java/net/minecraft/world/entity/EntityTypes.java +index 82f42f73b9696220be6d8003ec8c108a4ba3f082..f0cc46e07c462dfe733c3ce011292e5ec61cf392 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityTypes.java ++++ b/src/main/java/net/minecraft/world/entity/EntityTypes.java +@@ -277,6 +277,7 @@ public class EntityTypes { return IRegistry.ENTITY_TYPE.getKey(entitytypes); } @@ -29,7 +17,7 @@ index c49e7ec418eedac45182de67cb673839dc7e27c2..93b5a6471cde31739d2bd5f2a9fc0e0d public static Optional> a(String s) { return IRegistry.ENTITY_TYPE.getOptional(MinecraftKey.a(s)); } -@@ -300,6 +301,7 @@ public class EntityTypes { +@@ -430,6 +431,7 @@ public class EntityTypes { return this.bg; } @@ -37,11 +25,11 @@ index c49e7ec418eedac45182de67cb673839dc7e27c2..93b5a6471cde31739d2bd5f2a9fc0e0d public String f() { if (this.bo == null) { this.bo = SystemUtils.a("entity", IRegistry.ENTITY_TYPE.getKey(this)); -diff --git a/src/main/java/net/minecraft/server/Item.java b/src/main/java/net/minecraft/server/Item.java -index 5ae1542a04b6f89c36231dc340c7d4538c4dbdd4..c3b57e8d572d13ec74d6df5544072cdc55756690 100644 ---- a/src/main/java/net/minecraft/server/Item.java -+++ b/src/main/java/net/minecraft/server/Item.java -@@ -26,7 +26,7 @@ public class Item implements IMaterial { +diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java +index ca513e7b0a416860aba89e41de6a7c5ff42baa69..5d7c44a53fb98532057b09176677ce0d719b055b 100644 +--- a/src/main/java/net/minecraft/world/item/Item.java ++++ b/src/main/java/net/minecraft/world/item/Item.java +@@ -56,7 +56,7 @@ public class Item implements IMaterial { private final FoodInfo foodInfo; public static int getId(Item item) { @@ -50,7 +38,7 @@ index 5ae1542a04b6f89c36231dc340c7d4538c4dbdd4..c3b57e8d572d13ec74d6df5544072cdc } public static Item getById(int i) { -@@ -122,6 +122,7 @@ public class Item implements IMaterial { +@@ -152,6 +152,7 @@ public class Item implements IMaterial { return IRegistry.ITEM.getKey(this).getKey(); } @@ -58,8 +46,20 @@ index 5ae1542a04b6f89c36231dc340c7d4538c4dbdd4..c3b57e8d572d13ec74d6df5544072cdc protected String m() { if (this.name == null) { this.name = SystemUtils.a("item", IRegistry.ITEM.getKey(this)); +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index cc512bd2e89382e7fdbc59b41640e95ccafbbfe9..768934fa4158a9773d06f5b23bfb19db75f6d179 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -318,6 +318,7 @@ public class Block extends BlockBase implements IMaterial { + return !this.material.isBuildable() && !this.material.isLiquid(); + } + ++ public String getDescriptionId() { return i(); } // Paper - OBFHELPER + public String i() { + if (this.name == null) { + this.name = SystemUtils.a("block", IRegistry.BLOCK.getKey(this)); diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index f787238575ed7ac9108a2fd9782af55056219767..3524b677525bf2bb529b797fe1f258efb34ac3fc 100644 +index ffa94d23675c6c7b6b005860c99c730aacb94924..c0238ba202b9f6c215788671652c768948acf753 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -752,5 +752,10 @@ public class CraftBlock implements Block { @@ -74,7 +74,7 @@ index f787238575ed7ac9108a2fd9782af55056219767..3524b677525bf2bb529b797fe1f258ef // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index cb95d6f29ecedae0c901fe202fdd7c1d1c1bf4e1..6cc747445e07920bce1424238674ddc2b51e7905 100644 +index 51aa0c37df947a229eddaa3c4e3372f64575617e..6fbface979f6f9ed97bb39ca91a29bffe05fddda 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -45,6 +45,7 @@ import org.bukkit.Registry; @@ -105,7 +105,7 @@ index cb95d6f29ecedae0c901fe202fdd7c1d1c1bf4e1..6cc747445e07920bce1424238674ddc2 + + @Override + public String getTranslationKey(org.bukkit.entity.EntityType type) { -+ return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null); ++ return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null); + } + // Paper end diff --git a/Spigot-Server-Patches/0567-Create-HoverEvent-from-ItemStack-Entity.patch b/Spigot-Server-Patches/0567-Create-HoverEvent-from-ItemStack-Entity.patch index 04b657407a..d504fb12a8 100644 --- a/Spigot-Server-Patches/0567-Create-HoverEvent-from-ItemStack-Entity.patch +++ b/Spigot-Server-Patches/0567-Create-HoverEvent-from-ItemStack-Entity.patch @@ -5,12 +5,12 @@ Subject: [PATCH] Create HoverEvent from ItemStack Entity diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java -index bf8a8cad248583c900eacfaf54e30f0a60e1dc54..c79623339cfe8fb8484bcc2a8c3eb119b9e83093 100644 +index e6c818d32713d9fb0f02a46696bd8a5dabe2a3ae..6966b9d1ce674232d3f867798fa58bd0933ff69e 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemFactory.java @@ -360,5 +360,40 @@ public final class CraftItemFactory implements ItemFactory { - return nms != null ? net.minecraft.server.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; + return nms != null ? net.minecraft.locale.LocaleLanguage.getInstance().translateKey(nms.getItem().getName()) : null; } + + @Override diff --git a/Spigot-Server-Patches/0568-Cache-block-data-strings.patch b/Spigot-Server-Patches/0568-Cache-block-data-strings.patch index 7966da63c7..2a0fbedbaf 100644 --- a/Spigot-Server-Patches/0568-Cache-block-data-strings.patch +++ b/Spigot-Server-Patches/0568-Cache-block-data-strings.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Cache block data strings diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 641c31597cad47c4950d5453e85ce692ab13d2fd..b2940f0a9b6fba05defe3369b6d2561d054714fe 100644 +index 1f7435c78b1b522ba76a43440cf3a4e62ae0e0ee..27e7547a6414e84e170ca33bdb276a451f35cf46 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1834,6 +1834,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= level; } -@@ -1317,6 +1318,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -1402,6 +1403,13 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public void setPositionRotation(double d0, double d1, double d2, float f, float f1) { @@ -34,33 +56,11 @@ index 5c52a2988b8830e4e5597f8a5b3718d242023cb7..a7b225249f7ffafa2c6e1fc606570672 this.g(d0, d1, d2); this.yaw = f; this.pitch = f1; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 50fef192bec41070c5dd89ffbc131012efa3c279..25744e01cfca42e9094b2a215270e4617553d18a 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -546,7 +546,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - public void a(PacketPlayInTeleportAccept packetplayinteleportaccept) { - PlayerConnectionUtils.ensureMainThread(packetplayinteleportaccept, this, this.player.getWorldServer()); - if (packetplayinteleportaccept.b() == this.teleportAwait && this.teleportPos != null) { // CraftBukkit -- this.player.setLocation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); -+ this.player.setPositionRotation(this.teleportPos.x, this.teleportPos.y, this.teleportPos.z, this.player.yaw, this.player.pitch); // Paper - use proper setPositionRotation for teleportation - this.o = this.teleportPos.x; - this.p = this.teleportPos.y; - this.q = this.teleportPos.z; -@@ -1390,7 +1390,7 @@ public class PlayerConnection implements PacketListenerPlayIn { - // CraftBukkit end - - this.A = this.e; -- this.player.setLocation(d0, d1, d2, f, f1); -+ this.player.setPositionRotation(d0, d1, d2, f, f1); // Paper - use proper setPositionRotation for teleportation - this.player.forceCheckHighPriority(); // Paper - this.player.playerConnection.sendPacket(new PacketPlayOutPosition(d0 - d3, d1 - d4, d2 - d5, f - f2, f1 - f3, set, this.teleportAwait)); - } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index dc42bd1b2b89881789481d736a57011936857abf..c519b46c94792082c62acc05cdbec0734776edf5 100644 +index d76800778ccf05913ff887a566b3a2f11ec2d40b..e0ab4c96544483e43c7f5e5f5965f74a207437d5 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -555,7 +555,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -554,7 +554,7 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { } // entity.setLocation() throws no event, and so cannot be cancelled @@ -68,4 +68,4 @@ index dc42bd1b2b89881789481d736a57011936857abf..c519b46c94792082c62acc05cdbec073 + entity.setPositionRotation(location.getX(), location.getY(), location.getZ(), location.getYaw(), location.getPitch()); // Paper - use proper setPosition, as per vanilla teleporting // SPIGOT-619: Force sync head rotation also entity.setHeadRotation(location.getYaw()); - ((net.minecraft.server.WorldServer) entity.world).chunkCheck(entity); // Spigot - register to new chunk + ((net.minecraft.server.level.WorldServer) entity.world).chunkCheck(entity); // Spigot - register to new chunk diff --git a/Spigot-Server-Patches/0572-Extend-block-drop-capture-to-capture-all-items-added.patch b/Spigot-Server-Patches/0572-Extend-block-drop-capture-to-capture-all-items-added.patch index 970eba63e3..bb3233d5ff 100644 --- a/Spigot-Server-Patches/0572-Extend-block-drop-capture-to-capture-all-items-added.patch +++ b/Spigot-Server-Patches/0572-Extend-block-drop-capture-to-capture-all-items-added.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Extend block drop capture to capture all items added to the world -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 942b38aaf1845468852ac41e9fba230837f137e3..3bae1c39bf122cec88a481b18c01c3d32d6eb747 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -386,10 +386,12 @@ public class PlayerInteractManager { +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 8b6367d3bb4cbb007bf68d957a6c1f701f5643b6..86d1a7625bb3016093ee8a46f91fd657d8bc2546 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -416,10 +416,12 @@ public class PlayerInteractManager { // return true; // CraftBukkit } // CraftBukkit start @@ -24,11 +24,11 @@ index 942b38aaf1845468852ac41e9fba230837f137e3..3bae1c39bf122cec88a481b18c01c3d3 // Drop event experience if (flag && event != null) { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index dbba898b226d72d3b88695d62c711256d7e3aee2..493e3cd8a3dbc77f73dd1e026c9e580896995675 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1177,6 +1177,13 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 9f16a524b435c93edea0c8e2b4ebd5bbe63d34f8..ae2cb0139e71ff41cfac9346179f1037a4401fa1 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1286,6 +1286,13 @@ public class WorldServer extends World implements GeneratorAccessSeed { } else if (this.isUUIDTaken(entity)) { return false; } else { diff --git a/Spigot-Server-Patches/0573-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch b/Spigot-Server-Patches/0573-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch index 4a1db649f9..55e775a7cc 100644 --- a/Spigot-Server-Patches/0573-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch +++ b/Spigot-Server-Patches/0573-Don-t-mark-dirty-in-invalid-locations-SPIGOT-6086.patch @@ -4,11 +4,11 @@ Date: Sun, 27 Sep 2020 16:25:24 +0200 Subject: [PATCH] Don't mark dirty in invalid locations (SPIGOT-6086) -diff --git a/src/main/java/net/minecraft/server/PlayerChunk.java b/src/main/java/net/minecraft/server/PlayerChunk.java -index b374ea7d4a1a2ed3149a2c945e009d5558e1ab4c..904c6a7d0a36b57bb4f693fc4fd0dd5b17adcbac 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunk.java -+++ b/src/main/java/net/minecraft/server/PlayerChunk.java -@@ -363,6 +363,7 @@ public class PlayerChunk { +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunk.java b/src/main/java/net/minecraft/server/level/PlayerChunk.java +index dbd3d021f42ca45edbb061ce29746bc84331a0ad..45834045c3a40b20095d4990c91f6e112cff335c 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunk.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunk.java +@@ -388,6 +388,7 @@ public class PlayerChunk { } public void a(BlockPosition blockposition) { diff --git a/Spigot-Server-Patches/0574-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/Spigot-Server-Patches/0574-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 2ae7ce7a72..34475ea59b 100644 --- a/Spigot-Server-Patches/0574-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/Spigot-Server-Patches/0574-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and non-conflicting Entity Ids -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index a7b225249f7ffafa2c6e1fc60657067229e02960..fcb5cf78d1deff3c2593c7470f5501be8fed567b 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -3382,4 +3382,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index bfd1f4012b20f3e9eadbbdd0613239622776982d..646f06d5a7c67cc2bef83840bdfe3b102f1f3d5a 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -3467,4 +3467,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne void accept(Entity entity, double d0, double d1, double d2); } @@ -21,15 +21,15 @@ index a7b225249f7ffafa2c6e1fc60657067229e02960..fcb5cf78d1deff3c2593c7470f5501be + // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6cc747445e07920bce1424238674ddc2b51e7905..6be34896149366925edd9d7eb4630132533d60c2 100644 +index 6fbface979f6f9ed97bb39ca91a29bffe05fddda..25af57d0ab191f6a29ae95cec764667e9c23bdd4 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -420,6 +420,10 @@ public final class CraftMagicNumbers implements UnsafeValues { - return net.minecraft.server.EntityTypes.getByName(type.getName()).map(net.minecraft.server.EntityTypes::getDescriptionId).orElse(null); + return net.minecraft.world.entity.EntityTypes.getByName(type.getName()).map(net.minecraft.world.entity.EntityTypes::getDescriptionId).orElse(null); } + public int nextEntityId() { -+ return net.minecraft.server.Entity.nextEntityId(); ++ return net.minecraft.world.entity.Entity.nextEntityId(); + } + // Paper end diff --git a/Spigot-Server-Patches/0575-Lazily-track-plugin-scoreboards-by-default.patch b/Spigot-Server-Patches/0575-Lazily-track-plugin-scoreboards-by-default.patch index 89978b8026..62b39e1d6d 100644 --- a/Spigot-Server-Patches/0575-Lazily-track-plugin-scoreboards-by-default.patch +++ b/Spigot-Server-Patches/0575-Lazily-track-plugin-scoreboards-by-default.patch @@ -28,7 +28,7 @@ index 545948f20efd6c8dd42140b565af94cd6b52b661..7d50aded88f5b7dfebaea1aebc86231f + } } diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java -index 5178981cd561be45b8f93e7060b13874fbd41fcf..5a6de5e5adee73e64883b5c48d6c5c0828b8eb74 100644 +index 6ea491f6308317059c4bc6735abbdce370df0f34..88bc3fbfa3bfb27cc4f9003a99cbce6e58def98f 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboard.java @@ -19,6 +19,7 @@ import org.bukkit.scoreboard.Team; @@ -53,12 +53,12 @@ index 5178981cd561be45b8f93e7060b13874fbd41fcf..5a6de5e5adee73e64883b5c48d6c5c08 return new CraftObjective(this, objective);*/ // Paper return registerNewObjective(name, criteria, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(displayName), renderType); // Paper diff --git a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java -index ca2be30609159e6ca98b363d75cbc3ac550bca31..6fa2e271f7f01cd0bf247e2071fa33bd8c5c6cbe 100644 +index 73663bcea163cda26f531902141a9ad3ad7eba57..9c30a79cc55c6455aa18e3798728deaacc3434ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java +++ b/src/main/java/org/bukkit/craftbukkit/scoreboard/CraftScoreboardManager.java @@ -30,6 +30,7 @@ public final class CraftScoreboardManager implements ScoreboardManager { - public CraftScoreboardManager(MinecraftServer minecraftserver, net.minecraft.server.Scoreboard scoreboardServer) { + public CraftScoreboardManager(MinecraftServer minecraftserver, net.minecraft.world.scores.Scoreboard scoreboardServer) { mainScoreboard = new CraftScoreboard(scoreboardServer); + mainScoreboard.registeredGlobally = true; // Paper server = minecraftserver; diff --git a/Spigot-Server-Patches/0576-Entity-isTicking.patch b/Spigot-Server-Patches/0576-Entity-isTicking.patch index 630cf5f713..ce47887366 100644 --- a/Spigot-Server-Patches/0576-Entity-isTicking.patch +++ b/Spigot-Server-Patches/0576-Entity-isTicking.patch @@ -4,11 +4,11 @@ Date: Sat, 3 Oct 2020 21:39:16 -0500 Subject: [PATCH] Entity#isTicking -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index 9415588d7df27fb6907381cff802fd8ad983663f..1840d64d1bbb1165981f79dd3deeb19816e6a230 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -3387,5 +3387,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 646f06d5a7c67cc2bef83840bdfe3b102f1f3d5a..e45af93ddb67361a5b67a79f4bc9b66bbdb3a14b 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -3472,5 +3472,9 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public static int nextEntityId() { return entityCount.incrementAndGet(); } @@ -19,10 +19,10 @@ index 9415588d7df27fb6907381cff802fd8ad983663f..1840d64d1bbb1165981f79dd3deeb198 // Paper end } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -index c519b46c94792082c62acc05cdbec0734776edf5..bb474fbdf44dbc61b4fa0bced4d15bc2d1fb548f 100644 +index e0ab4c96544483e43c7f5e5f5965f74a207437d5..c064c510442d615beeacf9899d9b7f0e10ce7575 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java -@@ -1158,5 +1158,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { +@@ -1157,5 +1157,9 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity { public boolean isInLava() { return getHandle().isInLava(); } diff --git a/Spigot-Server-Patches/0577-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch b/Spigot-Server-Patches/0577-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch index 283a0de05e..fc18e015b9 100644 --- a/Spigot-Server-Patches/0577-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch +++ b/Spigot-Server-Patches/0577-Fix-deop-kicking-non-whitelisted-player-when-white-l.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Fix deop kicking non-whitelisted player when white list is diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b2940f0a9b6fba05defe3369b6d2561d054714fe..5a1c14eccf58c39aced52011c6e094c0a3c46cd9 100644 +index 27e7547a6414e84e170ca33bdb276a451f35cf46..8e5dcab795b1158e2ee957ac4532f5bdf00b6376 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -1899,6 +1899,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant recursiveStream() { diff --git a/Spigot-Server-Patches/0580-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch b/Spigot-Server-Patches/0580-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch index f0e2ad3463..42d7399da7 100644 --- a/Spigot-Server-Patches/0580-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch +++ b/Spigot-Server-Patches/0580-MC-147729-Drop-items-that-are-extra-from-a-crafting-.patch @@ -4,11 +4,11 @@ Date: Wed, 18 Mar 2020 00:07:46 -0500 Subject: [PATCH] MC-147729: Drop items that are extra from a crafting recipe -diff --git a/src/main/java/net/minecraft/server/AutoRecipe.java b/src/main/java/net/minecraft/server/AutoRecipe.java -index a5d29242b48e0d19d35ee2fe84824a2ef32923b9..156ab966e8fb4d742b50a2f90420710b0c7b4764 100644 ---- a/src/main/java/net/minecraft/server/AutoRecipe.java -+++ b/src/main/java/net/minecraft/server/AutoRecipe.java -@@ -60,7 +60,12 @@ public class AutoRecipe implements AutoRecipeAbstract implements AutoRecipeAbstractBukkit Material -diff --git a/src/main/java/net/minecraft/server/IBlockData.java b/src/main/java/net/minecraft/server/IBlockData.java -index 10a5901db1e0efe0b7d6958098bb0ae492a9e76f..e7aa8aca2458a7fea7bc3bf1335b04daeaba98c2 100644 ---- a/src/main/java/net/minecraft/server/IBlockData.java -+++ b/src/main/java/net/minecraft/server/IBlockData.java -@@ -8,6 +8,19 @@ public class IBlockData extends BlockBase.BlockData { +diff --git a/src/main/java/net/minecraft/world/level/block/state/IBlockData.java b/src/main/java/net/minecraft/world/level/block/state/IBlockData.java +index 9e1ebfd7befe9e2fc3396b4dcd5e8fc7c23ee305..ed28710fefee4fad96290b2d166ac9dfe3d1fa6e 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/IBlockData.java ++++ b/src/main/java/net/minecraft/world/level/block/state/IBlockData.java +@@ -11,6 +11,19 @@ public class IBlockData extends BlockBase.BlockData { public static final Codec b = a((Codec) IRegistry.BLOCK, Block::getBlockData).stable(); @@ -30,7 +30,7 @@ index 10a5901db1e0efe0b7d6958098bb0ae492a9e76f..e7aa8aca2458a7fea7bc3bf1335b04da super(block, immutablemap, mapcodec); } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java -index 6cd662c9130e6282ab520d0d471f56d9a66da5ea..0160bf9e64f0a3befe60d9945648cb4dfd297877 100644 +index aa20cecc93ac53ce7f1b956ea5065ae80b55cff5..fc65c138bab242d5b533381ea496a2a48fcd91ea 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftChunkSnapshot.java @@ -79,7 +79,7 @@ public class CraftChunkSnapshot implements ChunkSnapshot { @@ -43,7 +43,7 @@ index 6cd662c9130e6282ab520d0d471f56d9a66da5ea..0160bf9e64f0a3befe60d9945648cb4d @Override diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 3524b677525bf2bb529b797fe1f258efb34ac3fc..3baf7b75c65c9beba40945ba904315251b5b7a64 100644 +index c0238ba202b9f6c215788671652c768948acf753..44e1d80ec871142d3b498d3897d8ceb82452c1f2 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -214,7 +214,7 @@ public class CraftBlock implements Block { @@ -56,7 +56,7 @@ index 3524b677525bf2bb529b797fe1f258efb34ac3fc..3baf7b75c65c9beba40945ba90431525 @Override diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java -index 0f89e776816ad4ecb6c3e54c2549692f1b5b6aae..36d7de6e6540e156499edb4b69b8bbaeb0d6dc54 100644 +index b7ce677572f1f5ed01f3a8caf9368222e03bb69c..1960f01b5e4d7bff96d466e9a48f1d5300f261d1 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlockState.java @@ -135,7 +135,7 @@ public class CraftBlockState implements BlockState { @@ -69,7 +69,7 @@ index 0f89e776816ad4ecb6c3e54c2549692f1b5b6aae..36d7de6e6540e156499edb4b69b8bbae public void setFlag(int flag) { diff --git a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java -index 590236ccc6c15f8c4ad15913fb3ac36d28414318..5207e58670b25d60886bfd66dfb9e8acd1552f5f 100644 +index 61d08973be351017df2d1a9f0ab12101cfe15af5..4d936c544acfc85cda52b8d3a1cdf4df29749a93 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java +++ b/src/main/java/org/bukkit/craftbukkit/block/data/CraftBlockData.java @@ -44,7 +44,7 @@ public class CraftBlockData implements BlockData { @@ -82,7 +82,7 @@ index 590236ccc6c15f8c4ad15913fb3ac36d28414318..5207e58670b25d60886bfd66dfb9e8ac public IBlockData getState() { diff --git a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java -index 948a59217cca0f8dfa9d3befb61e679a67bf29bc..1510d80891156ba97ae59e39f928b97d0226b057 100644 +index d02281f954aac8d8b65f5d36ec70f0352e4c7cdd..2194232200e90fa894b45eb265b5ed08ce1e35a3 100644 --- a/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java +++ b/src/main/java/org/bukkit/craftbukkit/generator/CraftChunkData.java @@ -73,7 +73,7 @@ public final class CraftChunkData implements ChunkGenerator.ChunkData { diff --git a/Spigot-Server-Patches/0584-Villager-resetOffers.patch b/Spigot-Server-Patches/0584-Villager-resetOffers.patch index e47dd46a03..5c18995906 100644 --- a/Spigot-Server-Patches/0584-Villager-resetOffers.patch +++ b/Spigot-Server-Patches/0584-Villager-resetOffers.patch @@ -4,11 +4,11 @@ Date: Mon, 7 Oct 2019 00:15:37 -0500 Subject: [PATCH] Villager#resetOffers -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index f5865052261cb49c3f853e4d65e21831c83c2ea0..790df2be9cbbc359ba354ed272dbf6dda71951f0 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -86,6 +86,13 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +index 3dd80fcf9237f15bb3bf38d1529340e178f09388..a614f5d5817bf999aca0f0b50f343031c8168392 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +@@ -113,6 +113,13 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return this.tradingPlayer != null; } @@ -22,7 +22,7 @@ index f5865052261cb49c3f853e4d65e21831c83c2ea0..790df2be9cbbc359ba354ed272dbf6dd @Override public MerchantRecipeList getOffers() { if (this.trades == null) { -@@ -208,6 +215,7 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +@@ -235,6 +242,7 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP return this.world; } @@ -31,7 +31,7 @@ index f5865052261cb49c3f853e4d65e21831c83c2ea0..790df2be9cbbc359ba354ed272dbf6dd protected void a(MerchantRecipeList merchantrecipelist, VillagerTrades.IMerchantRecipeOption[] avillagertrades_imerchantrecipeoption, int i) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java -index 18520fec054b3bcdf73aaca95c665e7a1254b76f..e9c5c26818cc42e67db90809263dab184501af75 100644 +index 01285d555ed084fa2e818e1f02955f8aa28002b3..ee751ed4f9f386bf9926347fe2f0958015aecffa 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftAbstractVillager.java @@ -71,4 +71,11 @@ public class CraftAbstractVillager extends CraftAgeable implements AbstractVilla diff --git a/Spigot-Server-Patches/0585-Improve-inlinig-for-some-hot-IBlockData-methods.patch b/Spigot-Server-Patches/0585-Improve-inlinig-for-some-hot-IBlockData-methods.patch index 1c7e01bac8..cd28fe650f 100644 --- a/Spigot-Server-Patches/0585-Improve-inlinig-for-some-hot-IBlockData-methods.patch +++ b/Spigot-Server-Patches/0585-Improve-inlinig-for-some-hot-IBlockData-methods.patch @@ -4,11 +4,11 @@ Date: Mon, 6 Jul 2020 20:46:50 -0700 Subject: [PATCH] Improve inlinig for some hot IBlockData methods -diff --git a/src/main/java/net/minecraft/server/BlockBase.java b/src/main/java/net/minecraft/server/BlockBase.java -index 868d942d83d57b07523f82252815ffd3593273bb..1f334d63282bd5c23dc3b275a220f09e60c34537 100644 ---- a/src/main/java/net/minecraft/server/BlockBase.java -+++ b/src/main/java/net/minecraft/server/BlockBase.java -@@ -338,7 +338,14 @@ public abstract class BlockBase { +diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +index ffb5dc4fabb9249dfc1c8521025eaad0d6205329..6f429103ce21dc9c8eab25973809907df73691c9 100644 +--- a/src/main/java/net/minecraft/world/level/block/state/BlockBase.java ++++ b/src/main/java/net/minecraft/world/level/block/state/BlockBase.java +@@ -389,7 +389,14 @@ public abstract class BlockBase { } // Paper end @@ -23,7 +23,7 @@ index 868d942d83d57b07523f82252815ffd3593273bb..1f334d63282bd5c23dc3b275a220f09e if (!this.getBlock().o()) { this.a = new BlockBase.BlockData.Cache(this.p()); } -@@ -377,19 +384,19 @@ public abstract class BlockBase { +@@ -428,19 +435,19 @@ public abstract class BlockBase { return this.getBlock().d(this.p(), iblockaccess, blockposition); } @@ -47,7 +47,7 @@ index 868d942d83d57b07523f82252815ffd3593273bb..1f334d63282bd5c23dc3b275a220f09e return this.f; } -@@ -455,7 +462,7 @@ public abstract class BlockBase { +@@ -506,7 +513,7 @@ public abstract class BlockBase { } } @@ -56,7 +56,7 @@ index 868d942d83d57b07523f82252815ffd3593273bb..1f334d63282bd5c23dc3b275a220f09e return this.k; } -@@ -627,12 +634,12 @@ public abstract class BlockBase { +@@ -678,12 +685,12 @@ public abstract class BlockBase { return this.getBlock().a(block); } @@ -73,11 +73,11 @@ index 868d942d83d57b07523f82252815ffd3593273bb..1f334d63282bd5c23dc3b275a220f09e } public SoundEffectType getStepSound() { -diff --git a/src/main/java/net/minecraft/server/Fluid.java b/src/main/java/net/minecraft/server/Fluid.java -index 05fa52c0b12f159788ec3f2b769753b6bd29578c..ff2fb72f710dd5aa5126b1550c5ff11087d7e63e 100644 ---- a/src/main/java/net/minecraft/server/Fluid.java -+++ b/src/main/java/net/minecraft/server/Fluid.java -@@ -9,8 +9,12 @@ public final class Fluid extends IBlockDataHolder { +diff --git a/src/main/java/net/minecraft/world/level/material/Fluid.java b/src/main/java/net/minecraft/world/level/material/Fluid.java +index 9a93b204973eef4c02a52f33fd9578a43603ed98..147e628bd562da4cf6f07218724a9d6c79d26e38 100644 +--- a/src/main/java/net/minecraft/world/level/material/Fluid.java ++++ b/src/main/java/net/minecraft/world/level/material/Fluid.java +@@ -20,8 +20,12 @@ public final class Fluid extends IBlockDataHolder { public static final Codec a = a((Codec) IRegistry.FLUID, FluidType::h).stable(); @@ -90,7 +90,7 @@ index 05fa52c0b12f159788ec3f2b769753b6bd29578c..ff2fb72f710dd5aa5126b1550c5ff110 } public FluidType getType() { -@@ -22,7 +26,7 @@ public final class Fluid extends IBlockDataHolder { +@@ -33,7 +37,7 @@ public final class Fluid extends IBlockDataHolder { } public boolean isEmpty() { diff --git a/Spigot-Server-Patches/0586-Retain-block-place-order-when-capturing-blockstates.patch b/Spigot-Server-Patches/0586-Retain-block-place-order-when-capturing-blockstates.patch index 9b3c98828d..00d0b5a12d 100644 --- a/Spigot-Server-Patches/0586-Retain-block-place-order-when-capturing-blockstates.patch +++ b/Spigot-Server-Patches/0586-Retain-block-place-order-when-capturing-blockstates.patch @@ -9,11 +9,11 @@ bonemeal by a player. In general, look at making this logic more robust (i.e properly handling cases where a captured entry is overriden) - but for now this will do. -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index a9a853f176613fae6c1f5937a724f580ce60db2c..16c3ef27e8f77942401568727ea78230147dba29 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -75,7 +75,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 1aa9b47287b4b8e8516fcf3ead96c03a84e47b0f..d14c38fbf7eb76dd7581c13258ee6832f5f70513 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -127,7 +127,7 @@ public abstract class World implements GeneratorAccess, AutoCloseable { public boolean captureBlockStates = false; public boolean captureTreeGeneration = false; public Map capturedBlockStates = new java.util.LinkedHashMap<>(); // Paper diff --git a/Spigot-Server-Patches/0587-Reduce-blockpos-allocation-from-pathfinding.patch b/Spigot-Server-Patches/0587-Reduce-blockpos-allocation-from-pathfinding.patch index edac8bad4d..2640189324 100644 --- a/Spigot-Server-Patches/0587-Reduce-blockpos-allocation-from-pathfinding.patch +++ b/Spigot-Server-Patches/0587-Reduce-blockpos-allocation-from-pathfinding.patch @@ -4,11 +4,11 @@ Date: Sat, 25 Apr 2020 17:10:55 -0700 Subject: [PATCH] Reduce blockpos allocation from pathfinding -diff --git a/src/main/java/net/minecraft/server/PathfinderNormal.java b/src/main/java/net/minecraft/server/PathfinderNormal.java -index 07b021bd1fb174d1c1a0c83b415c84e582c4f681..74e81e1e4aea6f74b14a84231ddeb7f2fb845ae7 100644 ---- a/src/main/java/net/minecraft/server/PathfinderNormal.java -+++ b/src/main/java/net/minecraft/server/PathfinderNormal.java -@@ -475,7 +475,7 @@ public class PathfinderNormal extends PathfinderAbstract { +diff --git a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java +index d14f2800237c2a80912bf6f2d418a9ba9031070d..a0c7d3ab747ba1a3cf07e716f3591663a8a9e14b 100644 +--- a/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java ++++ b/src/main/java/net/minecraft/world/level/pathfinder/PathfinderNormal.java +@@ -498,7 +498,7 @@ public class PathfinderNormal extends PathfinderAbstract { return PathType.DANGER_FIRE; } @@ -17,7 +17,7 @@ index 07b021bd1fb174d1c1a0c83b415c84e582c4f681..74e81e1e4aea6f74b14a84231ddeb7f2 return PathType.WATER_BORDER; } } // Paper -@@ -505,7 +505,7 @@ public class PathfinderNormal extends PathfinderAbstract { +@@ -528,7 +528,7 @@ public class PathfinderNormal extends PathfinderAbstract { } else if (iblockdata.a(Blocks.COCOA)) { return PathType.COCOA; } else { diff --git a/Spigot-Server-Patches/0588-Fix-item-locations-dropped-from-campfires.patch b/Spigot-Server-Patches/0588-Fix-item-locations-dropped-from-campfires.patch index f6aad68577..dd0ef6a7e9 100644 --- a/Spigot-Server-Patches/0588-Fix-item-locations-dropped-from-campfires.patch +++ b/Spigot-Server-Patches/0588-Fix-item-locations-dropped-from-campfires.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix item locations dropped from campfires Fixes #4259 by not flooring the blockposition among other weirdness -diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java -index 51e9cba5c9c99f2b73052e8fae499b68e6fae2a2..c56c588f508b51677c599412215f043aa0a35f98 100644 ---- a/src/main/java/net/minecraft/server/TileEntityCampfire.java -+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java -@@ -75,7 +75,11 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java +index df010dc740f2dd647a418ba4e425ce3a3b1d79e2..bd213deedf47e71f0983bb950c7e74d4bf30f54e 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java +@@ -92,7 +92,11 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab result = blockCookEvent.getResult(); itemstack1 = CraftItemStack.asNMSCopy(result); // CraftBukkit end diff --git a/Spigot-Server-Patches/0590-Fixed-TileEntityBell-memory-leak.patch b/Spigot-Server-Patches/0590-Fixed-TileEntityBell-memory-leak.patch index e2d31adf45..879f752716 100644 --- a/Spigot-Server-Patches/0590-Fixed-TileEntityBell-memory-leak.patch +++ b/Spigot-Server-Patches/0590-Fixed-TileEntityBell-memory-leak.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fixed TileEntityBell memory leak TileEntityBell has a list of entities (entitiesAtRing) that was not being cleared at the right time, causing leaks whenever a bell would be rung near a crowd of entities. -diff --git a/src/main/java/net/minecraft/server/TileEntityBell.java b/src/main/java/net/minecraft/server/TileEntityBell.java -index 4c5aa99e092a9476e837a3e68d4cbab4b89c0259..6963f3c8a0e257615084b558f5ce287aab9722ff 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBell.java -+++ b/src/main/java/net/minecraft/server/TileEntityBell.java -@@ -10,8 +10,8 @@ public class TileEntityBell extends TileEntity implements ITickable { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java +index e97d229da3cf7631555f418a73bc74255494cc01..84f9f52c5b632621b509448ac1c760f64de6b062 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBell.java +@@ -27,8 +27,8 @@ public class TileEntityBell extends TileEntity implements ITickable { public int a; public boolean b; public EnumDirection c; @@ -20,7 +20,7 @@ index 4c5aa99e092a9476e837a3e68d4cbab4b89c0259..6963f3c8a0e257615084b558f5ce287a private int j; public TileEntityBell() { -@@ -40,6 +40,11 @@ public class TileEntityBell extends TileEntity implements ITickable { +@@ -57,6 +57,11 @@ public class TileEntityBell extends TileEntity implements ITickable { if (this.a >= 50) { this.b = false; @@ -32,7 +32,7 @@ index 4c5aa99e092a9476e837a3e68d4cbab4b89c0259..6963f3c8a0e257615084b558f5ce287a this.a = 0; } -@@ -54,6 +59,7 @@ public class TileEntityBell extends TileEntity implements ITickable { +@@ -71,6 +76,7 @@ public class TileEntityBell extends TileEntity implements ITickable { } else { this.a(this.world); this.b(this.world); @@ -40,7 +40,7 @@ index 4c5aa99e092a9476e837a3e68d4cbab4b89c0259..6963f3c8a0e257615084b558f5ce287a this.i = false; } } -@@ -94,11 +100,12 @@ public class TileEntityBell extends TileEntity implements ITickable { +@@ -111,11 +117,12 @@ public class TileEntityBell extends TileEntity implements ITickable { EntityLiving entityliving = (EntityLiving) iterator.next(); if (entityliving.isAlive() && !entityliving.dead && blockposition.a((IPosition) entityliving.getPositionVector(), 32.0D)) { diff --git a/Spigot-Server-Patches/0591-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch b/Spigot-Server-Patches/0591-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch index 3b99f10170..775fe3cc1e 100644 --- a/Spigot-Server-Patches/0591-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch +++ b/Spigot-Server-Patches/0591-Avoid-error-bubbling-up-when-item-stack-is-empty-in-.patch @@ -7,11 +7,11 @@ Subject: [PATCH] Avoid error bubbling up when item stack is empty in fishing This can realistically only happen if there's custom loot active on fishing which can return 0 items. This would disconnect the player who's fishing. -diff --git a/src/main/java/net/minecraft/server/EntityFishingHook.java b/src/main/java/net/minecraft/server/EntityFishingHook.java -index fac695125da50bb33b68f317339832a26f7625a6..3580f40b2bb30bceca0ce374edb29608168a00c0 100644 ---- a/src/main/java/net/minecraft/server/EntityFishingHook.java -+++ b/src/main/java/net/minecraft/server/EntityFishingHook.java -@@ -446,9 +446,15 @@ public class EntityFishingHook extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +index d40b056b2ff14033113bd7108a3295f8783b8bdf..addea9c1309a308b76c93ee71e839c915bc773e8 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFishingHook.java +@@ -484,9 +484,15 @@ public class EntityFishingHook extends IProjectile { while (iterator.hasNext()) { ItemStack itemstack1 = (ItemStack) iterator.next(); @@ -29,7 +29,7 @@ index fac695125da50bb33b68f317339832a26f7625a6..3580f40b2bb30bceca0ce374edb29608 playerFishEvent.setExpToDrop(this.random.nextInt(6) + 1); this.world.getServer().getPluginManager().callEvent(playerFishEvent); -@@ -461,8 +467,12 @@ public class EntityFishingHook extends IProjectile { +@@ -499,8 +505,12 @@ public class EntityFishingHook extends IProjectile { double d2 = entityhuman.locZ() - this.locZ(); double d3 = 0.1D; diff --git a/Spigot-Server-Patches/0593-Add-ignore-discounts-API.patch b/Spigot-Server-Patches/0593-Add-ignore-discounts-API.patch index 98f094c86c..bd3bc818d4 100644 --- a/Spigot-Server-Patches/0593-Add-ignore-discounts-API.patch +++ b/Spigot-Server-Patches/0593-Add-ignore-discounts-API.patch @@ -4,11 +4,11 @@ Date: Mon, 9 Nov 2020 20:44:51 +0100 Subject: [PATCH] Add ignore discounts API -diff --git a/src/main/java/net/minecraft/server/EntityVillager.java b/src/main/java/net/minecraft/server/EntityVillager.java -index 650e373a925296f14150de5cbecc6b083679ba54..ca9591a1ca07ca0e88212577b7a94990f591f887 100644 ---- a/src/main/java/net/minecraft/server/EntityVillager.java -+++ b/src/main/java/net/minecraft/server/EntityVillager.java -@@ -389,6 +389,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +index 89ae2b4b836658dc335f28760672b952c2fb58d4..32155889583b0773b8cadabbd2f279f9b88d1a0b 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillager.java +@@ -459,6 +459,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation while (iterator.hasNext()) { MerchantRecipe merchantrecipe = (MerchantRecipe) iterator.next(); @@ -16,7 +16,7 @@ index 650e373a925296f14150de5cbecc6b083679ba54..ca9591a1ca07ca0e88212577b7a94990 // CraftBukkit start int bonus = -MathHelper.d((float) i * merchantrecipe.getPriceMultiplier()); -@@ -408,6 +409,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation +@@ -478,6 +479,7 @@ public class EntityVillager extends EntityVillagerAbstract implements Reputation while (iterator1.hasNext()) { MerchantRecipe merchantrecipe1 = (MerchantRecipe) iterator1.next(); @@ -24,11 +24,11 @@ index 650e373a925296f14150de5cbecc6b083679ba54..ca9591a1ca07ca0e88212577b7a94990 double d0 = 0.3D + 0.0625D * (double) j; int k = (int) Math.floor(d0 * (double) merchantrecipe1.a().getCount()); -diff --git a/src/main/java/net/minecraft/server/MerchantRecipe.java b/src/main/java/net/minecraft/server/MerchantRecipe.java -index e42382a5c385c27b6322b03e87870eb20b21cb22..4f1cfdfafa6a6fc0382425a8ddc986f285e055e6 100644 ---- a/src/main/java/net/minecraft/server/MerchantRecipe.java -+++ b/src/main/java/net/minecraft/server/MerchantRecipe.java -@@ -14,6 +14,7 @@ public class MerchantRecipe { +diff --git a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java +index 9e2fe0d5e6d4ea1f4c9cea96b755ddcd1e3c9009..605d1b2514c272c0fcf3cb9d7575ad8066dad31b 100644 +--- a/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java ++++ b/src/main/java/net/minecraft/world/item/trading/MerchantRecipe.java +@@ -19,6 +19,7 @@ public class MerchantRecipe { private int demand; public float priceMultiplier; public int xp; @@ -36,7 +36,7 @@ index e42382a5c385c27b6322b03e87870eb20b21cb22..4f1cfdfafa6a6fc0382425a8ddc986f2 // CraftBukkit start private CraftMerchantRecipe bukkitHandle; -@@ -22,7 +23,12 @@ public class MerchantRecipe { +@@ -27,7 +28,12 @@ public class MerchantRecipe { } public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int uses, int maxUses, int experience, float priceMultiplier, CraftMerchantRecipe bukkit) { @@ -50,7 +50,7 @@ index e42382a5c385c27b6322b03e87870eb20b21cb22..4f1cfdfafa6a6fc0382425a8ddc986f2 this.bukkitHandle = bukkit; } // CraftBukkit end -@@ -54,6 +60,7 @@ public class MerchantRecipe { +@@ -59,6 +65,7 @@ public class MerchantRecipe { this.specialPrice = nbttagcompound.getInt("specialPrice"); this.demand = nbttagcompound.getInt("demand"); @@ -58,7 +58,7 @@ index e42382a5c385c27b6322b03e87870eb20b21cb22..4f1cfdfafa6a6fc0382425a8ddc986f2 } public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, int i, int j, float f) { -@@ -65,10 +72,19 @@ public class MerchantRecipe { +@@ -70,10 +77,19 @@ public class MerchantRecipe { } public MerchantRecipe(ItemStack itemstack, ItemStack itemstack1, ItemStack itemstack2, int i, int j, int k, float f) { @@ -79,7 +79,7 @@ index e42382a5c385c27b6322b03e87870eb20b21cb22..4f1cfdfafa6a6fc0382425a8ddc986f2 this.rewardExp = true; this.xp = 1; this.buyingItem1 = itemstack; -@@ -184,6 +200,7 @@ public class MerchantRecipe { +@@ -189,6 +205,7 @@ public class MerchantRecipe { nbttagcompound.setFloat("priceMultiplier", this.priceMultiplier); nbttagcompound.setInt("specialPrice", this.specialPrice); nbttagcompound.setInt("demand", this.demand); @@ -88,7 +88,7 @@ index e42382a5c385c27b6322b03e87870eb20b21cb22..4f1cfdfafa6a6fc0382425a8ddc986f2 } diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java -index e198251617bfd6b0fe932d8bfa5dfcafdac919c2..3ae27b125839f3d08f118867254f6fb8a000b6ae 100644 +index e3b9a0ebe5cec5b47d9d225887656e00e999960b..0c8728bd8272e36d70cf8f05fcd7656ea5a48702 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchantRecipe.java @@ -17,7 +17,12 @@ public class CraftMerchantRecipe extends MerchantRecipe { @@ -102,9 +102,9 @@ index e198251617bfd6b0fe932d8bfa5dfcafdac919c2..3ae27b125839f3d08f118867254f6fb8 + public CraftMerchantRecipe(ItemStack result, int uses, int maxUses, boolean experienceReward, int experience, float priceMultiplier, boolean ignoreDiscounts) { + super(result, uses, maxUses, experienceReward, experience, priceMultiplier, ignoreDiscounts); + // Paper end - this.handle = new net.minecraft.server.MerchantRecipe( - net.minecraft.server.ItemStack.b, - net.minecraft.server.ItemStack.b, + this.handle = new net.minecraft.world.item.trading.MerchantRecipe( + net.minecraft.world.item.ItemStack.b, + net.minecraft.world.item.ItemStack.b, @@ -26,6 +31,7 @@ public class CraftMerchantRecipe extends MerchantRecipe { maxUses, experience, @@ -129,7 +129,7 @@ index e198251617bfd6b0fe932d8bfa5dfcafdac919c2..3ae27b125839f3d08f118867254f6fb8 + } + // Paper end + - public net.minecraft.server.MerchantRecipe toMinecraft() { + public net.minecraft.world.item.trading.MerchantRecipe toMinecraft() { List ingredients = getIngredients(); Preconditions.checkState(!ingredients.isEmpty(), "No offered ingredients"); @@ -95,7 +113,7 @@ public class CraftMerchantRecipe extends MerchantRecipe { diff --git a/Spigot-Server-Patches/0594-Toggle-for-removing-existing-dragon.patch b/Spigot-Server-Patches/0594-Toggle-for-removing-existing-dragon.patch index 07bbfce6fd..724d1c2111 100644 --- a/Spigot-Server-Patches/0594-Toggle-for-removing-existing-dragon.patch +++ b/Spigot-Server-Patches/0594-Toggle-for-removing-existing-dragon.patch @@ -21,11 +21,11 @@ index 02bb85364560784adea47c877c13291c3d016b86..424754a0183b071d20c86f0420cec784 + } + } } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index 95ecf9dd511836cc2f70173f07234ef8822d6038..38dc6086d18951e065d4048d1d8eee288c5c5fd1 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -172,7 +172,7 @@ public class EnderDragonBattle { +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +index c6283489dcb6e13f0d618971614aeadaee2e3007..c0a6b340810b8ea4f454290b1ac22316ff0e6e22 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -214,7 +214,7 @@ public class EnderDragonBattle { this.dragonUUID = entityenderdragon.getUniqueID(); EnderDragonBattle.LOGGER.info("Found that there's a dragon still alive ({})", entityenderdragon); this.dragonKilled = false; diff --git a/Spigot-Server-Patches/0595-Fix-client-lag-on-advancement-loading.patch b/Spigot-Server-Patches/0595-Fix-client-lag-on-advancement-loading.patch index e59a9b5264..515328442a 100644 --- a/Spigot-Server-Patches/0595-Fix-client-lag-on-advancement-loading.patch +++ b/Spigot-Server-Patches/0595-Fix-client-lag-on-advancement-loading.patch @@ -15,10 +15,10 @@ manually reload the advancement data for all players, which normally takes place as a part of the datapack reloading. diff --git a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -index 17789407b9e86896a963a305a13357286aa5f319..c680319e4040be2b60795b22a5e65d6444cc67ed 100644 +index 17f508f07f7a3a0608150558595809bdcd3bbe96..4f7a1bdc1c7e6ef0d1a1954ccd5d95318a5bceaf 100644 --- a/src/main/java/net/minecraft/server/AdvancementDataPlayer.java +++ b/src/main/java/net/minecraft/server/AdvancementDataPlayer.java -@@ -78,6 +78,7 @@ public class AdvancementDataPlayer { +@@ -96,6 +96,7 @@ public class AdvancementDataPlayer { } @@ -26,7 +26,7 @@ index 17789407b9e86896a963a305a13357286aa5f319..c680319e4040be2b60795b22a5e65d64 public void a(AdvancementDataWorld advancementdataworld) { this.a(); this.data.clear(); -@@ -374,6 +375,7 @@ public class AdvancementDataPlayer { +@@ -392,6 +393,7 @@ public class AdvancementDataPlayer { } @@ -35,7 +35,7 @@ index 17789407b9e86896a963a305a13357286aa5f319..c680319e4040be2b60795b22a5e65d64 if (this.m || !this.i.isEmpty() || !this.j.isEmpty()) { Map map = Maps.newHashMap(); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 6be34896149366925edd9d7eb4630132533d60c2..db241142e892940571c39e95f2dce648e79702bb 100644 +index 25af57d0ab191f6a29ae95cec764667e9c23bdd4..4b7ca6d2e13fad43a75a345608b739f47adba738 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -289,7 +289,13 @@ public final class CraftMagicNumbers implements UnsafeValues { diff --git a/Spigot-Server-Patches/0597-Beacon-API-custom-effect-ranges.patch b/Spigot-Server-Patches/0597-Beacon-API-custom-effect-ranges.patch index 13b791c3c3..f32bda9f01 100644 --- a/Spigot-Server-Patches/0597-Beacon-API-custom-effect-ranges.patch +++ b/Spigot-Server-Patches/0597-Beacon-API-custom-effect-ranges.patch @@ -4,11 +4,11 @@ Date: Wed, 24 Jun 2020 12:39:08 -0600 Subject: [PATCH] Beacon API - custom effect ranges -diff --git a/src/main/java/net/minecraft/server/TileEntityBeacon.java b/src/main/java/net/minecraft/server/TileEntityBeacon.java -index fdf73eca821bab5ec7a742645893793679b5d42c..9019db391bc98b55eaa8bef11ab78c9d88fa7a18 100644 ---- a/src/main/java/net/minecraft/server/TileEntityBeacon.java -+++ b/src/main/java/net/minecraft/server/TileEntityBeacon.java -@@ -43,6 +43,26 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +index f9b1ab0e19ff398a16b1452e86f1a165a4b54219..8dfb9eb12d07c2d4737ecf3de1ae7f6de31891bf 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityBeacon.java +@@ -73,6 +73,26 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic return (hasSecondaryEffect()) ? CraftPotionUtil.toBukkit(new MobEffect(this.secondaryEffect, getLevel(), getAmplification(), true, true)) : null; } // CraftBukkit end @@ -35,7 +35,7 @@ index fdf73eca821bab5ec7a742645893793679b5d42c..9019db391bc98b55eaa8bef11ab78c9d public TileEntityBeacon() { super(TileEntityTypes.BEACON); -@@ -233,7 +253,8 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -263,7 +283,8 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic public List getHumansInRange() { { @@ -45,7 +45,7 @@ index fdf73eca821bab5ec7a742645893793679b5d42c..9019db391bc98b55eaa8bef11ab78c9d AxisAlignedBB axisalignedbb = (new AxisAlignedBB(this.position)).g(d0).b(0.0D, (double) this.world.getBuildHeight(), 0.0D); List list = this.world.a(EntityHuman.class, axisalignedbb); -@@ -334,6 +355,9 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -364,6 +385,9 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic this.secondaryEffect = MobEffectList.fromId(nbttagcompound.getInt("Secondary")); this.levels = nbttagcompound.getInt("Levels"); // SPIGOT-5053, use where available // CraftBukkit end @@ -55,7 +55,7 @@ index fdf73eca821bab5ec7a742645893793679b5d42c..9019db391bc98b55eaa8bef11ab78c9d if (nbttagcompound.hasKeyOfType("CustomName", 8)) { this.customName = IChatBaseComponent.ChatSerializer.a(nbttagcompound.getString("CustomName")); } -@@ -350,6 +374,8 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic +@@ -380,6 +404,8 @@ public class TileEntityBeacon extends TileEntity implements ITileInventory, ITic if (this.customName != null) { nbttagcompound.setString("CustomName", IChatBaseComponent.ChatSerializer.a(this.customName)); } @@ -65,7 +65,7 @@ index fdf73eca821bab5ec7a742645893793679b5d42c..9019db391bc98b55eaa8bef11ab78c9d this.chestLock.a(nbttagcompound); return nbttagcompound; diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java -index 252b03e287cbe9212c7ec80be049647c4c77d37a..939782a75258b2228a5566648ce5a4ec2cc3e76e 100644 +index d3ae5cadd88f9012203d2c04cbe38af9b215ef0b..c2e054853cba891326d45e9129bbc09e32fa3cc7 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBeacon.java @@ -108,4 +108,19 @@ public class CraftBeacon extends CraftBlockEntityState impleme diff --git a/Spigot-Server-Patches/0598-Add-API-for-quit-reason.patch b/Spigot-Server-Patches/0598-Add-API-for-quit-reason.patch index c1f4f523f5..f0fd210d45 100644 --- a/Spigot-Server-Patches/0598-Add-API-for-quit-reason.patch +++ b/Spigot-Server-Patches/0598-Add-API-for-quit-reason.patch @@ -4,23 +4,11 @@ Date: Sat, 14 Nov 2020 16:19:52 +0100 Subject: [PATCH] Add API for quit reason -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 8436b7be989bf08c8ec1f0d646b20e777a0ebd55..3728ff515feea7fd6fe8c62c0e6646e8a8662beb 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -130,6 +130,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { - double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks - - boolean needsChunkCenterUpdate; // Paper - no-tick view distance -+ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event - - public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { - super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); -diff --git a/src/main/java/net/minecraft/server/NetworkManager.java b/src/main/java/net/minecraft/server/NetworkManager.java -index fc4ad72ffaed5e747cfecc71e9ac8ee2b556ce31..fb1e3c705b8abee13695762cdfd0e9f1bfdb5ad8 100644 ---- a/src/main/java/net/minecraft/server/NetworkManager.java -+++ b/src/main/java/net/minecraft/server/NetworkManager.java -@@ -119,12 +119,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { +diff --git a/src/main/java/net/minecraft/network/NetworkManager.java b/src/main/java/net/minecraft/network/NetworkManager.java +index b865e759ff522051c20534fea726d8610b7694ca..9a919542f1a4a23fdf64753a88de9b421e2b2a25 100644 +--- a/src/main/java/net/minecraft/network/NetworkManager.java ++++ b/src/main/java/net/minecraft/network/NetworkManager.java +@@ -129,12 +129,15 @@ public class NetworkManager extends SimpleChannelInboundHandler> { this.u = true; if (this.channel.isOpen()) { @@ -36,11 +24,23 @@ index fc4ad72ffaed5e747cfecc71e9ac8ee2b556ce31..fb1e3c705b8abee13695762cdfd0e9f1 if (flag) { NetworkManager.LOGGER.debug("Failed to sent packet", throwable); this.sendPacket(new PacketPlayOutKickDisconnect(chatmessage), (future) -> { -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index efd66e81492ec4f976b9db66b84f1c5d728c7a13..1f1baaa464459e06ac877ea3dcd1d30604ef8d88 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -302,6 +302,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 8e75c55460aba3885f52f7b0dc6e320101d402ba..8fa8d2e1e85fa382af9e9d65322bd98a87a6e3a9 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -257,6 +257,7 @@ public class EntityPlayer extends EntityHuman implements ICrafting { + double lastEntitySpawnRadiusSquared; // Paper - optimise isOutsideRange, this field is in blocks + + boolean needsChunkCenterUpdate; // Paper - no-tick view distance ++ public org.bukkit.event.player.PlayerQuitEvent.QuitReason quitReason = null; // Paper - there are a lot of changes to do if we change all methods leading to the event + + public EntityPlayer(MinecraftServer minecraftserver, WorldServer worldserver, GameProfile gameprofile, PlayerInteractManager playerinteractmanager) { + super(worldserver, worldserver.getSpawn(), worldserver.v(), gameprofile); +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 741011eed09109f8653fb8066ce636297f44b371..54a72470275cce96f86fe1e7219f931b738c71ec 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -446,6 +446,7 @@ public class PlayerConnection implements PacketListenerPlayIn { final IChatBaseComponent ichatbasecomponent = PaperAdventure.asVanilla(event.reason()); // Paper - Adventure // CraftBukkit end @@ -48,11 +48,11 @@ index efd66e81492ec4f976b9db66b84f1c5d728c7a13..1f1baaa464459e06ac877ea3dcd1d306 this.networkManager.sendPacket(new PacketPlayOutKickDisconnect(ichatbasecomponent), (future) -> { this.networkManager.close(ichatbasecomponent); }); -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index f7b17c80480e7d4650fe7210936923c6c3f8b45c..a6a836c936a687d67c67d861c72addf319b44263 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -507,7 +507,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 8214bd759b306f86d44a53b2aa07dc053f72f282..c7464ee5f29aa5ee0994fd4a352756a59055d9ee 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -582,7 +582,7 @@ public abstract class PlayerList { entityplayer.closeInventory(org.bukkit.event.inventory.InventoryCloseEvent.Reason.DISCONNECT); // Paper } diff --git a/Spigot-Server-Patches/0599-Seed-based-feature-search.patch b/Spigot-Server-Patches/0599-Seed-based-feature-search.patch index 9ebde8b0d3..6f11354e4c 100644 --- a/Spigot-Server-Patches/0599-Seed-based-feature-search.patch +++ b/Spigot-Server-Patches/0599-Seed-based-feature-search.patch @@ -32,23 +32,11 @@ index 424754a0183b071d20c86f0420cec784a8992e2b..a98e25917193043633e2120beb4fe2d4 public int maxCollisionsPerEntity; private void maxEntityCollision() { maxCollisionsPerEntity = getInt( "max-entity-collisions", this.spigotConfig.getInt("max-entity-collisions", 8) ); -diff --git a/src/main/java/net/minecraft/server/BiomeManager.java b/src/main/java/net/minecraft/server/BiomeManager.java -index 5c992812e0c066109763a30c9399e5b71a335398..fddcd205ee4d841546463913f56f998059cba248 100644 ---- a/src/main/java/net/minecraft/server/BiomeManager.java -+++ b/src/main/java/net/minecraft/server/BiomeManager.java -@@ -22,6 +22,7 @@ public class BiomeManager { - return new BiomeManager(worldchunkmanager, this.b, this.c); - } - -+ public BiomeBase getBiome(BlockPosition blockposition) { return a(blockposition); } // Paper - OBFHELPER - public BiomeBase a(BlockPosition blockposition) { - return this.c.a(this.b, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a); - } -diff --git a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -index dcaf9f8574a9c913b64ba3a1d8b02220db720225..271fddbbf73ca5c0e4e2722d7246c14b778d6072 100644 ---- a/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -+++ b/src/main/java/net/minecraft/server/ChunkCoordIntPair.java -@@ -67,10 +67,12 @@ public class ChunkCoordIntPair { +diff --git a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +index e41d63596c32eee5f0c04a6f043d576d8021ff1a..53eb5b65683a2ab208edfc3f3bbf78ffee61bc85 100644 +--- a/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java ++++ b/src/main/java/net/minecraft/world/level/ChunkCoordIntPair.java +@@ -68,10 +68,12 @@ public class ChunkCoordIntPair { } } @@ -61,11 +49,38 @@ index dcaf9f8574a9c913b64ba3a1d8b02220db720225..271fddbbf73ca5c0e4e2722d7246c14b public int e() { return this.z << 4; } -diff --git a/src/main/java/net/minecraft/server/StructureGenerator.java b/src/main/java/net/minecraft/server/StructureGenerator.java -index c3bd58069d8dbdf36f70f1dafd7c24000f31708b..a62c87bceab2c9700a7b3925f208b0ffa2b9b393 100644 ---- a/src/main/java/net/minecraft/server/StructureGenerator.java -+++ b/src/main/java/net/minecraft/server/StructureGenerator.java -@@ -143,6 +143,14 @@ public abstract class StructureGenerator +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index d14c38fbf7eb76dd7581c13258ee6832f5f70513..96d648bfef28417edac9298e892c191b0e8e24b8 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -1503,8 +1503,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { + return this.methodProfiler; + } + +- @Override +- public BiomeManager d() { ++ public BiomeManager getBiomeManager() { return d(); } // Paper - OBFHELPER ++ @Override public BiomeManager d() { + return this.biomeManager; + } + +diff --git a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java +index 340508e0ba8b8883a3037ecaa2d4e09e61e709d3..3b1d9b26ba3249b1df0c15a22428e4211ae0e024 100644 +--- a/src/main/java/net/minecraft/world/level/biome/BiomeManager.java ++++ b/src/main/java/net/minecraft/world/level/biome/BiomeManager.java +@@ -23,6 +23,7 @@ public class BiomeManager { + return new BiomeManager(worldchunkmanager, this.b, this.c); + } + ++ public BiomeBase getBiome(BlockPosition blockposition) { return a(blockposition); } // Paper - OBFHELPER + public BiomeBase a(BlockPosition blockposition) { + return this.c.a(this.b, blockposition.getX(), blockposition.getY(), blockposition.getZ(), this.a); + } +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +index ea7e3e15fa778c573d24f956f72f60579ea0b1a1..6df42ff26ff6e65ec2885122fe53dde857a3d1d2 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/StructureGenerator.java +@@ -176,6 +176,14 @@ public abstract class StructureGenerator int j2 = i1 + k * l1; ChunkCoordIntPair chunkcoordintpair = this.a(structuresettingsfeature, j, seededrandom, i2, j2); if (!iworldreader.getWorldBorder().isChunkInBounds(chunkcoordintpair.x, chunkcoordintpair.z)) { continue; } // Paper @@ -80,18 +95,3 @@ index c3bd58069d8dbdf36f70f1dafd7c24000f31708b..a62c87bceab2c9700a7b3925f208b0ff IChunkAccess ichunkaccess = iworldreader.getChunkAt(chunkcoordintpair.x, chunkcoordintpair.z, ChunkStatus.STRUCTURE_STARTS); StructureStart structurestart = structuremanager.a(SectionPosition.a(ichunkaccess.getPos(), 0), this, ichunkaccess); -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 23e5ad868f1acfb99ec313fbda9bb83a138ccf0b..179915312cd35845216a196018726345324614de 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -1451,8 +1451,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { - return this.methodProfiler; - } - -- @Override -- public BiomeManager d() { -+ public BiomeManager getBiomeManager() { return d(); } // Paper - OBFHELPER -+ @Override public BiomeManager d() { - return this.biomeManager; - } - diff --git a/Spigot-Server-Patches/0600-Add-Wandering-Trader-spawn-rate-config-options.patch b/Spigot-Server-Patches/0600-Add-Wandering-Trader-spawn-rate-config-options.patch index 6e55c3997f..68c326d6fd 100644 --- a/Spigot-Server-Patches/0600-Add-Wandering-Trader-spawn-rate-config-options.patch +++ b/Spigot-Server-Patches/0600-Add-Wandering-Trader-spawn-rate-config-options.patch @@ -32,11 +32,11 @@ index a98e25917193043633e2120beb4fe2d49d0e4500..b4d76494851601d61a69e2f060727a68 + wanderingTraderSpawnChanceMax = getInt("wandering-trader.spawn-chance-max", wanderingTraderSpawnChanceMax); + } } -diff --git a/src/main/java/net/minecraft/server/MobSpawnerTrader.java b/src/main/java/net/minecraft/server/MobSpawnerTrader.java -index 502cb0ea40b5df1962c5a6d4b57d34de9d413e7f..8d89f51182444852062d549d23c00a93e601eb38 100644 ---- a/src/main/java/net/minecraft/server/MobSpawnerTrader.java -+++ b/src/main/java/net/minecraft/server/MobSpawnerTrader.java -@@ -9,49 +9,59 @@ public class MobSpawnerTrader implements MobSpawner { +diff --git a/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java b/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java +index 0e878b4e4523ec6de9181c10157e4d89844292a4..8b5707df910cdc4d52dd5305f05322cc26683502 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java ++++ b/src/main/java/net/minecraft/world/entity/npc/MobSpawnerTrader.java +@@ -30,49 +30,59 @@ public class MobSpawnerTrader implements MobSpawner { private final Random a = new Random(); private final IWorldDataServer b; diff --git a/Spigot-Server-Patches/0601-Significantly-improve-performance-of-the-end-generat.patch b/Spigot-Server-Patches/0601-Significantly-improve-performance-of-the-end-generat.patch index 2b72893527..93801258a2 100644 --- a/Spigot-Server-Patches/0601-Significantly-improve-performance-of-the-end-generat.patch +++ b/Spigot-Server-Patches/0601-Significantly-improve-performance-of-the-end-generat.patch @@ -11,19 +11,19 @@ Co-authored-by: Gegy Co-authored-by: Dylan Xaldin Co-authored-by: pop4959 -diff --git a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -index 9c15cd303ccc2928be4e3e7080e74e8314d7e0f2..70924c2942f6cc668eb4d11afdb42a966bd5edc8 100644 ---- a/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -+++ b/src/main/java/net/minecraft/server/WorldChunkManagerTheEnd.java -@@ -3,6 +3,7 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java +index 1077972d694d604c3ec97d333d34a9ab81819c33..25ea3c46c7748bd0c3aa96ee3d3a22cccb6da5c0 100644 +--- a/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java ++++ b/src/main/java/net/minecraft/world/level/biome/WorldChunkManagerTheEnd.java +@@ -3,6 +3,7 @@ package net.minecraft.world.level.biome; import com.google.common.collect.ImmutableList; import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; +import it.unimi.dsi.fastutil.HashCommon; // Paper import java.util.List; - - public class WorldChunkManagerTheEnd extends WorldChunkManager { -@@ -22,6 +23,16 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { + import net.minecraft.core.IRegistry; + import net.minecraft.resources.RegistryLookupCodec; +@@ -27,6 +28,16 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { private final BiomeBase k; private final BiomeBase l; private final BiomeBase m; @@ -40,7 +40,7 @@ index 9c15cd303ccc2928be4e3e7080e74e8314d7e0f2..70924c2942f6cc668eb4d11afdb42a96 public WorldChunkManagerTheEnd(IRegistry iregistry, long i) { this(iregistry, i, (BiomeBase) iregistry.d(Biomes.THE_END), (BiomeBase) iregistry.d(Biomes.END_HIGHLANDS), (BiomeBase) iregistry.d(Biomes.END_MIDLANDS), (BiomeBase) iregistry.d(Biomes.SMALL_END_ISLANDS), (BiomeBase) iregistry.d(Biomes.END_BARRENS)); -@@ -76,13 +87,27 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { +@@ -81,13 +92,27 @@ public class WorldChunkManagerTheEnd extends WorldChunkManager { f = MathHelper.a(f, -100.0F, 80.0F); diff --git a/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch b/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch index b60be417e2..25e5003638 100644 --- a/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch +++ b/Spigot-Server-Patches/0602-Expose-world-spawn-angle.patch @@ -4,11 +4,11 @@ Date: Tue, 17 Nov 2020 19:13:09 +0200 Subject: [PATCH] Expose world spawn angle -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index a6a836c936a687d67c67d861c72addf319b44263..c4abe7bdc1a9b725166eff8b77c123dd832b3cf9 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -811,7 +811,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index c7464ee5f29aa5ee0994fd4a352756a59055d9ee..bd318c058a0a99472486d1c3eaf1f9fa2879aaf6 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -886,7 +886,7 @@ public abstract class PlayerList { if (location == null) { worldserver1 = this.server.getWorldServer(World.OVERWORLD); blockposition = entityplayer1.getSpawnPoint(worldserver1); @@ -17,11 +17,11 @@ index a6a836c936a687d67c67d861c72addf319b44263..c4abe7bdc1a9b725166eff8b77c123dd } Player respawnPlayer = cserver.getPlayer(entityplayer1); -diff --git a/src/main/java/net/minecraft/server/WorldData.java b/src/main/java/net/minecraft/server/WorldData.java -index faf931785ea35df4525d4a429bdb2363e26e491b..14e1762bf8669ef9e8444f5a73952daa50b3b19e 100644 ---- a/src/main/java/net/minecraft/server/WorldData.java -+++ b/src/main/java/net/minecraft/server/WorldData.java -@@ -8,6 +8,7 @@ public interface WorldData { +diff --git a/src/main/java/net/minecraft/world/level/storage/WorldData.java b/src/main/java/net/minecraft/world/level/storage/WorldData.java +index 81ad90ba93481decdfaa38fc9fa81bca0e402781..7599488f7d4b168c92078c2d2987cb38f0dee8a9 100644 +--- a/src/main/java/net/minecraft/world/level/storage/WorldData.java ++++ b/src/main/java/net/minecraft/world/level/storage/WorldData.java +@@ -12,6 +12,7 @@ public interface WorldData { int c(); @@ -30,10 +30,10 @@ index faf931785ea35df4525d4a429bdb2363e26e491b..14e1762bf8669ef9e8444f5a73952daa long getTime(); diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d7954f55061e677b00d27be4b8d0890af75a3aad..7e4bf999a4ccc798480d2b14559e0004c5c0eea6 100644 +index 82d478cfa296be9c8d19e8dbd8d3485443108e40..c64bd5725f287aebff60a86cafe86fac29016191 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -380,7 +380,7 @@ public class CraftWorld implements World { +@@ -378,7 +378,7 @@ public class CraftWorld implements World { @Override public Location getSpawnLocation() { BlockPosition spawn = world.getSpawn(); diff --git a/Spigot-Server-Patches/0603-Add-Destroy-Speed-API.patch b/Spigot-Server-Patches/0603-Add-Destroy-Speed-API.patch index a07652c66a..e98372723e 100644 --- a/Spigot-Server-Patches/0603-Add-Destroy-Speed-API.patch +++ b/Spigot-Server-Patches/0603-Add-Destroy-Speed-API.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Add Destroy Speed API Co-authored-by: Jake Potrebic diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java -index 3baf7b75c65c9beba40945ba904315251b5b7a64..83fe1f9f4f2ec6e1440575d621d836d5e968c790 100644 +index 44e1d80ec871142d3b498d3897d8ceb82452c1f2..a1ab9afb9bd2e714d8598013e0e66cc5fcbe371a 100644 --- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java +++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java @@ -757,5 +757,23 @@ public class CraftBlock implements Block { @@ -16,7 +16,7 @@ index 3baf7b75c65c9beba40945ba904315251b5b7a64..83fe1f9f4f2ec6e1440575d621d836d5 + + @Override + public float getDestroySpeed(ItemStack itemStack, boolean considerEnchants) { -+ net.minecraft.server.ItemStack nmsItemStack; ++ net.minecraft.world.item.ItemStack nmsItemStack; + if (itemStack instanceof CraftItemStack) { + nmsItemStack = ((CraftItemStack) itemStack).getHandle(); + } else { @@ -24,7 +24,7 @@ index 3baf7b75c65c9beba40945ba904315251b5b7a64..83fe1f9f4f2ec6e1440575d621d836d5 + } + float speed = nmsItemStack.getItem().getDestroySpeed(nmsItemStack, this.getNMSBlock().getBlockData()); + if (speed > 1.0F && considerEnchants) { -+ int enchantLevel = net.minecraft.server.EnchantmentManager.getEnchantmentLevel(net.minecraft.server.Enchantments.DIG_SPEED, nmsItemStack); ++ int enchantLevel = net.minecraft.world.item.enchantment.EnchantmentManager.getEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.DIG_SPEED, nmsItemStack); + if (enchantLevel > 0) { + speed += enchantLevel * enchantLevel + 1; + } diff --git a/Spigot-Server-Patches/0606-Add-PlayerItemCooldownEvent.patch b/Spigot-Server-Patches/0606-Add-PlayerItemCooldownEvent.patch index 1b1c12a357..81581680ce 100644 --- a/Spigot-Server-Patches/0606-Add-PlayerItemCooldownEvent.patch +++ b/Spigot-Server-Patches/0606-Add-PlayerItemCooldownEvent.patch @@ -4,12 +4,13 @@ Date: Tue, 25 Aug 2020 13:48:33 +0200 Subject: [PATCH] Add PlayerItemCooldownEvent -diff --git a/src/main/java/net/minecraft/server/ItemCooldownPlayer.java b/src/main/java/net/minecraft/server/ItemCooldownPlayer.java -index 27cde8c15576efab9a60b5741c1cd54ed4b04c6c..9da02cf0a9a1b396c2ff0f79fdd2e95003399817 100644 ---- a/src/main/java/net/minecraft/server/ItemCooldownPlayer.java -+++ b/src/main/java/net/minecraft/server/ItemCooldownPlayer.java -@@ -1,13 +1,25 @@ - package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java b/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java +index 5f70e39f4da2880a6f734a225be83061b00847c8..ef9ffad211473f1cbcd0b8fd200ff04ec2051f94 100644 +--- a/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java ++++ b/src/main/java/net/minecraft/world/item/ItemCooldownPlayer.java +@@ -3,14 +3,26 @@ package net.minecraft.world.item; + import net.minecraft.network.protocol.game.PacketPlayOutSetCooldown; + import net.minecraft.server.level.EntityPlayer; +import io.papermc.paper.event.player.PlayerItemCooldownEvent; // Paper + diff --git a/Spigot-Server-Patches/0607-More-lightning-API.patch b/Spigot-Server-Patches/0607-More-lightning-API.patch index f2349a1c5b..e08b3251e5 100644 --- a/Spigot-Server-Patches/0607-More-lightning-API.patch +++ b/Spigot-Server-Patches/0607-More-lightning-API.patch @@ -4,11 +4,11 @@ Date: Sun, 26 Jul 2020 14:44:09 +0200 Subject: [PATCH] More lightning API -diff --git a/src/main/java/net/minecraft/server/EntityLightning.java b/src/main/java/net/minecraft/server/EntityLightning.java -index 180bfd4a60e18723b5fbae96123001284658afcb..5200b0396ee41edb42ff727c78cf3b5fce091d6b 100644 ---- a/src/main/java/net/minecraft/server/EntityLightning.java -+++ b/src/main/java/net/minecraft/server/EntityLightning.java -@@ -11,7 +11,7 @@ public class EntityLightning extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLightning.java b/src/main/java/net/minecraft/world/entity/EntityLightning.java +index 834ced9d9b385c8f1d66355244313d62a97d9c98..85f571a791bce63989890f277857bc7bdeec0cb5 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLightning.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLightning.java +@@ -31,7 +31,7 @@ public class EntityLightning extends Entity { private int lifeTicks; public long b; @@ -17,7 +17,7 @@ index 180bfd4a60e18723b5fbae96123001284658afcb..5200b0396ee41edb42ff727c78cf3b5f public boolean isEffect; @Nullable private EntityPlayer f; -@@ -29,6 +29,16 @@ public class EntityLightning extends Entity { +@@ -49,6 +49,16 @@ public class EntityLightning extends Entity { this.isEffect = flag; } @@ -35,7 +35,7 @@ index 180bfd4a60e18723b5fbae96123001284658afcb..5200b0396ee41edb42ff727c78cf3b5f public SoundCategory getSoundCategory() { return SoundCategory.WEATHER; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java -index 988386a9a7fb23e24ab14254d53895f9606c94f3..8016f4c053cca2b015150b2fe735958bd7c7cf92 100644 +index 3e054592cef6526b769d14460a671ea78a5ef58a..395f702b14425d85ff3a7938c32f7bfd5523f3ca 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLightningStrike.java @@ -45,4 +45,27 @@ public class CraftLightningStrike extends CraftEntity implements LightningStrike diff --git a/Spigot-Server-Patches/0608-Climbing-should-not-bypass-cramming-gamerule.patch b/Spigot-Server-Patches/0608-Climbing-should-not-bypass-cramming-gamerule.patch index ba1084b034..055cbbcf49 100644 --- a/Spigot-Server-Patches/0608-Climbing-should-not-bypass-cramming-gamerule.patch +++ b/Spigot-Server-Patches/0608-Climbing-should-not-bypass-cramming-gamerule.patch @@ -18,11 +18,11 @@ index b4d76494851601d61a69e2f060727a68f4461267..6262246c4018c660705fbad028f297fc + fixClimbingBypassingCrammingRule = getBoolean("fix-climbing-bypassing-cramming-rule", fixClimbingBypassingCrammingRule); + } } -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index aa1807502131893f29be5918b533aabe83f87514..8e71f7a8b62d89f2d770b03b4730d3d030717bfd 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1483,6 +1483,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 8d37f9b3880d3e456b82f4a03197cf2868714e09..7ad4d20cd43ad100ab8a1987d061bb523fb66ea5 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1568,6 +1568,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean isCollidable() { @@ -35,63 +35,11 @@ index aa1807502131893f29be5918b533aabe83f87514..8e71f7a8b62d89f2d770b03b4730d3d0 return false; } -diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java -index 97425f38ac05c24433dc27c5cda74c36871d61a9..0ef9516fbe9283cb1aca71eb9dbdbec0d98c8fa4 100644 ---- a/src/main/java/net/minecraft/server/EntityArmorStand.java -+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java -@@ -327,7 +327,7 @@ public class EntityArmorStand extends EntityLiving { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return false; - } - -diff --git a/src/main/java/net/minecraft/server/EntityBat.java b/src/main/java/net/minecraft/server/EntityBat.java -index c1af257c1155d79ceff7211e1c37b4ddb9e1a19a..451ffcfd1fc9fa3091dc2bd697e5d829dcf6443f 100644 ---- a/src/main/java/net/minecraft/server/EntityBat.java -+++ b/src/main/java/net/minecraft/server/EntityBat.java -@@ -51,7 +51,7 @@ public class EntityBat extends EntityAmbient { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return false; - } - -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index 45fea38933d57e52dea19317c65682d57114a077..fdfdf83c28c3065fa89fba9e44b3da99f9791e0e 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -106,7 +106,7 @@ public class EntityBoat extends Entity { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return true; - } - -diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index 9ecad93e6464644fb147f3e2a770f29c0fe762c7..410578d7baf08db330b708a6c5517c4986258f97 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -@@ -166,7 +166,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return !this.isVehicle(); - } - -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index cac3138b98ad2df4b63c77edb16c6c0c3951487c..ac800f307dbf18d2fa074a95f1d32bab84cb6cbd 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -43,7 +43,6 @@ import org.bukkit.event.entity.EntityTeleportEvent; +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index f6f43ef74086bd963432a0f40e7e01b92387b437..ff7ece39d86cb01d8bfa3bdc7a0fdf3c9ae16c81 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -136,7 +136,6 @@ import org.bukkit.event.entity.EntityTeleportEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; // CraftBukkit end @@ -99,7 +47,7 @@ index cac3138b98ad2df4b63c77edb16c6c0c3951487c..ac800f307dbf18d2fa074a95f1d32bab public abstract class EntityLiving extends Entity { -@@ -2865,7 +2864,7 @@ public abstract class EntityLiving extends Entity { +@@ -2958,7 +2957,7 @@ public abstract class EntityLiving extends Entity { return; } // Paper - end don't run getEntities if we're not going to use its result @@ -108,7 +56,7 @@ index cac3138b98ad2df4b63c77edb16c6c0c3951487c..ac800f307dbf18d2fa074a95f1d32bab if (!list.isEmpty()) { // Paper - move up -@@ -3003,9 +3002,16 @@ public abstract class EntityLiving extends Entity { +@@ -3096,9 +3095,16 @@ public abstract class EntityLiving extends Entity { return !this.dead && this.collides; // CraftBukkit } @@ -126,39 +74,11 @@ index cac3138b98ad2df4b63c77edb16c6c0c3951487c..ac800f307dbf18d2fa074a95f1d32bab } // CraftBukkit start - collidable API -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index 9af2bb392881900d74803cccd093d96b08673a25..efe5c0cecaf12ef921f6d32ff6670eff051bf323 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -107,7 +107,7 @@ public abstract class EntityMinecartAbstract extends Entity { - } - - @Override -- public boolean isCollidable() { -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper - return true; - } - -diff --git a/src/main/java/net/minecraft/server/EntityParrot.java b/src/main/java/net/minecraft/server/EntityParrot.java -index 1c682a62b8fd871848ebe8ff0dc576da6bb28810..0af6c9395b5d98e6bfa162f651d0e8cb89035afd 100644 ---- a/src/main/java/net/minecraft/server/EntityParrot.java -+++ b/src/main/java/net/minecraft/server/EntityParrot.java -@@ -314,8 +314,8 @@ public class EntityParrot extends EntityPerchable implements EntityBird { - } - - @Override -- public boolean isCollidable() { -- return super.isCollidable(); // CraftBukkit - collidable API -+ public boolean isCollidable(boolean ignoreClimbing) { // Paper -+ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper - } - - @Override -diff --git a/src/main/java/net/minecraft/server/IEntitySelector.java b/src/main/java/net/minecraft/server/IEntitySelector.java -index 56fc1777401ab0fbebbbaf21f33f63c078dc9505..b5e1a860a2569d7668330827614d221b60f3fc78 100644 ---- a/src/main/java/net/minecraft/server/IEntitySelector.java -+++ b/src/main/java/net/minecraft/server/IEntitySelector.java -@@ -43,11 +43,17 @@ public final class IEntitySelector { +diff --git a/src/main/java/net/minecraft/world/entity/IEntitySelector.java b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +index 88ed99d0d08fb5f3fee605f8ed00004b466633bf..a7738f8bde558c9b161a4bde18a3a4311e35d5eb 100644 +--- a/src/main/java/net/minecraft/world/entity/IEntitySelector.java ++++ b/src/main/java/net/minecraft/world/entity/IEntitySelector.java +@@ -48,11 +48,17 @@ public final class IEntitySelector { } public static Predicate a(Entity entity) { @@ -177,3 +97,83 @@ index 56fc1777401ab0fbebbbaf21f33f63c078dc9505..b5e1a860a2569d7668330827614d221b return false; } else if (entity.world.isClientSide && (!(entity1 instanceof EntityHuman) || !((EntityHuman) entity1).ez())) { return false; +diff --git a/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java b/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java +index 2167590677c68d261b804a16853bd943f16a76dd..61ebb278cf4ef57ae7a86c6c6ef1fa14559f21e2 100644 +--- a/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java ++++ b/src/main/java/net/minecraft/world/entity/ambient/EntityBat.java +@@ -76,7 +76,7 @@ public class EntityBat extends EntityAmbient { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return false; + } + +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java b/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java +index e93375171462b95e270230f5f72f7eb5c6b0ff58..699dd0ac1f8d0d340ab1a560106336fc7cc95d5b 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityParrot.java +@@ -368,8 +368,8 @@ public class EntityParrot extends EntityPerchable implements EntityBird { + } + + @Override +- public boolean isCollidable() { +- return super.isCollidable(); // CraftBukkit - collidable API ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper ++ return super.isCollidable(ignoreClimbing); // CraftBukkit - collidable API // Paper + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +index d05391290dc11440aae5f38328a0530c500ac601..d678e3164ecdb7f0c600597bcb39d1054dfbc4b2 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +@@ -227,7 +227,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return !this.isVehicle(); + } + +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +index 6c5dc2ee5e720b574557ffbae539ec42dfbfe6cc..48071a938db4adca639e457682f0d03053f26442 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java +@@ -361,7 +361,7 @@ public class EntityArmorStand extends EntityLiving { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return false; + } + +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +index 25a6f53888293994a50128bcbcbb88ff141c5395..add2aef0192a3b3767c1e477145978b9702c0fb4 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +@@ -150,7 +150,7 @@ public class EntityBoat extends Entity { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return true; + } + +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +index 7d91e6b75a8a827853b0ca8e53b8ec19e2cf1092..2e3ceab3e34f7756764b3471b13d48d1263ecba9 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +@@ -145,7 +145,7 @@ public abstract class EntityMinecartAbstract extends Entity { + } + + @Override +- public boolean isCollidable() { ++ public boolean isCollidable(boolean ignoreClimbing) { // Paper + return true; + } + diff --git a/Spigot-Server-Patches/0610-Add-PlayerShearBlockEvent.patch b/Spigot-Server-Patches/0610-Add-PlayerShearBlockEvent.patch index efdfd6a4e8..d21d2e8cc1 100644 --- a/Spigot-Server-Patches/0610-Add-PlayerShearBlockEvent.patch +++ b/Spigot-Server-Patches/0610-Add-PlayerShearBlockEvent.patch @@ -4,11 +4,11 @@ Date: Thu, 27 Aug 2020 15:02:48 -0400 Subject: [PATCH] Add PlayerShearBlockEvent -diff --git a/src/main/java/net/minecraft/server/Block.java b/src/main/java/net/minecraft/server/Block.java -index 4b4f14711d483089a5d5478b57539911a9c7a2fc..1fc98698b81c079ebe4a524200232db1fe143bdf 100644 ---- a/src/main/java/net/minecraft/server/Block.java -+++ b/src/main/java/net/minecraft/server/Block.java -@@ -223,7 +223,7 @@ public class Block extends BlockBase implements IMaterial { +diff --git a/src/main/java/net/minecraft/world/level/block/Block.java b/src/main/java/net/minecraft/world/level/block/Block.java +index 768934fa4158a9773d06f5b23bfb19db75f6d179..596b4597313b87296d39027b13555b5ad1cba9e6 100644 +--- a/src/main/java/net/minecraft/world/level/block/Block.java ++++ b/src/main/java/net/minecraft/world/level/block/Block.java +@@ -262,7 +262,7 @@ public class Block extends BlockBase implements IMaterial { } @@ -17,19 +17,19 @@ index 4b4f14711d483089a5d5478b57539911a9c7a2fc..1fc98698b81c079ebe4a524200232db1 if (!world.isClientSide && !itemstack.isEmpty() && world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS)) { float f = 0.5F; double d0 = (double) (world.random.nextFloat() * 0.5F) + 0.25D; -diff --git a/src/main/java/net/minecraft/server/BlockBeehive.java b/src/main/java/net/minecraft/server/BlockBeehive.java -index 7e2c63e4731ac2d234d5f90eb80d314cdede07ca..eda45e7f2f824c42653d6c545172efc7c96ef332 100644 ---- a/src/main/java/net/minecraft/server/BlockBeehive.java -+++ b/src/main/java/net/minecraft/server/BlockBeehive.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockBeehive.java b/src/main/java/net/minecraft/world/level/block/BlockBeehive.java +index ff521e64384281fc88b78bb908d19049743cf63b..7ac696c6d91807ffdac5dd2bd4d60a0468417cc1 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockBeehive.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockBeehive.java @@ -1,5 +1,7 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts + import java.util.Iterator; import java.util.List; import java.util.Random; -@@ -74,8 +76,19 @@ public class BlockBeehive extends BlockTileEntity { +@@ -116,8 +118,19 @@ public class BlockBeehive extends BlockTileEntity { if (i >= 5) { if (itemstack.getItem() == Items.SHEARS) { @@ -50,19 +50,20 @@ index 7e2c63e4731ac2d234d5f90eb80d314cdede07ca..eda45e7f2f824c42653d6c545172efc7 itemstack.damage(1, entityhuman, (entityhuman1) -> { entityhuman1.broadcastItemBreak(enumhand); }); -diff --git a/src/main/java/net/minecraft/server/BlockPumpkin.java b/src/main/java/net/minecraft/server/BlockPumpkin.java -index 27a750209bc0312dd0f806b04089bcae030ea23e..dd33a093e759a85c9534c63d66831ebe4ef2270e 100644 ---- a/src/main/java/net/minecraft/server/BlockPumpkin.java -+++ b/src/main/java/net/minecraft/server/BlockPumpkin.java -@@ -1,5 +1,7 @@ - package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java b/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java +index 130b768ac7155c2960694dfa12163e46315f7797..18fcf2c40cdc9be0084e2caaecb64350bbbb6126 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPumpkin.java +@@ -15,6 +15,8 @@ import net.minecraft.world.level.block.state.BlockBase; + import net.minecraft.world.level.block.state.IBlockData; + import net.minecraft.world.phys.MovingObjectPositionBlock; +import io.papermc.paper.event.block.PlayerShearBlockEvent; // Paper - PlayerShearBlockEvent namespace conflicts + public class BlockPumpkin extends BlockStemmed { protected BlockPumpkin(BlockBase.Info blockbase_info) { -@@ -12,15 +14,26 @@ public class BlockPumpkin extends BlockStemmed { +@@ -27,15 +29,26 @@ public class BlockPumpkin extends BlockStemmed { if (itemstack.getItem() == Items.SHEARS) { if (!world.isClientSide) { diff --git a/Spigot-Server-Patches/0611-Add-warning-for-servers-not-running-on-Java-11.patch b/Spigot-Server-Patches/0611-Add-warning-for-servers-not-running-on-Java-11.patch index e1543bf9c0..5f27651600 100644 --- a/Spigot-Server-Patches/0611-Add-warning-for-servers-not-running-on-Java-11.patch +++ b/Spigot-Server-Patches/0611-Add-warning-for-servers-not-running-on-Java-11.patch @@ -59,10 +59,10 @@ index 0000000000000000000000000000000000000000..c6ea429819c07e7f4bc257cad73463a0 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 5a1c14eccf58c39aced52011c6e094c0a3c46cd9..c858e750018dcf5b1c19ee66d4173119b88101a1 100644 +index 8e5dcab795b1158e2ee957ac4532f5bdf00b6376..f5d21fd1dc74faa0414b793d8f146d2e6e4d3fd2 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -72,6 +72,7 @@ import org.bukkit.event.server.ServerLoadEvent; +@@ -179,6 +179,7 @@ import org.bukkit.event.server.ServerLoadEvent; import co.aikar.timings.MinecraftTimings; // Paper import org.spigotmc.SlackActivityAccountant; // Spigot @@ -70,7 +70,7 @@ index 5a1c14eccf58c39aced52011c6e094c0a3c46cd9..c858e750018dcf5b1c19ee66d4173119 public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { -@@ -956,6 +957,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 1.0D) { diff --git a/Spigot-Server-Patches/0615-Limit-recipe-packets.patch b/Spigot-Server-Patches/0615-Limit-recipe-packets.patch index 5452c1baeb..bd499de084 100644 --- a/Spigot-Server-Patches/0615-Limit-recipe-packets.patch +++ b/Spigot-Server-Patches/0615-Limit-recipe-packets.patch @@ -22,36 +22,26 @@ index 7d50aded88f5b7dfebaea1aebc86231f7b5c4e25..652d87fc5d566dba8018c81676329f0e public static boolean velocitySupport; public static boolean velocityOnlineMode; public static byte[] velocitySecretKey; -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 1f1baaa464459e06ac877ea3dcd1d30604ef8d88..741e338f55a63a5a097f2adc737b7e4cf9172555 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 54a72470275cce96f86fe1e7219f931b738c71ec..a55b196ffe0f6367f24bf7ea749252e48fbf2855 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.server.network; +import com.destroystokyo.paper.PaperConfig; import com.google.common.collect.Lists; import com.google.common.primitives.Doubles; import com.google.common.primitives.Floats; -@@ -21,7 +22,7 @@ import java.util.function.Consumer; - import java.util.stream.Collectors; - import java.util.stream.Stream; - import javax.annotation.Nullable; --import org.apache.commons.lang3.StringEscapeUtils; -+ - import org.apache.commons.lang3.StringUtils; - import org.apache.logging.log4j.LogManager; - import org.apache.logging.log4j.Logger; -@@ -31,6 +32,8 @@ import io.papermc.paper.adventure.ChatProcessor; // Paper - import io.papermc.paper.adventure.PaperAdventure; // Paper - import java.util.concurrent.ExecutionException; - import java.util.concurrent.atomic.AtomicIntegerFieldUpdater; -+ -+import org.bukkit.Bukkit; +@@ -175,6 +176,7 @@ import net.minecraft.world.inventory.InventoryClickType; + import net.minecraft.world.item.crafting.IRecipe; + import net.minecraft.world.level.RayTrace; + import net.minecraft.world.phys.MovingObjectPosition; ++import org.bukkit.Bukkit; // Paper import org.bukkit.Location; import org.bukkit.craftbukkit.entity.CraftPlayer; import org.bukkit.craftbukkit.event.CraftEventFactory; -@@ -87,6 +90,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -231,6 +233,7 @@ public class PlayerConnection implements PacketListenerPlayIn { private volatile int chatThrottle; private static final AtomicIntegerFieldUpdater chatSpamField = AtomicIntegerFieldUpdater.newUpdater(PlayerConnection.class, "chatThrottle"); private final java.util.concurrent.atomic.AtomicInteger tabSpamLimiter = new java.util.concurrent.atomic.AtomicInteger(); // Paper - configurable tab spam limits @@ -59,7 +49,7 @@ index 1f1baaa464459e06ac877ea3dcd1d30604ef8d88..741e338f55a63a5a097f2adc737b7e4c // CraftBukkit end private int j; private final Int2ShortMap k = new Int2ShortOpenHashMap(); -@@ -235,6 +239,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -379,6 +382,7 @@ public class PlayerConnection implements PacketListenerPlayIn { // CraftBukkit start for (int spam; (spam = this.chatThrottle) > 0 && !chatSpamField.compareAndSet(this, spam, spam - 1); ) ; if (tabSpamLimiter.get() > 0) tabSpamLimiter.getAndDecrement(); // Paper - split to seperate variable @@ -67,7 +57,7 @@ index 1f1baaa464459e06ac877ea3dcd1d30604ef8d88..741e338f55a63a5a097f2adc737b7e4c /* Use thread-safe field access instead if (this.chatThrottle > 0) { --this.chatThrottle; -@@ -2629,6 +2634,14 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2773,6 +2777,14 @@ public class PlayerConnection implements PacketListenerPlayIn { @Override public void a(PacketPlayInAutoRecipe packetplayinautorecipe) { diff --git a/Spigot-Server-Patches/0617-MC-4-Fix-item-position-desync.patch b/Spigot-Server-Patches/0617-MC-4-Fix-item-position-desync.patch index 27dba48eb9..abc309a820 100644 --- a/Spigot-Server-Patches/0617-MC-4-Fix-item-position-desync.patch +++ b/Spigot-Server-Patches/0617-MC-4-Fix-item-position-desync.patch @@ -22,11 +22,50 @@ index 652d87fc5d566dba8018c81676329f0e0bca471b..c56e7fb18f9a56c8025eb70a524f028b + fixEntityPositionDesync = getBoolean("settings.fix-entity-position-desync", fixEntityPositionDesync); + } } -diff --git a/src/main/java/net/minecraft/server/EntityItem.java b/src/main/java/net/minecraft/server/EntityItem.java -index 0e75d97254c73b2525380024b41a42f56d87b3a5..5dfb54e17fcfe6bd30e6b2a449944606e1a0ef17 100644 ---- a/src/main/java/net/minecraft/server/EntityItem.java -+++ b/src/main/java/net/minecraft/server/EntityItem.java -@@ -524,4 +524,16 @@ public class EntityItem extends Entity { +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java +index e80429368afced0299d9f41b97251cd6c64b1759..0eed10a6c4e0c7245f219d19ed1e2e5c94364db9 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutEntity.java +@@ -19,11 +19,11 @@ public class PacketPlayOutEntity implements Packet { + protected boolean i; + + public static long a(double d0) { +- return MathHelper.d(d0 * 4096.0D); ++ return MathHelper.d(d0 * 4096.0D); // Paper - check EntityItem#setPositionRaw on update + } + + public static Vec3D a(long i, long j, long k) { +- return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); ++ return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); // Paper - check EntityItem#setPositionRaw on update + } + + public PacketPlayOutEntity() {} +diff --git a/src/main/java/net/minecraft/util/MathHelper.java b/src/main/java/net/minecraft/util/MathHelper.java +index caa628417bb9c1c65b037e4f3f762b08272c6d09..cc566784c7dd21cc2c44e0f351347f657e57ddcf 100644 +--- a/src/main/java/net/minecraft/util/MathHelper.java ++++ b/src/main/java/net/minecraft/util/MathHelper.java +@@ -9,7 +9,7 @@ import net.minecraft.core.BaseBlockPosition; + public class MathHelper { + + public static final float a = c(2.0F); +- private static final float[] b = (float[]) SystemUtils.a((Object) (new float[65536]), (afloat) -> { ++ private static final float[] b = (float[]) SystemUtils.a((new float[65536]), (afloat) -> { // Paper - decompile error + for (int i = 0; i < afloat.length; ++i) { + afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D); + } +@@ -49,6 +49,7 @@ public class MathHelper { + return d0 < (double) i ? i - 1 : i; + } + ++ public static long floorLong(double d0) { return d(d0); } // Paper - OBFHELPER + public static long d(double d0) { + long i = (long) d0; + +diff --git a/src/main/java/net/minecraft/world/entity/item/EntityItem.java b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +index 11e029f6f97f1dd9c32e311d1a3800f2fa54b91f..575833807ff647f30d7c2b7abcd01701c7dec85b 100644 +--- a/src/main/java/net/minecraft/world/entity/item/EntityItem.java ++++ b/src/main/java/net/minecraft/world/entity/item/EntityItem.java +@@ -550,4 +550,16 @@ public class EntityItem extends Entity { public Packet P() { return new PacketPlayOutSpawnEntity(this); } @@ -43,42 +82,3 @@ index 0e75d97254c73b2525380024b41a42f56d87b3a5..5dfb54e17fcfe6bd30e6b2a449944606 + } + // Paper end - fix MC-4 } -diff --git a/src/main/java/net/minecraft/server/MathHelper.java b/src/main/java/net/minecraft/server/MathHelper.java -index 1731a1bca5ad02fd8cd8701f49c10cb74ee6f503..2e7721a650c5a351b3584665bd236f92ef577761 100644 ---- a/src/main/java/net/minecraft/server/MathHelper.java -+++ b/src/main/java/net/minecraft/server/MathHelper.java -@@ -7,7 +7,7 @@ import java.util.function.IntPredicate; - public class MathHelper { - - public static final float a = c(2.0F); -- private static final float[] b = (float[]) SystemUtils.a((Object) (new float[65536]), (afloat) -> { -+ private static final float[] b = (float[]) SystemUtils.a((new float[65536]), (afloat) -> { // Paper - decompile error - for (int i = 0; i < afloat.length; ++i) { - afloat[i] = (float) Math.sin((double) i * 3.141592653589793D * 2.0D / 65536.0D); - } -@@ -47,6 +47,7 @@ public class MathHelper { - return d0 < (double) i ? i - 1 : i; - } - -+ public static long floorLong(double d0) { return d(d0); } // Paper - OBFHELPER - public static long d(double d0) { - long i = (long) d0; - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -index e5da2b19c1177ba7f88f0aaad9d810bb313ce67b..8e48407fd405ac4c3eece7762b8155c5d0f00fa0 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutEntity.java -@@ -15,11 +15,11 @@ public class PacketPlayOutEntity implements Packet { - protected boolean i; - - public static long a(double d0) { -- return MathHelper.d(d0 * 4096.0D); -+ return MathHelper.d(d0 * 4096.0D); // Paper - check EntityItem#setPositionRaw on update - } - - public static Vec3D a(long i, long j, long k) { -- return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); -+ return (new Vec3D((double) i, (double) j, (double) k)).a(2.44140625E-4D); // Paper - check EntityItem#setPositionRaw on update - } - - public PacketPlayOutEntity() {} diff --git a/Spigot-Server-Patches/0618-Player-Chunk-Load-Unload-Events.patch b/Spigot-Server-Patches/0618-Player-Chunk-Load-Unload-Events.patch index 4f386ef568..c6958eeb3a 100644 --- a/Spigot-Server-Patches/0618-Player-Chunk-Load-Unload-Events.patch +++ b/Spigot-Server-Patches/0618-Player-Chunk-Load-Unload-Events.patch @@ -4,20 +4,20 @@ Date: Mon, 5 Oct 2020 21:25:16 +0200 Subject: [PATCH] Player Chunk Load/Unload Events -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index d58abb47c1a543eaf238569f27bf189322c22a93..3f480b6a419403536d87194525a82c5d3745963a 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -16,6 +16,8 @@ import java.util.OptionalInt; - import java.util.Random; - import java.util.UUID; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index 8fa8d2e1e85fa382af9e9d65322bd98a87a6e3a9..a2971272602f5c2556ccb46042926617138a1d55 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -136,6 +136,8 @@ import net.minecraft.world.scores.ScoreboardScore; + import net.minecraft.world.scores.ScoreboardTeam; + import net.minecraft.world.scores.ScoreboardTeamBase; + import net.minecraft.world.scores.criteria.IScoreboardCriteria; +import io.papermc.paper.event.packet.PlayerChunkLoadEvent; // Paper +import io.papermc.paper.event.packet.PlayerChunkUnloadEvent; // Paper import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; -@@ -1958,11 +1960,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +@@ -2085,11 +2087,21 @@ public class EntityPlayer extends EntityHuman implements ICrafting { public void a(ChunkCoordIntPair chunkcoordintpair, Packet packet, Packet packet1) { this.playerConnection.sendPacket(packet1); this.playerConnection.sendPacket(packet); diff --git a/Spigot-Server-Patches/0620-Expose-LivingEntity-hurt-direction.patch b/Spigot-Server-Patches/0620-Expose-LivingEntity-hurt-direction.patch index 16f4d832e5..11936bb787 100644 --- a/Spigot-Server-Patches/0620-Expose-LivingEntity-hurt-direction.patch +++ b/Spigot-Server-Patches/0620-Expose-LivingEntity-hurt-direction.patch @@ -4,11 +4,11 @@ Date: Sun, 13 Dec 2020 05:32:05 +0200 Subject: [PATCH] Expose LivingEntity hurt direction -diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java -index 2a1b17717b37e5f839e357c2196287a4024852e9..3c23a8ab3fe5e4b58816cf051dbe237530bff4a0 100644 ---- a/src/main/java/net/minecraft/server/EntityLiving.java -+++ b/src/main/java/net/minecraft/server/EntityLiving.java -@@ -69,7 +69,7 @@ public abstract class EntityLiving extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index ff7ece39d86cb01d8bfa3bdc7a0fdf3c9ae16c81..3a1eb1570f76f13d1633a24b7fa7ed448b705978 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java +@@ -162,7 +162,7 @@ public abstract class EntityLiving extends Entity { public int am; public int hurtTicks; public int hurtDuration; @@ -18,7 +18,7 @@ index 2a1b17717b37e5f839e357c2196287a4024852e9..3c23a8ab3fe5e4b58816cf051dbe2375 public float ar; public float as; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 1fc356d0b74c1cbb19bf7527088f1f61b6da5422..16e69cfd4994fd6850ee3635ea819379412351c9 100644 +index c665a1c48ac3a08b3b55909ce4e87827c8b668a5..07a8d184038231b5f1a9c112c978528aaf79f34b 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -815,5 +815,15 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0622-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch b/Spigot-Server-Patches/0622-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch index 59cef7f9df..3addc9816c 100644 --- a/Spigot-Server-Patches/0622-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch +++ b/Spigot-Server-Patches/0622-Do-not-crash-from-invalid-ingredient-lists-in-Villag.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Do not crash from invalid ingredient lists in VillagerAcquireTradeEvent -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index 790df2be9cbbc359ba354ed272dbf6dda71951f0..4620c36d568da12092a2f7cb067cbf7fd20bee94 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -246,7 +246,11 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +index a614f5d5817bf999aca0f0b50f343031c8168392..10067731e6289211cb11b2b368527a1c45603314 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +@@ -273,7 +273,11 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP Bukkit.getPluginManager().callEvent(event); } if (!event.isCancelled()) { diff --git a/Spigot-Server-Patches/0623-added-PlayerTradeEvent.patch b/Spigot-Server-Patches/0623-added-PlayerTradeEvent.patch index b7323d2f15..8b9bcb62c9 100644 --- a/Spigot-Server-Patches/0623-added-PlayerTradeEvent.patch +++ b/Spigot-Server-Patches/0623-added-PlayerTradeEvent.patch @@ -4,11 +4,11 @@ Date: Thu, 2 Jul 2020 16:12:10 -0700 Subject: [PATCH] added PlayerTradeEvent -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index 73ceb0f14610fe1d4d55542dad957b1fdf9f8e04..eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -25,7 +25,7 @@ import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 54d72f211b964a42009eb4d07060a35e3b91017a..7e608cc9ff4a03a6b1eac5c74c072ac5febc38c3 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -90,7 +90,7 @@ import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; public abstract class EntityInsentient extends EntityLiving { private static final DataWatcherObject b = DataWatcher.a(EntityInsentient.class, DataWatcherRegistry.a); @@ -17,7 +17,7 @@ index 73ceb0f14610fe1d4d55542dad957b1fdf9f8e04..eb5c3a1f0d9ff665631caf5bf579e83d protected int f; protected ControllerLook lookController; protected ControllerMove moveController; -@@ -227,6 +227,7 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -292,6 +292,7 @@ public abstract class EntityInsentient extends EntityLiving { this.datawatcher.register(EntityInsentient.b, (byte) 0); } @@ -25,11 +25,11 @@ index 73ceb0f14610fe1d4d55542dad957b1fdf9f8e04..eb5c3a1f0d9ff665631caf5bf579e83d public int D() { return 80; } -diff --git a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -index 4620c36d568da12092a2f7cb067cbf7fd20bee94..e0cc45a7494cd6f06169b64ee8ffc16aa1932f8f 100644 ---- a/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityVillagerAbstract.java -@@ -12,6 +12,9 @@ import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; +diff --git a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +index 10067731e6289211cb11b2b368527a1c45603314..49821f0f26864c35be84a4a4288857a04668fbba 100644 +--- a/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/npc/EntityVillagerAbstract.java +@@ -39,6 +39,9 @@ import org.bukkit.craftbukkit.inventory.CraftMerchantRecipe; import org.bukkit.entity.AbstractVillager; import org.bukkit.event.entity.VillagerAcquireTradeEvent; // CraftBukkit end @@ -39,7 +39,7 @@ index 4620c36d568da12092a2f7cb067cbf7fd20bee94..e0cc45a7494cd6f06169b64ee8ffc16a public abstract class EntityVillagerAbstract extends EntityAgeable implements NPC, IMerchant { -@@ -108,16 +111,27 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP +@@ -135,16 +138,27 @@ public abstract class EntityVillagerAbstract extends EntityAgeable implements NP @Override public void a(MerchantRecipe merchantrecipe) { diff --git a/Spigot-Server-Patches/0624-Implement-TargetHitEvent.patch b/Spigot-Server-Patches/0624-Implement-TargetHitEvent.patch index 54c7b64a21..eebdc5aa97 100644 --- a/Spigot-Server-Patches/0624-Implement-TargetHitEvent.patch +++ b/Spigot-Server-Patches/0624-Implement-TargetHitEvent.patch @@ -4,18 +4,18 @@ Date: Wed, 25 Nov 2020 23:20:44 -0800 Subject: [PATCH] Implement TargetHitEvent -diff --git a/src/main/java/net/minecraft/server/BlockTarget.java b/src/main/java/net/minecraft/server/BlockTarget.java -index 23b298577d8a60ca241abc228732f66ebbe7a7b1..642d7c14bc404d94c8a4f551b984fe235a3816eb 100644 ---- a/src/main/java/net/minecraft/server/BlockTarget.java -+++ b/src/main/java/net/minecraft/server/BlockTarget.java +diff --git a/src/main/java/net/minecraft/world/level/block/BlockTarget.java b/src/main/java/net/minecraft/world/level/block/BlockTarget.java +index c336490815dc17991d3d84d8c6f0fc58571a3e3a..a9316ce8eb3d8a645f4c0e41ac668a90f584c263 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockTarget.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockTarget.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.world.level.block; +import io.papermc.paper.event.block.TargetHitEvent; // Paper - Need to import because 'io' class exists in nms import java.util.Random; - - public class BlockTarget extends Block { -@@ -14,6 +15,10 @@ public class BlockTarget extends Block { + import net.minecraft.advancements.CriterionTriggers; + import net.minecraft.core.BlockPosition; +@@ -34,6 +35,10 @@ public class BlockTarget extends Block { @Override public void a(World world, IBlockData iblockdata, MovingObjectPositionBlock movingobjectpositionblock, IProjectile iprojectile) { int i = a((GeneratorAccess) world, iblockdata, movingobjectpositionblock, (Entity) iprojectile); @@ -26,7 +26,7 @@ index 23b298577d8a60ca241abc228732f66ebbe7a7b1..642d7c14bc404d94c8a4f551b984fe23 Entity entity = iprojectile.getShooter(); if (entity instanceof EntityPlayer) { -@@ -29,6 +34,20 @@ public class BlockTarget extends Block { +@@ -49,6 +54,20 @@ public class BlockTarget extends Block { int i = a(movingobjectpositionblock, movingobjectpositionblock.getPos()); int j = entity instanceof EntityArrow ? 20 : 8; diff --git a/Spigot-Server-Patches/0626-Fix-harming-potion-dupe.patch b/Spigot-Server-Patches/0626-Fix-harming-potion-dupe.patch index d1ba3f68e9..9e87ac725f 100644 --- a/Spigot-Server-Patches/0626-Fix-harming-potion-dupe.patch +++ b/Spigot-Server-Patches/0626-Fix-harming-potion-dupe.patch @@ -7,11 +7,11 @@ EntityLiving#applyInstantEffect() immediately kills the player and drops their i Before this patch, instant effects would be applied before the potion ItemStack is removed and replaced with a glass bottle. This caused the potion ItemStack to be dropped before it was supposed to be removed from the inventory. It also caused the glass bottle to be put into a dead player's inventory. This patch makes it so that instant effects are applied after the potion ItemStack is removed, and the glass bottle is only put into the player's inventory if the player is not dead. Otherwise, the glass bottle is dropped on the ground. -diff --git a/src/main/java/net/minecraft/server/ItemPotion.java b/src/main/java/net/minecraft/server/ItemPotion.java -index 7862b63a245222d9a3d0896bdb2741b0e5e7ac40..d4389768963f40cb7b4bca950631d9f50f634543 100644 ---- a/src/main/java/net/minecraft/server/ItemPotion.java -+++ b/src/main/java/net/minecraft/server/ItemPotion.java -@@ -22,6 +22,7 @@ public class ItemPotion extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemPotion.java b/src/main/java/net/minecraft/world/item/ItemPotion.java +index b197fe561ab735e80d8bf29ac16eacfaf3fc2d21..d2ec88d23c945504bb8a0bb57281c04409740636 100644 +--- a/src/main/java/net/minecraft/world/item/ItemPotion.java ++++ b/src/main/java/net/minecraft/world/item/ItemPotion.java +@@ -36,6 +36,7 @@ public class ItemPotion extends Item { CriterionTriggers.z.a((EntityPlayer) entityhuman, itemstack); } @@ -19,7 +19,7 @@ index 7862b63a245222d9a3d0896bdb2741b0e5e7ac40..d4389768963f40cb7b4bca950631d9f5 if (!world.isClientSide) { List list = PotionUtil.getEffects(itemstack); Iterator iterator = list.iterator(); -@@ -30,7 +31,7 @@ public class ItemPotion extends Item { +@@ -44,7 +45,7 @@ public class ItemPotion extends Item { MobEffect mobeffect = (MobEffect) iterator.next(); if (mobeffect.getMobEffect().isInstant()) { @@ -28,7 +28,7 @@ index 7862b63a245222d9a3d0896bdb2741b0e5e7ac40..d4389768963f40cb7b4bca950631d9f5 } else { entityliving.addEffect(new MobEffect(mobeffect), org.bukkit.event.entity.EntityPotionEffectEvent.Cause.POTION_DRINK); // CraftBukkit } -@@ -44,7 +45,20 @@ public class ItemPotion extends Item { +@@ -58,7 +59,20 @@ public class ItemPotion extends Item { } } diff --git a/Spigot-Server-Patches/0627-Implement-API-to-get-Material-from-Boats-and-Minecar.patch b/Spigot-Server-Patches/0627-Implement-API-to-get-Material-from-Boats-and-Minecar.patch index b81088c718..02569905c0 100644 --- a/Spigot-Server-Patches/0627-Implement-API-to-get-Material-from-Boats-and-Minecar.patch +++ b/Spigot-Server-Patches/0627-Implement-API-to-get-Material-from-Boats-and-Minecar.patch @@ -4,11 +4,11 @@ Date: Thu, 31 Dec 2020 12:48:19 +1000 Subject: [PATCH] Implement API to get Material from Boats and Minecarts -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index fdfdf83c28c3065fa89fba9e44b3da99f9791e0e..da84cf98022b771bdf0c9d0b284aa7d4d59318e0 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -216,6 +216,7 @@ public class EntityBoat extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +index add2aef0192a3b3767c1e477145978b9702c0fb4..2609b83573e0e8532e6c4c36d4f475bf0da6a354 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +@@ -260,6 +260,7 @@ public class EntityBoat extends Entity { } @@ -17,17 +17,17 @@ index fdfdf83c28c3065fa89fba9e44b3da99f9791e0e..da84cf98022b771bdf0c9d0b284aa7d4 switch (this.getType()) { case OAK: diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java -index 271950903e8541194e4f6447f0d2aaae63920678..4a994dacd57bb4630b9c5645c084726045d64bcd 100644 +index c7a459c0c860724ef1890b8fb9a59a5508b3f6d6..16799dc565c5ca42d1fdb3122594d9dae21c74e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftBoat.java @@ -1,8 +1,10 @@ package org.bukkit.craftbukkit.entity; - import net.minecraft.server.EntityBoat; -+import org.bukkit.Material; + import net.minecraft.world.entity.vehicle.EntityBoat; ++import org.bukkit.Material; // Paper import org.bukkit.TreeSpecies; import org.bukkit.craftbukkit.CraftServer; -+import org.bukkit.craftbukkit.util.CraftMagicNumbers; ++import org.bukkit.craftbukkit.util.CraftMagicNumbers; // Paper import org.bukkit.entity.Boat; import org.bukkit.entity.EntityType; @@ -46,27 +46,28 @@ index 271950903e8541194e4f6447f0d2aaae63920678..4a994dacd57bb4630b9c5645c0847260 public EntityBoat getHandle() { return (EntityBoat) entity; diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java -index d23f994f579bdd34e15703cc11bdd36572841146..52b4b15b2003f19f605e98a99396d1baedfe5f42 100644 +index 69415f5a838345826fa5cf1d855e057794520f2c..e5ebb80a44da775df6f3d5a9db5cf58295e2e960 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java -@@ -3,6 +3,9 @@ package org.bukkit.craftbukkit.entity; - import net.minecraft.server.Blocks; - import net.minecraft.server.EntityMinecartAbstract; - import net.minecraft.server.IBlockData; -+import net.minecraft.server.Item; -+import net.minecraft.server.Items; -+import org.bukkit.Material; +@@ -1,8 +1,10 @@ + package org.bukkit.craftbukkit.entity; + + import net.minecraft.world.entity.vehicle.EntityMinecartAbstract; ++import net.minecraft.world.item.Items; // Paper + import net.minecraft.world.level.block.Blocks; + import net.minecraft.world.level.block.state.IBlockData; ++import org.bukkit.Material; // Paper import org.bukkit.block.data.BlockData; import org.bukkit.craftbukkit.CraftServer; import org.bukkit.craftbukkit.block.data.CraftBlockData; -@@ -68,6 +71,38 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { +@@ -68,6 +70,38 @@ public abstract class CraftMinecart extends CraftVehicle implements Minecart { getHandle().setDerailedVelocityMod(derailed); } + // Paper start + @Override + public Material getMinecartMaterial() { -+ Item minecartItem; ++ net.minecraft.world.item.Item minecartItem; + switch (getHandle().getMinecartType()) { + case CHEST: + minecartItem = Items.CHEST_MINECART; diff --git a/Spigot-Server-Patches/0628-Optimized-tick-ready-check.patch b/Spigot-Server-Patches/0628-Optimized-tick-ready-check.patch index 5fb3151791..319236d158 100644 --- a/Spigot-Server-Patches/0628-Optimized-tick-ready-check.patch +++ b/Spigot-Server-Patches/0628-Optimized-tick-ready-check.patch @@ -4,11 +4,11 @@ Date: Sun, 27 Dec 2020 17:19:51 +0100 Subject: [PATCH] Optimized tick ready check -diff --git a/src/main/java/net/minecraft/server/World.java b/src/main/java/net/minecraft/server/World.java -index 179915312cd35845216a196018726345324614de..f5ab99156ce5429e63976183cbf115d5340a83a1 100644 ---- a/src/main/java/net/minecraft/server/World.java -+++ b/src/main/java/net/minecraft/server/World.java -@@ -794,13 +794,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +diff --git a/src/main/java/net/minecraft/world/level/World.java b/src/main/java/net/minecraft/world/level/World.java +index 96d648bfef28417edac9298e892c191b0e8e24b8..9b32c6bb4df50bd00fe26adeb9f0cfe62b80c3e0 100644 +--- a/src/main/java/net/minecraft/world/level/World.java ++++ b/src/main/java/net/minecraft/world/level/World.java +@@ -846,13 +846,13 @@ public abstract class World implements GeneratorAccess, AutoCloseable { if (!tileentity.isRemoved() && tileentity.hasWorld()) { BlockPosition blockposition = tileentity.getPosition(); @@ -24,7 +24,7 @@ index 179915312cd35845216a196018726345324614de..f5ab99156ce5429e63976183cbf115d5 ((ITickable) tileentity).tick(); } else { tileentity.w(); -@@ -833,9 +833,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -885,9 +885,11 @@ public abstract class World implements GeneratorAccess, AutoCloseable { this.tileEntityListTick.remove(tileTickPosition--); // Spigot end //this.tileEntityList.remove(tileentity); // Paper - remove unused list @@ -38,7 +38,7 @@ index 179915312cd35845216a196018726345324614de..f5ab99156ce5429e63976183cbf115d5 } } -@@ -854,8 +856,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { +@@ -906,8 +908,8 @@ public abstract class World implements GeneratorAccess, AutoCloseable { } // CraftBukkit end */ diff --git a/Spigot-Server-Patches/0629-Cache-burn-durations.patch b/Spigot-Server-Patches/0629-Cache-burn-durations.patch index 6e375f5922..1c9afd6350 100644 --- a/Spigot-Server-Patches/0629-Cache-burn-durations.patch +++ b/Spigot-Server-Patches/0629-Cache-burn-durations.patch @@ -4,18 +4,18 @@ Date: Sun, 27 Dec 2020 16:47:00 +0100 Subject: [PATCH] Cache burn durations -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index abc76807595611d35c86f500ef1ef51159e9406b..eb6aa82c3c25928070475815288ec215938322c7 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +index e630e8d3e115d2a0177849ad8258a2304b9d3e9d..54316a8079b4331a48cac3c43f3f8c506a4af091 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java @@ -1,5 +1,6 @@ - package net.minecraft.server; + package net.minecraft.world.level.block.entity; +import com.google.common.collect.ImmutableMap; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import it.unimi.dsi.fastutil.objects.Object2IntMap.Entry; -@@ -84,7 +85,15 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -113,7 +114,15 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I this.c = recipes; } @@ -31,7 +31,7 @@ index abc76807595611d35c86f500ef1ef51159e9406b..eb6aa82c3c25928070475815288ec215 Map map = Maps.newLinkedHashMap(); a(map, (IMaterial) Items.LAVA_BUCKET, 20000); -@@ -147,7 +156,10 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -176,7 +185,10 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I a(map, (IMaterial) Blocks.FLETCHING_TABLE, 300); a(map, (IMaterial) Blocks.SMITHING_TABLE, 300); a(map, (IMaterial) Blocks.COMPOSTER, 300); @@ -43,7 +43,7 @@ index abc76807595611d35c86f500ef1ef51159e9406b..eb6aa82c3c25928070475815288ec215 } // CraftBukkit start - add fields and methods -@@ -401,7 +413,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -430,7 +442,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I } else { Item item = itemstack.getItem(); @@ -52,7 +52,7 @@ index abc76807595611d35c86f500ef1ef51159e9406b..eb6aa82c3c25928070475815288ec215 } } -@@ -414,7 +426,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +@@ -443,7 +455,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I // Paper end public static boolean isFuel(ItemStack itemstack) { diff --git a/Spigot-Server-Patches/0630-Allow-disabling-mob-spawner-spawn-egg-transformation.patch b/Spigot-Server-Patches/0630-Allow-disabling-mob-spawner-spawn-egg-transformation.patch index 80c845e172..5a7b73fbca 100644 --- a/Spigot-Server-Patches/0630-Allow-disabling-mob-spawner-spawn-egg-transformation.patch +++ b/Spigot-Server-Patches/0630-Allow-disabling-mob-spawner-spawn-egg-transformation.patch @@ -18,11 +18,11 @@ index 9ebe8771c2d5e843756868824740ef599ca8455f..a555d040fdc58f7c89ef78e3e6851916 + disableMobSpawnerSpawnEggTransformation = getBoolean("game-mechanics.disable-mob-spawner-spawn-egg-transformation", disableMobSpawnerSpawnEggTransformation); + } } -diff --git a/src/main/java/net/minecraft/server/ItemMonsterEgg.java b/src/main/java/net/minecraft/server/ItemMonsterEgg.java -index 76c585299096ab3719bf23b32f1ce046202a9818..a236e0441fc20270b4c44ed5a7d5b94297949226 100644 ---- a/src/main/java/net/minecraft/server/ItemMonsterEgg.java -+++ b/src/main/java/net/minecraft/server/ItemMonsterEgg.java -@@ -34,7 +34,7 @@ public class ItemMonsterEgg extends Item { +diff --git a/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java b/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java +index c170d2141504d80624e3c1a7f78f7968ea8a80ee..4d965e504a40eb52777575df839856c825a0900a 100644 +--- a/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java ++++ b/src/main/java/net/minecraft/world/item/ItemMonsterEgg.java +@@ -60,7 +60,7 @@ public class ItemMonsterEgg extends Item { EnumDirection enumdirection = itemactioncontext.getClickedFace(); IBlockData iblockdata = world.getType(blockposition); diff --git a/Spigot-Server-Patches/0631-Implement-PlayerFlowerPotManipulateEvent.patch b/Spigot-Server-Patches/0631-Implement-PlayerFlowerPotManipulateEvent.patch index 7214037a02..43503c58f0 100644 --- a/Spigot-Server-Patches/0631-Implement-PlayerFlowerPotManipulateEvent.patch +++ b/Spigot-Server-Patches/0631-Implement-PlayerFlowerPotManipulateEvent.patch @@ -4,20 +4,20 @@ Date: Tue, 13 Aug 2019 19:45:06 -0700 Subject: [PATCH] Implement PlayerFlowerPotManipulateEvent -diff --git a/src/main/java/net/minecraft/server/BlockFlowerPot.java b/src/main/java/net/minecraft/server/BlockFlowerPot.java -index d776277e89d8faa500749f38e0ea79b4a7a7bc35..c2b3d73c6477f4137f6d2724f9e629939a8e5177 100644 ---- a/src/main/java/net/minecraft/server/BlockFlowerPot.java -+++ b/src/main/java/net/minecraft/server/BlockFlowerPot.java -@@ -3,6 +3,8 @@ package net.minecraft.server; - import com.google.common.collect.Maps; - import java.util.Map; +diff --git a/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java b/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java +index a61d1ffeebfd00a5fcd5faf95200b0640da8ea82..18fefad056d92a6fa498ab3764cd391446c26b60 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockFlowerPot.java +@@ -21,6 +21,8 @@ import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.shapes.VoxelShape; + import net.minecraft.world.phys.shapes.VoxelShapeCollision; +import io.papermc.paper.event.player.PlayerFlowerPotManipulateEvent; // Paper + public class BlockFlowerPot extends Block { private static final Map b = Maps.newHashMap(); -@@ -34,6 +36,27 @@ public class BlockFlowerPot extends Block { +@@ -52,6 +54,27 @@ public class BlockFlowerPot extends Block { boolean flag1 = this.c == Blocks.AIR; if (flag != flag1) { diff --git a/Spigot-Server-Patches/0632-Fix-interact-event-not-being-called-in-adventure.patch b/Spigot-Server-Patches/0632-Fix-interact-event-not-being-called-in-adventure.patch index 74d1b61ea8..5bde5191d7 100644 --- a/Spigot-Server-Patches/0632-Fix-interact-event-not-being-called-in-adventure.patch +++ b/Spigot-Server-Patches/0632-Fix-interact-event-not-being-called-in-adventure.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Fix interact event not being called in adventure Call PlayerInteractEvent when left-clicking on a block in adventure mode -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index 741e338f55a63a5a097f2adc737b7e4cf9172555..f3679a3ad2d51612381bc47bb23eeffec924d478 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1556,7 +1556,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index a55b196ffe0f6367f24bf7ea749252e48fbf2855..3da824081892a2ab9071351b77150b42915742d0 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1699,7 +1699,7 @@ public class PlayerConnection implements PacketListenerPlayIn { IChatMutableComponent ichatmutablecomponent = (new ChatMessage("build.tooHigh", new Object[]{this.minecraftServer.getMaxBuildHeight()})).a(EnumChatFormat.RED); this.player.playerConnection.sendPacket(new PacketPlayOutChat(ichatmutablecomponent, ChatMessageType.GAME_INFO, SystemUtils.b)); @@ -18,7 +18,7 @@ index 741e338f55a63a5a097f2adc737b7e4cf9172555..f3679a3ad2d51612381bc47bb23eeffe this.player.swingHand(enumhand, true); } } -@@ -2057,7 +2057,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +@@ -2200,7 +2200,7 @@ public class PlayerConnection implements PacketListenerPlayIn { Vec3D vec3d1 = vec3d.add((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); MovingObjectPosition movingobjectposition = this.player.world.rayTrace(new RayTrace(vec3d, vec3d1, RayTrace.BlockCollisionOption.OUTLINE, RayTrace.FluidCollisionOption.NONE, player)); diff --git a/Spigot-Server-Patches/0633-Zombie-API-breaking-doors.patch b/Spigot-Server-Patches/0633-Zombie-API-breaking-doors.patch index 82081e7914..da61412550 100644 --- a/Spigot-Server-Patches/0633-Zombie-API-breaking-doors.patch +++ b/Spigot-Server-Patches/0633-Zombie-API-breaking-doors.patch @@ -4,11 +4,11 @@ Date: Wed, 18 Nov 2020 11:32:46 -0800 Subject: [PATCH] Zombie API - breaking doors -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 3e0b12fef4e0aa5bf8a9b905b829e2a305a53d12..88ccf77e0e124f64391f415a6e26d1187fade59e 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -78,10 +78,12 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index 87acbdee03edf8bc35f4b3bcb9b82855ed4a3c33..5b0c79d752d616e5824393968136f3844ce52c22 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -140,10 +140,12 @@ public class EntityZombie extends EntityMonster { return (Boolean) this.getDataWatcher().get(EntityZombie.DROWN_CONVERTING); } @@ -22,7 +22,7 @@ index 3e0b12fef4e0aa5bf8a9b905b829e2a305a53d12..88ccf77e0e124f64391f415a6e26d118 if (this.eK() && PathfinderGoalUtil.a(this)) { if (this.bs != flag) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java -index d334e656ea0f442a14864a05d4701df162487851..7fc71fad484502ad0e9c6c6f6b32aaaf7599a6dd 100644 +index 42d98d798bb8fe2d3c7cc2bfcf2ec38d97d99bd2..e1589ef97222f5e29a3628db354d4406a443a613 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftZombie.java @@ -129,6 +129,16 @@ public class CraftZombie extends CraftMonster implements Zombie { diff --git a/Spigot-Server-Patches/0634-Fix-nerfed-slime-when-splitting.patch b/Spigot-Server-Patches/0634-Fix-nerfed-slime-when-splitting.patch index 6b8de05d95..875960eb0b 100644 --- a/Spigot-Server-Patches/0634-Fix-nerfed-slime-when-splitting.patch +++ b/Spigot-Server-Patches/0634-Fix-nerfed-slime-when-splitting.patch @@ -4,11 +4,11 @@ Date: Mon, 24 Aug 2020 08:39:06 -0700 Subject: [PATCH] Fix nerfed slime when splitting -diff --git a/src/main/java/net/minecraft/server/EntitySlime.java b/src/main/java/net/minecraft/server/EntitySlime.java -index 60818e1a7ce9c637bef8dc05de8cba10975ffc79..80fab9290479f876fd78997c1bd55fe6b00aac45 100644 ---- a/src/main/java/net/minecraft/server/EntitySlime.java -+++ b/src/main/java/net/minecraft/server/EntitySlime.java -@@ -207,6 +207,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +index 40e39e382092b1a8f831da0cea1557a781c98600..0af0b232ff1b6f1d58cf3fb543d32bd108be0af7 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntitySlime.java +@@ -246,6 +246,7 @@ public class EntitySlime extends EntityInsentient implements IMonster { entityslime.setPersistent(); } diff --git a/Spigot-Server-Patches/0635-Add-EntityLoadCrossbowEvent.patch b/Spigot-Server-Patches/0635-Add-EntityLoadCrossbowEvent.patch index 82f277001b..5e9ae2150b 100644 --- a/Spigot-Server-Patches/0635-Add-EntityLoadCrossbowEvent.patch +++ b/Spigot-Server-Patches/0635-Add-EntityLoadCrossbowEvent.patch @@ -4,22 +4,20 @@ Date: Wed, 7 Oct 2020 12:04:01 -0400 Subject: [PATCH] Add EntityLoadCrossbowEvent -diff --git a/src/main/java/net/minecraft/server/ItemCrossbow.java b/src/main/java/net/minecraft/server/ItemCrossbow.java -index 14c0e7382292b3d39858d4d957df8016c301c712..ac60163117a52ea97b710fc93552dd1699e8a092 100644 ---- a/src/main/java/net/minecraft/server/ItemCrossbow.java -+++ b/src/main/java/net/minecraft/server/ItemCrossbow.java -@@ -1,6 +1,10 @@ - package net.minecraft.server; - +diff --git a/src/main/java/net/minecraft/world/item/ItemCrossbow.java b/src/main/java/net/minecraft/world/item/ItemCrossbow.java +index ec6c0836f02e7ac5b72fd224a3022a844dce55cb..4e1e819c8535e8a6b9aa5f76afe568ea171b939f 100644 +--- a/src/main/java/net/minecraft/world/item/ItemCrossbow.java ++++ b/src/main/java/net/minecraft/world/item/ItemCrossbow.java +@@ -3,6 +3,8 @@ package net.minecraft.world.item; import com.google.common.collect.Lists; -+ -+import org.bukkit.inventory.EquipmentSlot; -+ + import com.mojang.math.Quaternion; + import com.mojang.math.Vector3fa; ++import org.bukkit.inventory.EquipmentSlot; // Paper +import io.papermc.paper.event.entity.EntityLoadCrossbowEvent; // Paper - EntityLoadCrossbowEvent namespace conflicts import java.util.List; import java.util.Random; import java.util.function.Predicate; -@@ -50,7 +54,11 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable +@@ -73,7 +75,11 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable int j = this.e_(itemstack) - i; float f = a(j, itemstack); @@ -32,7 +30,7 @@ index 14c0e7382292b3d39858d4d957df8016c301c712..ac60163117a52ea97b710fc93552dd16 a(itemstack, true); SoundCategory soundcategory = entityliving instanceof EntityHuman ? SoundCategory.PLAYERS : SoundCategory.HOSTILE; -@@ -59,10 +67,13 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable +@@ -82,10 +88,13 @@ public class ItemCrossbow extends ItemProjectileWeapon implements ItemVanishable } diff --git a/Spigot-Server-Patches/0636-Guardian-beam-workaround.patch b/Spigot-Server-Patches/0636-Guardian-beam-workaround.patch index 39b005875d..4439204159 100644 --- a/Spigot-Server-Patches/0636-Guardian-beam-workaround.patch +++ b/Spigot-Server-Patches/0636-Guardian-beam-workaround.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Guardian beam workaround This patch is a workaround for MC-165595 -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -index 88c3d7efaf467c1c1487f589c2cdbfb6aba734ec..1b9b43ee696575d986c25cafec07d863acb951a7 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutUpdateTime.java -@@ -4,7 +4,7 @@ import java.io.IOException; +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java +index a69e60a8934493f6786ce3d425f6dccb6e4befdd..3086ee023685781d94e2fb99fc8dff5264f01165 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutUpdateTime.java +@@ -6,7 +6,7 @@ import net.minecraft.network.protocol.Packet; public class PacketPlayOutUpdateTime implements Packet { @@ -18,7 +18,7 @@ index 88c3d7efaf467c1c1487f589c2cdbfb6aba734ec..1b9b43ee696575d986c25cafec07d863 private long b; public PacketPlayOutUpdateTime() {} -@@ -19,6 +19,9 @@ public class PacketPlayOutUpdateTime implements Packet { +@@ -21,6 +21,9 @@ public class PacketPlayOutUpdateTime implements Packet { } } diff --git a/Spigot-Server-Patches/0637-Added-WorldGameRuleChangeEvent.patch b/Spigot-Server-Patches/0637-Added-WorldGameRuleChangeEvent.patch index 252c57480c..1df8311984 100644 --- a/Spigot-Server-Patches/0637-Added-WorldGameRuleChangeEvent.patch +++ b/Spigot-Server-Patches/0637-Added-WorldGameRuleChangeEvent.patch @@ -4,11 +4,11 @@ Date: Sun, 20 Dec 2020 16:41:44 -0800 Subject: [PATCH] Added WorldGameRuleChangeEvent -diff --git a/src/main/java/net/minecraft/server/CommandGamerule.java b/src/main/java/net/minecraft/server/CommandGamerule.java -index 1ae60aae1d2017226c1f3ea39148d24aaf40cdde..f8ce9be8527111786c233c98e45f6d8fe183c70e 100644 ---- a/src/main/java/net/minecraft/server/CommandGamerule.java -+++ b/src/main/java/net/minecraft/server/CommandGamerule.java -@@ -27,7 +27,7 @@ public class CommandGamerule { +diff --git a/src/main/java/net/minecraft/server/commands/CommandGamerule.java b/src/main/java/net/minecraft/server/commands/CommandGamerule.java +index 5b5c5d1299c267f620f5c59873b261a7b7e382a9..feebe4812ff7aec17a50cb5f2789fe88e10a5032 100644 +--- a/src/main/java/net/minecraft/server/commands/CommandGamerule.java ++++ b/src/main/java/net/minecraft/server/commands/CommandGamerule.java +@@ -31,7 +31,7 @@ public class CommandGamerule { CommandListenerWrapper commandlistenerwrapper = (CommandListenerWrapper) commandcontext.getSource(); T t0 = commandlistenerwrapper.getWorld().getGameRules().get(gamerules_gamerulekey); // CraftBukkit @@ -17,19 +17,19 @@ index 1ae60aae1d2017226c1f3ea39148d24aaf40cdde..f8ce9be8527111786c233c98e45f6d8f commandlistenerwrapper.sendMessage(new ChatMessage("commands.gamerule.set", new Object[]{gamerules_gamerulekey.a(), t0.toString()}), true); return t0.getIntValue(); } -diff --git a/src/main/java/net/minecraft/server/GameRules.java b/src/main/java/net/minecraft/server/GameRules.java -index b245428604e2a432fa3bab4836a5ca1fb35c3f64..53b40f8947c9380ef57ecc7edca203c5bc894013 100644 ---- a/src/main/java/net/minecraft/server/GameRules.java -+++ b/src/main/java/net/minecraft/server/GameRules.java -@@ -18,6 +18,7 @@ import java.util.function.Supplier; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/GameRules.java b/src/main/java/net/minecraft/world/level/GameRules.java +index 276c28170b2a177dab6b2a0d5425044cd9f8df22..3783f3a83e3e70d77cf0fa1021f62a89c5950af5 100644 +--- a/src/main/java/net/minecraft/world/level/GameRules.java ++++ b/src/main/java/net/minecraft/world/level/GameRules.java +@@ -25,6 +25,7 @@ import net.minecraft.server.MinecraftServer; + import net.minecraft.server.level.EntityPlayer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import io.papermc.paper.event.world.WorldGameRuleChangeEvent; // Paper public class GameRules { -@@ -170,8 +171,11 @@ public class GameRules { +@@ -177,8 +178,11 @@ public class GameRules { } @Override @@ -43,7 +43,7 @@ index b245428604e2a432fa3bab4836a5ca1fb35c3f64..53b40f8947c9380ef57ecc7edca203c5 } public boolean a() { -@@ -230,8 +234,11 @@ public class GameRules { +@@ -237,8 +241,11 @@ public class GameRules { } @Override @@ -57,7 +57,7 @@ index b245428604e2a432fa3bab4836a5ca1fb35c3f64..53b40f8947c9380ef57ecc7edca203c5 } public int a() { -@@ -284,10 +291,12 @@ public class GameRules { +@@ -291,10 +298,12 @@ public class GameRules { this.a = gamerules_gameruledefinition; } @@ -74,10 +74,10 @@ index b245428604e2a432fa3bab4836a5ca1fb35c3f64..53b40f8947c9380ef57ecc7edca203c5 } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index 7e4bf999a4ccc798480d2b14559e0004c5c0eea6..d9b683264da17ba65409e2b976c885875fe09c89 100644 +index c64bd5725f287aebff60a86cafe86fac29016191..04ab5f395c565e998478564fd5b3081457317537 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2364,8 +2364,13 @@ public class CraftWorld implements World { +@@ -2362,8 +2362,13 @@ public class CraftWorld implements World { if (!isGameRule(rule)) return false; @@ -92,7 +92,7 @@ index 7e4bf999a4ccc798480d2b14559e0004c5c0eea6..d9b683264da17ba65409e2b976c88587 handle.onChange(getHandle().getMinecraftServer()); return true; } -@@ -2400,8 +2405,12 @@ public class CraftWorld implements World { +@@ -2398,8 +2403,12 @@ public class CraftWorld implements World { if (!isGameRule(rule.getName())) return false; diff --git a/Spigot-Server-Patches/0638-Added-ServerResourcesReloadedEvent.patch b/Spigot-Server-Patches/0638-Added-ServerResourcesReloadedEvent.patch index fb17c537bf..fe6a6a35c7 100644 --- a/Spigot-Server-Patches/0638-Added-ServerResourcesReloadedEvent.patch +++ b/Spigot-Server-Patches/0638-Added-ServerResourcesReloadedEvent.patch @@ -4,12 +4,56 @@ Date: Wed, 2 Dec 2020 20:04:01 -0800 Subject: [PATCH] Added ServerResourcesReloadedEvent -diff --git a/src/main/java/net/minecraft/server/CommandReload.java b/src/main/java/net/minecraft/server/CommandReload.java -index 08e472b71cf85b854eaa831881577ce2c3c03b11..4558147a51be6713c11bda6a60fd5ca3a953c096 100644 ---- a/src/main/java/net/minecraft/server/CommandReload.java -+++ b/src/main/java/net/minecraft/server/CommandReload.java -@@ -6,13 +6,14 @@ import java.util.Collection; - import java.util.Iterator; +diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java +index f5d21fd1dc74faa0414b793d8f146d2e6e4d3fd2..d7f52ceaca74d5db239d0c6ac151b0ba184bb58c 100644 +--- a/src/main/java/net/minecraft/server/MinecraftServer.java ++++ b/src/main/java/net/minecraft/server/MinecraftServer.java +@@ -2,9 +2,6 @@ package net.minecraft.server; + + import com.google.common.base.Splitter; + import com.google.common.collect.ImmutableList; +-import co.aikar.timings.Timings; +-import com.destroystokyo.paper.event.server.PaperServerListPingEvent; +-import com.google.common.base.Stopwatch; + import com.google.common.collect.Lists; + import com.google.common.collect.Maps; + import com.google.common.collect.Sets; +@@ -180,6 +177,7 @@ import org.bukkit.event.server.ServerLoadEvent; + import co.aikar.timings.MinecraftTimings; // Paper + import org.spigotmc.SlackActivityAccountant; // Spigot + import io.papermc.paper.util.PaperJvmChecker; // Paper ++import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper + + public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { + +@@ -1922,7 +1920,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant a(Collection collection) { ++ return this.reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.PLUGIN); ++ } ++ public CompletableFuture reloadServerResources(Collection collection, ServerResourcesReloadedEvent.Cause cause) { ++ // Paper end + CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { + Stream stream = collection.stream(); // CraftBukkit - decompile error + ResourcePackRepository resourcepackrepository = this.resourcePackRepository; +@@ -1938,6 +1942,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant collection = resourcepackrepository.d(); Collection collection1 = a(resourcepackrepository, savedata, collection); @@ -33,56 +77,3 @@ index 08e472b71cf85b854eaa831881577ce2c3c03b11..4558147a51be6713c11bda6a60fd5ca3 } // CraftBukkit end -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index c858e750018dcf5b1c19ee66d4173119b88101a1..20f44f9952d94aebc64b3ccd9271592bb0890735 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -2,9 +2,6 @@ package net.minecraft.server; - - import com.google.common.base.Splitter; - import com.google.common.collect.ImmutableList; --import co.aikar.timings.Timings; --import com.destroystokyo.paper.event.server.PaperServerListPingEvent; --import com.google.common.base.Stopwatch; - import com.google.common.collect.Lists; - import com.google.common.collect.Maps; - import com.google.common.collect.Sets; -@@ -64,15 +61,13 @@ import com.mojang.serialization.Lifecycle; - import com.google.common.collect.ImmutableSet; - // import jline.console.ConsoleReader; // Paper - import joptsimple.OptionSet; --import org.bukkit.Bukkit; --import org.bukkit.craftbukkit.CraftServer; --import org.bukkit.craftbukkit.Main; - import org.bukkit.event.server.ServerLoadEvent; - // CraftBukkit end - - import co.aikar.timings.MinecraftTimings; // Paper - import org.spigotmc.SlackActivityAccountant; // Spigot - import io.papermc.paper.util.PaperJvmChecker; // Paper -+import io.papermc.paper.event.server.ServerResourcesReloadedEvent; // Paper - - public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant implements IMojangStatistics, ICommandListener, AutoCloseable { - -@@ -1815,7 +1810,13 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant a(Collection collection) { -+ return this.reloadServerResources(collection, ServerResourcesReloadedEvent.Cause.PLUGIN); -+ } -+ public CompletableFuture reloadServerResources(Collection collection, ServerResourcesReloadedEvent.Cause cause) { -+ // Paper end - CompletableFuture completablefuture = CompletableFuture.supplyAsync(() -> { - Stream stream = collection.stream(); // CraftBukkit - decompile error - ResourcePackRepository resourcepackrepository = this.resourcePackRepository; -@@ -1831,6 +1832,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant= 100) { j = i - 100; -@@ -63,11 +65,25 @@ public class ContainerLectern extends Container { +@@ -69,11 +71,25 @@ public class ContainerLectern extends Container { switch (i) { case 1: j = this.containerProperties.getProperty(0); diff --git a/Spigot-Server-Patches/0642-Fire-event-on-GS4-query.patch b/Spigot-Server-Patches/0642-Fire-event-on-GS4-query.patch index d2e19f98b9..2a2a9ffee5 100644 --- a/Spigot-Server-Patches/0642-Fire-event-on-GS4-query.patch +++ b/Spigot-Server-Patches/0642-Fire-event-on-GS4-query.patch @@ -4,11 +4,43 @@ Date: Sun, 17 Mar 2019 21:46:56 +0200 Subject: [PATCH] Fire event on GS4 query -diff --git a/src/main/java/net/minecraft/server/RemoteStatusListener.java b/src/main/java/net/minecraft/server/RemoteStatusListener.java -index 98bca890b7cc77200f69394e2ba7e0eabf188127..abae8aefe2cf793dd1db2b478207856cdf24fdb0 100644 ---- a/src/main/java/net/minecraft/server/RemoteStatusListener.java -+++ b/src/main/java/net/minecraft/server/RemoteStatusListener.java -@@ -22,18 +22,18 @@ public class RemoteStatusListener extends RemoteConnectionThread { +diff --git a/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java b/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java +index 57ff3db0a0199ef03045b880e598407886b0306b..1b6761f75d97c49b1bf1ce3db631b7250c9489bd 100644 +--- a/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java ++++ b/src/main/java/net/minecraft/server/rcon/RemoteStatusReply.java +@@ -18,15 +18,27 @@ public class RemoteStatusReply { + this.b.write(abyte, 0, abyte.length); + } + ++ public void writeString(String string) throws IOException { this.a(string); } // Paper - OBFHELPER + public void a(String s) throws IOException { + this.b.writeBytes(s); + this.b.write(0); + } ++ // Paper start - unchecked exception variant to use in Stream API ++ public void writeStringUnchecked(String string) { ++ try { ++ writeString(string); ++ } catch (IOException e) { ++ com.destroystokyo.paper.util.SneakyThrow.sneaky(e); ++ } ++ } ++ // Paper end + ++ public void writeInt(int i) throws IOException { this.a(i); } // Paper - OBFHELPER + public void a(int i) throws IOException { + this.b.write(i); + } + ++ public void writeShort(short i) throws IOException { this.a(i); } // Paper - OBFHELPER + public void a(short short0) throws IOException { + this.b.writeShort(Short.reverseBytes(short0)); + } +diff --git a/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java b/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java +index 55b379af2e0c8c3513a76a346d381cd3dbcabe40..4dc3b388c0e2d89f1e0bc2199794a3fa2532b7a0 100644 +--- a/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java ++++ b/src/main/java/net/minecraft/server/rcon/thread/RemoteStatusListener.java +@@ -26,18 +26,18 @@ public class RemoteStatusListener extends RemoteConnectionThread { private static final Logger LOGGER = LogManager.getLogger(); private long e; private final int f; @@ -34,7 +66,7 @@ index 98bca890b7cc77200f69394e2ba7e0eabf188127..abae8aefe2cf793dd1db2b478207856c private RemoteStatusListener(IMinecraftServer iminecraftserver, int i) { super("Query Listener"); -@@ -103,6 +103,7 @@ public class RemoteStatusListener extends RemoteConnectionThread { +@@ -107,6 +107,7 @@ public class RemoteStatusListener extends RemoteConnectionThread { remotestatusreply.a((int) 0); remotestatusreply.a(this.a(datagrampacket.getSocketAddress())); @@ -42,7 +74,7 @@ index 98bca890b7cc77200f69394e2ba7e0eabf188127..abae8aefe2cf793dd1db2b478207856c remotestatusreply.a(this.i); remotestatusreply.a("SMP"); remotestatusreply.a(this.j); -@@ -110,6 +111,31 @@ public class RemoteStatusListener extends RemoteConnectionThread { +@@ -114,6 +115,31 @@ public class RemoteStatusListener extends RemoteConnectionThread { remotestatusreply.a(Integer.toString(this.h)); remotestatusreply.a((short) this.g); remotestatusreply.a(this.m); @@ -74,7 +106,7 @@ index 98bca890b7cc77200f69394e2ba7e0eabf188127..abae8aefe2cf793dd1db2b478207856c this.a(remotestatusreply.a(), datagrampacket); RemoteStatusListener.LOGGER.debug("Status [{}]", socketaddress); } -@@ -146,6 +172,7 @@ public class RemoteStatusListener extends RemoteConnectionThread { +@@ -150,6 +176,7 @@ public class RemoteStatusListener extends RemoteConnectionThread { this.p.a("splitnum"); this.p.a((int) 128); this.p.a((int) 0); @@ -82,7 +114,7 @@ index 98bca890b7cc77200f69394e2ba7e0eabf188127..abae8aefe2cf793dd1db2b478207856c this.p.a("hostname"); this.p.a(this.i); this.p.a("gametype"); -@@ -181,6 +208,79 @@ public class RemoteStatusListener extends RemoteConnectionThread { +@@ -185,6 +212,79 @@ public class RemoteStatusListener extends RemoteConnectionThread { } this.p.a((int) 0); @@ -162,35 +194,3 @@ index 98bca890b7cc77200f69394e2ba7e0eabf188127..abae8aefe2cf793dd1db2b478207856c return this.p.a(); } } -diff --git a/src/main/java/net/minecraft/server/RemoteStatusReply.java b/src/main/java/net/minecraft/server/RemoteStatusReply.java -index 848b5c3f0e00f32d565dc5a241e17fa6d152ae8d..73efea7e1354df306c0eadfc52b75ec8ed9883d9 100644 ---- a/src/main/java/net/minecraft/server/RemoteStatusReply.java -+++ b/src/main/java/net/minecraft/server/RemoteStatusReply.java -@@ -18,15 +18,27 @@ public class RemoteStatusReply { - this.b.write(abyte, 0, abyte.length); - } - -+ public void writeString(String string) throws IOException { this.a(string); } // Paper - OBFHELPER - public void a(String s) throws IOException { - this.b.writeBytes(s); - this.b.write(0); - } -+ // Paper start - unchecked exception variant to use in Stream API -+ public void writeStringUnchecked(String string) { -+ try { -+ writeString(string); -+ } catch (IOException e) { -+ com.destroystokyo.paper.util.SneakyThrow.sneaky(e); -+ } -+ } -+ // Paper end - -+ public void writeInt(int i) throws IOException { this.a(i); } // Paper - OBFHELPER - public void a(int i) throws IOException { - this.b.write(i); - } - -+ public void writeShort(short i) throws IOException { this.a(i); } // Paper - OBFHELPER - public void a(short short0) throws IOException { - this.b.writeShort(Short.reverseBytes(short0)); - } diff --git a/Spigot-Server-Patches/0643-Added-PlayerLoomPatternSelectEvent.patch b/Spigot-Server-Patches/0643-Added-PlayerLoomPatternSelectEvent.patch index c71bc8eeb2..c6d4f6121a 100644 --- a/Spigot-Server-Patches/0643-Added-PlayerLoomPatternSelectEvent.patch +++ b/Spigot-Server-Patches/0643-Added-PlayerLoomPatternSelectEvent.patch @@ -4,11 +4,11 @@ Date: Wed, 25 Nov 2020 16:33:27 -0800 Subject: [PATCH] Added PlayerLoomPatternSelectEvent -diff --git a/src/main/java/net/minecraft/server/ContainerLoom.java b/src/main/java/net/minecraft/server/ContainerLoom.java -index 1fe21ca13a1eecb64cb2d3f4f18993e181d26ae2..f8f380d9ccf3a9672ec66290bae3ca9ecf7f606a 100644 ---- a/src/main/java/net/minecraft/server/ContainerLoom.java -+++ b/src/main/java/net/minecraft/server/ContainerLoom.java -@@ -6,6 +6,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryLoom; +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java +index 7980930cc712e37a788f894bf2d2ee2b1cfc1196..5e5367710d43fc421806bda31cd611a9cb5869f3 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerLoom.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerLoom.java +@@ -22,6 +22,7 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryLoom; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.entity.Player; // CraftBukkit end @@ -16,7 +16,7 @@ index 1fe21ca13a1eecb64cb2d3f4f18993e181d26ae2..f8f380d9ccf3a9672ec66290bae3ca9e public class ContainerLoom extends Container { -@@ -25,7 +26,7 @@ public class ContainerLoom extends Container { +@@ -41,7 +42,7 @@ public class ContainerLoom extends Container { } // CraftBukkit end private final ContainerAccess containerAccess; @@ -25,7 +25,7 @@ index 1fe21ca13a1eecb64cb2d3f4f18993e181d26ae2..f8f380d9ccf3a9672ec66290bae3ca9e private Runnable e; private final Slot f; private final Slot g; -@@ -144,7 +145,22 @@ public class ContainerLoom extends Container { +@@ -160,7 +161,22 @@ public class ContainerLoom extends Container { @Override public boolean a(EntityHuman entityhuman, int i) { if (i > 0 && i <= EnumBannerPatternType.R) { @@ -49,11 +49,11 @@ index 1fe21ca13a1eecb64cb2d3f4f18993e181d26ae2..f8f380d9ccf3a9672ec66290bae3ca9e this.j(); return true; } else { -diff --git a/src/main/java/net/minecraft/server/EnumBannerPatternType.java b/src/main/java/net/minecraft/server/EnumBannerPatternType.java -index 22488b533c09f7a9d8a50414d368b62d21c29b1f..775e74effbf8a900951f63ab3ee8d5d055902e35 100644 ---- a/src/main/java/net/minecraft/server/EnumBannerPatternType.java -+++ b/src/main/java/net/minecraft/server/EnumBannerPatternType.java -@@ -30,6 +30,7 @@ public enum EnumBannerPatternType { +diff --git a/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java b/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java +index 988e52c675dbb5ef368c8dbb5fb6d4229eb30174..9bc27e727d11d4ac9055a0bc02d8a2ef606ff9c4 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/EnumBannerPatternType.java +@@ -33,6 +33,7 @@ public enum EnumBannerPatternType { this.T = flag; } diff --git a/Spigot-Server-Patches/0644-Configurable-door-breaking-difficulty.patch b/Spigot-Server-Patches/0644-Configurable-door-breaking-difficulty.patch index 77322d2521..96a4f24a85 100644 --- a/Spigot-Server-Patches/0644-Configurable-door-breaking-difficulty.patch +++ b/Spigot-Server-Patches/0644-Configurable-door-breaking-difficulty.patch @@ -57,11 +57,11 @@ index c42e5d9f9c9f67988383c4c25123d8a629ede9e3..c5495e02c3fe271b26f62ea2ec64e079 + ); + } } -diff --git a/src/main/java/net/minecraft/server/EntityVindicator.java b/src/main/java/net/minecraft/server/EntityVindicator.java -index c0d26aa9dcd02c44d744b10e18609857ada95889..4761ddfedeed54e79788a6f60f06a805efd60ab1 100644 ---- a/src/main/java/net/minecraft/server/EntityVindicator.java -+++ b/src/main/java/net/minecraft/server/EntityVindicator.java -@@ -8,6 +8,7 @@ import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +index c45dcb56af95f3e87e292b92b697a336461f01bc..f0eda0b83bab8e3a8adbb569b5997402b0e08e9a 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityVindicator.java +@@ -48,6 +48,7 @@ import net.minecraft.world.level.WorldAccess; public class EntityVindicator extends EntityIllagerAbstract { @@ -69,7 +69,7 @@ index c0d26aa9dcd02c44d744b10e18609857ada95889..4761ddfedeed54e79788a6f60f06a805 private static final Predicate b = (enumdifficulty) -> { return enumdifficulty == EnumDifficulty.NORMAL || enumdifficulty == EnumDifficulty.HARD; }; -@@ -164,7 +165,7 @@ public class EntityVindicator extends EntityIllagerAbstract { +@@ -204,7 +205,7 @@ public class EntityVindicator extends EntityIllagerAbstract { static class a extends PathfinderGoalBreakDoor { public a(EntityInsentient entityinsentient) { @@ -78,11 +78,11 @@ index c0d26aa9dcd02c44d744b10e18609857ada95889..4761ddfedeed54e79788a6f60f06a805 this.a(EnumSet.of(PathfinderGoal.Type.MOVE)); } -diff --git a/src/main/java/net/minecraft/server/EntityZombie.java b/src/main/java/net/minecraft/server/EntityZombie.java -index 6a1f6a6257546226f3c37d60d98a11ead42615b8..c081dfa775dc93afd96eff88953c9a5f21f2adb9 100644 ---- a/src/main/java/net/minecraft/server/EntityZombie.java -+++ b/src/main/java/net/minecraft/server/EntityZombie.java -@@ -24,6 +24,7 @@ public class EntityZombie extends EntityMonster { +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +index fb98609a38d665659076b8949b59eaf084408a17..634416c354184bc6a2348c27c55e9868009ccd28 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityZombie.java +@@ -86,6 +86,7 @@ public class EntityZombie extends EntityMonster { private static final DataWatcherObject d = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); private static final DataWatcherObject bo = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.b); public static final DataWatcherObject DROWN_CONVERTING = DataWatcher.a(EntityZombie.class, DataWatcherRegistry.i); @@ -90,7 +90,7 @@ index 6a1f6a6257546226f3c37d60d98a11ead42615b8..c081dfa775dc93afd96eff88953c9a5f private static final Predicate bq = (enumdifficulty) -> { return enumdifficulty == EnumDifficulty.HARD; }; -@@ -36,7 +37,7 @@ public class EntityZombie extends EntityMonster { +@@ -98,7 +99,7 @@ public class EntityZombie extends EntityMonster { public EntityZombie(EntityTypes entitytypes, World world) { super(entitytypes, world); diff --git a/Spigot-Server-Patches/0645-Empty-commands-shall-not-be-dispatched.patch b/Spigot-Server-Patches/0645-Empty-commands-shall-not-be-dispatched.patch index a3ff7a3ef6..1d69ef963b 100644 --- a/Spigot-Server-Patches/0645-Empty-commands-shall-not-be-dispatched.patch +++ b/Spigot-Server-Patches/0645-Empty-commands-shall-not-be-dispatched.patch @@ -4,11 +4,11 @@ Date: Wed, 6 Jan 2021 23:38:43 +0100 Subject: [PATCH] Empty commands shall not be dispatched -diff --git a/src/main/java/net/minecraft/server/CommandDispatcher.java b/src/main/java/net/minecraft/server/CommandDispatcher.java -index 22d748008d24fd6ed7cd8c4914e2ceb378f32c95..e56ff365118c50486f36cb15a4ca062c5a481674 100644 ---- a/src/main/java/net/minecraft/server/CommandDispatcher.java -+++ b/src/main/java/net/minecraft/server/CommandDispatcher.java -@@ -139,6 +139,7 @@ public class CommandDispatcher { +diff --git a/src/main/java/net/minecraft/commands/CommandDispatcher.java b/src/main/java/net/minecraft/commands/CommandDispatcher.java +index 77d3712390125601d964519c3df9928ea3a7caf0..9d37d0c4af89469421dbdf47075612288cfa17c9 100644 +--- a/src/main/java/net/minecraft/commands/CommandDispatcher.java ++++ b/src/main/java/net/minecraft/commands/CommandDispatcher.java +@@ -222,6 +222,7 @@ public class CommandDispatcher { command = event.getCommand(); String[] args = command.split(" "); diff --git a/Spigot-Server-Patches/0646-Implement-API-to-expose-exact-interaction-point.patch b/Spigot-Server-Patches/0646-Implement-API-to-expose-exact-interaction-point.patch index 7dbbd8af2f..5d0786b1e8 100644 --- a/Spigot-Server-Patches/0646-Implement-API-to-expose-exact-interaction-point.patch +++ b/Spigot-Server-Patches/0646-Implement-API-to-expose-exact-interaction-point.patch @@ -4,11 +4,11 @@ Date: Mon, 4 Jan 2021 16:40:27 +1000 Subject: [PATCH] Implement API to expose exact interaction point -diff --git a/src/main/java/net/minecraft/server/PlayerInteractManager.java b/src/main/java/net/minecraft/server/PlayerInteractManager.java -index 3bae1c39bf122cec88a481b18c01c3d32d6eb747..d57784c5dd44cc110b7c863ffff82263178e7d9a 100644 ---- a/src/main/java/net/minecraft/server/PlayerInteractManager.java -+++ b/src/main/java/net/minecraft/server/PlayerInteractManager.java -@@ -462,7 +462,7 @@ public class PlayerInteractManager { +diff --git a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +index 86d1a7625bb3016093ee8a46f91fd657d8bc2546..6ac3cf976205ea939e2a124bf9699e650eafe79f 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerInteractManager.java ++++ b/src/main/java/net/minecraft/server/level/PlayerInteractManager.java +@@ -492,7 +492,7 @@ public class PlayerInteractManager { cancelledBlock = true; } @@ -18,22 +18,18 @@ index 3bae1c39bf122cec88a481b18c01c3d32d6eb747..d57784c5dd44cc110b7c863ffff82263 interactResult = event.useItemInHand() == Event.Result.DENY; interactPosition = blockposition.immutableCopy(); diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 1e00be94d745afd499bd03857d85fd1ae0839538..8bbce9b07afb0ba327b399bf8c13b64d6d3c6e16 100644 +index 618a18fc8f3ce07f8e12bf3dd83afe5d626e8161..013ef80b91c03bb6baf6249d8584ba1a393b0dec 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -64,9 +64,11 @@ import net.minecraft.server.NPC; - import net.minecraft.server.PacketPlayInCloseWindow; - import net.minecraft.server.Raid; - import net.minecraft.server.Unit; -+import net.minecraft.server.Vec3D; - import net.minecraft.server.World; - import net.minecraft.server.WorldServer; +@@ -67,6 +67,7 @@ import net.minecraft.world.phys.MovingObjectPosition; + import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.MovingObjectPositionEntity; import org.bukkit.Bukkit; -+import org.bukkit.Location; ++import org.bukkit.Location; // Paper import org.bukkit.Material; import org.bukkit.NamespacedKey; import org.bukkit.Server; -@@ -467,7 +469,13 @@ public class CraftEventFactory { +@@ -467,7 +468,13 @@ public class CraftEventFactory { return callPlayerInteractEvent(who, action, position, direction, itemstack, false, hand); } @@ -47,7 +43,7 @@ index 1e00be94d745afd499bd03857d85fd1ae0839538..8bbce9b07afb0ba327b399bf8c13b64d Player player = (who == null) ? null : (Player) who.getBukkitEntity(); CraftItemStack itemInHand = CraftItemStack.asCraftMirror(itemstack); -@@ -493,7 +501,10 @@ public class CraftEventFactory { +@@ -493,7 +500,10 @@ public class CraftEventFactory { itemInHand = null; } diff --git a/Spigot-Server-Patches/0647-Remove-stale-POIs.patch b/Spigot-Server-Patches/0647-Remove-stale-POIs.patch index ea2328f775..3fb4c84a9a 100644 --- a/Spigot-Server-Patches/0647-Remove-stale-POIs.patch +++ b/Spigot-Server-Patches/0647-Remove-stale-POIs.patch @@ -4,31 +4,11 @@ Date: Sat, 9 Jan 2021 14:17:07 +0100 Subject: [PATCH] Remove stale POIs -diff --git a/src/main/java/net/minecraft/server/VillagePlace.java b/src/main/java/net/minecraft/server/VillagePlace.java -index b926cebd053bef829517c9d9bbf1c609c23ca04a..6a0f07b13eef5560dfc7c7b39618c0b825533aec 100644 ---- a/src/main/java/net/minecraft/server/VillagePlace.java -+++ b/src/main/java/net/minecraft/server/VillagePlace.java -@@ -41,6 +41,7 @@ public class VillagePlace extends RegionFileSection { - ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition, villageplacetype); - } - -+ public void remove(BlockPosition blockposition) { this.a(blockposition); } // Paper - OBFHELPER - public void a(BlockPosition blockposition) { - ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition); - } -@@ -125,6 +126,7 @@ public class VillagePlace extends RegionFileSection { - return ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).c(blockposition); - } - -+ public final boolean test(BlockPosition blockposition, Predicate predicate) { return this.a(blockposition, predicate); } // Paper - OBFHELPER - public boolean a(BlockPosition blockposition, Predicate predicate) { - return (Boolean) this.d(SectionPosition.a(blockposition).s()).map((villageplacesection) -> { - return villageplacesection.a(blockposition, predicate); -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 493e3cd8a3dbc77f73dd1e026c9e580896995675..53d3e1561ea33c38de5dc5dde181439153fa2775 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1953,8 +1953,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index ae2cb0139e71ff41cfac9346179f1037a4401fa1..0bd2ce4f27182c4190892c0a20ab6d99727f27b9 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -2062,8 +2062,16 @@ public class WorldServer extends World implements GeneratorAccessSeed { Optional optional = VillagePlaceType.b(iblockdata); Optional optional1 = VillagePlaceType.b(iblockdata1); @@ -46,7 +26,7 @@ index 493e3cd8a3dbc77f73dd1e026c9e580896995675..53d3e1561ea33c38de5dc5dde1814391 optional.ifPresent((villageplacetype) -> { this.getMinecraftServer().execute(() -> { -@@ -1971,6 +1979,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -2080,6 +2088,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { } } @@ -54,3 +34,23 @@ index 493e3cd8a3dbc77f73dd1e026c9e580896995675..53d3e1561ea33c38de5dc5dde1814391 public VillagePlace y() { return this.getChunkProvider().j(); } +diff --git a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +index 6f3f968b30fdc210e47cb8d99139173869df1638..69e0fce81e4a5d538e6e2e04e251f0b24192f324 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java ++++ b/src/main/java/net/minecraft/world/entity/ai/village/poi/VillagePlace.java +@@ -52,6 +52,7 @@ public class VillagePlace extends RegionFileSection { + ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition, villageplacetype); + } + ++ public void remove(BlockPosition blockposition) { this.a(blockposition); } // Paper - OBFHELPER + public void a(BlockPosition blockposition) { + ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).a(blockposition); + } +@@ -136,6 +137,7 @@ public class VillagePlace extends RegionFileSection { + return ((VillagePlaceSection) this.e(SectionPosition.a(blockposition).s())).c(blockposition); + } + ++ public final boolean test(BlockPosition blockposition, Predicate predicate) { return this.a(blockposition, predicate); } // Paper - OBFHELPER + public boolean a(BlockPosition blockposition, Predicate predicate) { + return (Boolean) this.d(SectionPosition.a(blockposition).s()).map((villageplacesection) -> { + return villageplacesection.a(blockposition, predicate); diff --git a/Spigot-Server-Patches/0648-Fix-villager-boat-exploit.patch b/Spigot-Server-Patches/0648-Fix-villager-boat-exploit.patch index aee4c5d9d1..a59d8a9ec2 100644 --- a/Spigot-Server-Patches/0648-Fix-villager-boat-exploit.patch +++ b/Spigot-Server-Patches/0648-Fix-villager-boat-exploit.patch @@ -4,11 +4,11 @@ Date: Mon, 11 Jan 2021 12:43:51 -0800 Subject: [PATCH] Fix villager boat exploit -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index c4abe7bdc1a9b725166eff8b77c123dd832b3cf9..fbe2b2b3f96232d86efa1bc02c780ec7cc54aa9b 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -538,6 +538,15 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index bd318c058a0a99472486d1c3eaf1f9fa2879aaf6..0a84f70371dc458ccaa567e917706ecd8b6bbefa 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -613,6 +613,15 @@ public abstract class PlayerList { for (Iterator iterator = entity.getAllPassengers().iterator(); iterator.hasNext(); entity1.dead = true) { entity1 = (Entity) iterator.next(); diff --git a/Spigot-Server-Patches/0649-Entity-load-save-limit-per-chunk.patch b/Spigot-Server-Patches/0649-Entity-load-save-limit-per-chunk.patch index 9ccb5672d6..44b5a79152 100644 --- a/Spigot-Server-Patches/0649-Entity-load-save-limit-per-chunk.patch +++ b/Spigot-Server-Patches/0649-Entity-load-save-limit-per-chunk.patch @@ -39,11 +39,11 @@ index c5495e02c3fe271b26f62ea2ec64e07957edf37e..234d2daecc5d0bf6a99c0a5f4a87f947 + }); + } } -diff --git a/src/main/java/net/minecraft/server/ChunkRegionLoader.java b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -index 8e7da2c5f3852920ec5fbcdd2bff4d299e6aa499..f51bf71c8d6eef3c054ac64765709794fcfad5ee 100644 ---- a/src/main/java/net/minecraft/server/ChunkRegionLoader.java -+++ b/src/main/java/net/minecraft/server/ChunkRegionLoader.java -@@ -495,11 +495,22 @@ public class ChunkRegionLoader { +diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +index 4449a4e9609970622394bb4a3968d73a4d825382..eae810265051127d25c469797f4988ab4710bd4e 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java ++++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java +@@ -537,11 +537,22 @@ public class ChunkRegionLoader { chunk.d(false); @@ -66,7 +66,7 @@ index 8e7da2c5f3852920ec5fbcdd2bff4d299e6aa499..f51bf71c8d6eef3c054ac64765709794 NBTTagCompound nbttagcompound4 = new NBTTagCompound(); // Paper start if (asyncsavedata == null && !entity.dead && (int) Math.floor(entity.locX()) >> 4 != chunk.getPos().x || (int) Math.floor(entity.locZ()) >> 4 != chunk.getPos().z) { -@@ -630,10 +641,21 @@ public class ChunkRegionLoader { +@@ -672,10 +683,21 @@ public class ChunkRegionLoader { NBTTagList nbttaglist = nbttagcompound.getList("Entities", 10); World world = chunk.getWorld(); diff --git a/Spigot-Server-Patches/0650-Add-sendOpLevel-API.patch b/Spigot-Server-Patches/0650-Add-sendOpLevel-API.patch index 57a6e2a4b1..df288af91e 100644 --- a/Spigot-Server-Patches/0650-Add-sendOpLevel-API.patch +++ b/Spigot-Server-Patches/0650-Add-sendOpLevel-API.patch @@ -4,11 +4,11 @@ Date: Tue, 29 Dec 2020 15:03:03 +0100 Subject: [PATCH] Add sendOpLevel API -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 32b9ef6d418e1d897855ab95840cec542bffd8aa..cf92f63d82bd43a1511ab77bf7adbbc03b4e3b84 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -1054,6 +1054,11 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 0a84f70371dc458ccaa567e917706ecd8b6bbefa..5a371a7ce4cc70d5916b87874a960427c882f9b1 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -1129,6 +1129,11 @@ public abstract class PlayerList { } private void a(EntityPlayer entityplayer, int i) { @@ -20,7 +20,7 @@ index 32b9ef6d418e1d897855ab95840cec542bffd8aa..cf92f63d82bd43a1511ab77bf7adbbc0 if (entityplayer.playerConnection != null) { byte b0; -@@ -1068,8 +1073,10 @@ public abstract class PlayerList { +@@ -1143,8 +1148,10 @@ public abstract class PlayerList { entityplayer.playerConnection.sendPacket(new PacketPlayOutEntityStatus(entityplayer, b0)); } @@ -32,7 +32,7 @@ index 32b9ef6d418e1d897855ab95840cec542bffd8aa..cf92f63d82bd43a1511ab77bf7adbbc0 // Paper start diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 00ea7d9d946a70399d8ddb3b7ebfab42d0fab88c..756009d20b23b2e5c51e72e61348bd60d93a7c11 100644 +index 9fdd17865bf8fe0fd0704846652b8f593808f664..21304d60f90dbf2254ebf19cfda372f8c6d7c7f1 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2288,6 +2288,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/Spigot-Server-Patches/0651-Add-StructureLocateEvent.patch b/Spigot-Server-Patches/0651-Add-StructureLocateEvent.patch index 1995ff7dc5..3e68e76756 100644 --- a/Spigot-Server-Patches/0651-Add-StructureLocateEvent.patch +++ b/Spigot-Server-Patches/0651-Add-StructureLocateEvent.patch @@ -4,11 +4,11 @@ Date: Wed, 16 Sep 2020 01:12:29 -0700 Subject: [PATCH] Add StructureLocateEvent -diff --git a/src/main/java/net/minecraft/server/ChunkGenerator.java b/src/main/java/net/minecraft/server/ChunkGenerator.java -index 9a6fef215052f9c513b23024968995c97863a453..097cb9896c525a605c50e83548f828e0c71ab3d5 100644 ---- a/src/main/java/net/minecraft/server/ChunkGenerator.java -+++ b/src/main/java/net/minecraft/server/ChunkGenerator.java -@@ -2,6 +2,7 @@ package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +index b1f2c424ef358f79c7fced88a61560d3ce32a2b6..f2621f61cb372ec436fe81e7a93f1aef7d360f3f 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java ++++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java +@@ -2,6 +2,7 @@ package net.minecraft.world.level.chunk; import com.google.common.collect.Lists; import com.mojang.serialization.Codec; @@ -16,7 +16,7 @@ index 9a6fef215052f9c513b23024968995c97863a453..097cb9896c525a605c50e83548f828e0 import java.util.BitSet; import java.util.Iterator; import java.util.List; -@@ -124,6 +125,22 @@ public abstract class ChunkGenerator { +@@ -160,6 +161,22 @@ public abstract class ChunkGenerator { @Nullable public BlockPosition findNearestMapFeature(WorldServer worldserver, StructureGenerator structuregenerator, BlockPosition blockposition, int i, boolean flag) { diff --git a/Spigot-Server-Patches/0652-Collision-option-for-requiring-a-player-participant.patch b/Spigot-Server-Patches/0652-Collision-option-for-requiring-a-player-participant.patch index 2b6e5d1aa3..12b433f5d7 100644 --- a/Spigot-Server-Patches/0652-Collision-option-for-requiring-a-player-participant.patch +++ b/Spigot-Server-Patches/0652-Collision-option-for-requiring-a-player-participant.patch @@ -27,11 +27,11 @@ index 234d2daecc5d0bf6a99c0a5f4a87f947a15029d9..89f3a28c20f0e4db4650c435dbcbc923 public int wanderingTraderSpawnMinuteTicks = 1200; public int wanderingTraderSpawnDayTicks = 24000; public int wanderingTraderSpawnChanceFailureIncrement = 25; -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index f9d7419e376268b00db2eb98a3db4116bdb72bd8..f307a6361144c7e315b2e0ea45df27527cdb26ca 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -1375,6 +1375,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 7ad4d20cd43ad100ab8a1987d061bb523fb66ea5..f64d37aa1183fe1a7c6f3131f945d9bd4e43bf3c 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -1460,6 +1460,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public void collide(Entity entity) { if (!this.isSameVehicle(entity)) { if (!entity.noclip && !this.noclip) { @@ -39,11 +39,11 @@ index f9d7419e376268b00db2eb98a3db4116bdb72bd8..f307a6361144c7e315b2e0ea45df2752 double d0 = entity.locX() - this.locX(); double d1 = entity.locZ() - this.locZ(); double d2 = MathHelper.a(d0, d1); -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index da84cf98022b771bdf0c9d0b284aa7d4d59318e0..baa4a61114e7460c74027e1519332f0dd9582647 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -186,6 +186,7 @@ public class EntityBoat extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +index 2609b83573e0e8532e6c4c36d4f475bf0da6a354..5ae7620be7b0b5fba6aab8173aed45dc28bf36e3 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +@@ -230,6 +230,7 @@ public class EntityBoat extends Entity { @Override public void collide(Entity entity) { @@ -51,11 +51,11 @@ index da84cf98022b771bdf0c9d0b284aa7d4d59318e0..baa4a61114e7460c74027e1519332f0d if (entity instanceof EntityBoat) { if (entity.getBoundingBox().minY < this.getBoundingBox().maxY) { // CraftBukkit start -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index efe5c0cecaf12ef921f6d32ff6670eff051bf323..022dfdc5b6af4b243e7e4da8660e8e41d04e1a30 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -729,6 +729,7 @@ public abstract class EntityMinecartAbstract extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +index 2e3ceab3e34f7756764b3471b13d48d1263ecba9..c79474ffb455bb87bfdd98bc68b3dc8dfcdca45e 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +@@ -767,6 +767,7 @@ public abstract class EntityMinecartAbstract extends Entity { public void collide(Entity entity) { if (!this.world.isClientSide) { if (!entity.noclip && !this.noclip) { diff --git a/Spigot-Server-Patches/0653-Make-ProjectileHitEvent-Cancellable.patch b/Spigot-Server-Patches/0653-Make-ProjectileHitEvent-Cancellable.patch index 99855dabf3..c5def0ff78 100644 --- a/Spigot-Server-Patches/0653-Make-ProjectileHitEvent-Cancellable.patch +++ b/Spigot-Server-Patches/0653-Make-ProjectileHitEvent-Cancellable.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Make ProjectileHitEvent Cancellable Allows cancelling things like detonating TNT from Fire Arrows -diff --git a/src/main/java/net/minecraft/server/EntityFireball.java b/src/main/java/net/minecraft/server/EntityFireball.java -index 74ca38f8e4e1addc243c3f3b57021d26f0ce3c97..0840fdf3585407ec317f0326359619220c64db78 100644 ---- a/src/main/java/net/minecraft/server/EntityFireball.java -+++ b/src/main/java/net/minecraft/server/EntityFireball.java -@@ -71,7 +71,7 @@ public abstract class EntityFireball extends IProjectile { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java +index 08b3499681eaf23a2f79f6dd9134ccfd86d888a4..7428de092006d5da3e8a543e46a11c6122eac323 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/EntityFireball.java +@@ -86,7 +86,7 @@ public abstract class EntityFireball extends IProjectile { // CraftBukkit start - Fire ProjectileHitEvent if (this.dead) { @@ -18,11 +18,11 @@ index 74ca38f8e4e1addc243c3f3b57021d26f0ce3c97..0840fdf3585407ec317f032635961922 } // CraftBukkit end } -diff --git a/src/main/java/net/minecraft/server/IProjectile.java b/src/main/java/net/minecraft/server/IProjectile.java -index 9f5ce64a60fe7c312399ee416b11b84213dd3bee..bbc089b41fcbe0141f13591db2cb44b9e688cac4 100644 ---- a/src/main/java/net/minecraft/server/IProjectile.java -+++ b/src/main/java/net/minecraft/server/IProjectile.java -@@ -118,7 +118,7 @@ public abstract class IProjectile extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +index 0e3c646dca1fa1fa895c3aece037367a9b2cf378..054785a3db3c787f5c1444613d3e8fe235e397f1 100644 +--- a/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java ++++ b/src/main/java/net/minecraft/world/entity/projectile/IProjectile.java +@@ -129,7 +129,7 @@ public abstract class IProjectile extends Entity { } protected void a(MovingObjectPosition movingobjectposition) { @@ -32,10 +32,10 @@ index 9f5ce64a60fe7c312399ee416b11b84213dd3bee..bbc089b41fcbe0141f13591db2cb44b9 if (movingobjectposition_enummovingobjecttype == MovingObjectPosition.EnumMovingObjectType.ENTITY) { diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 8bbce9b07afb0ba327b399bf8c13b64d6d3c6e16..579e1b3cde06a1138d90cda61a2bcf87aed3be98 100644 +index 013ef80b91c03bb6baf6249d8584ba1a393b0dec..7ad42020c0ac735d5c24912a7de98d7a40870d0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1296,9 +1296,9 @@ public class CraftEventFactory { +@@ -1295,9 +1295,9 @@ public class CraftEventFactory { return event; } @@ -47,7 +47,7 @@ index 8bbce9b07afb0ba327b399bf8c13b64d6d3c6e16..579e1b3cde06a1138d90cda61a2bcf87 } Block hitBlock = null; -@@ -1315,7 +1315,7 @@ public class CraftEventFactory { +@@ -1314,7 +1314,7 @@ public class CraftEventFactory { } ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), hitEntity, hitBlock, hitFace); diff --git a/Spigot-Server-Patches/0654-Return-chat-component-with-empty-text-instead-of-thr.patch b/Spigot-Server-Patches/0654-Return-chat-component-with-empty-text-instead-of-thr.patch index f80c27dec5..a074b98c1b 100644 --- a/Spigot-Server-Patches/0654-Return-chat-component-with-empty-text-instead-of-thr.patch +++ b/Spigot-Server-Patches/0654-Return-chat-component-with-empty-text-instead-of-thr.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Return chat component with empty text instead of throwing exception -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 1eba0ccad798ee0d9e9d573e58a8dcd5363b6ffd..3de58cd344c37451873aa8a12b5d9e65f390ec8f 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java -@@ -45,7 +45,12 @@ public abstract class Container { +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java +index 9c6330da4e026a7753698b5d103c009730154c3e..cd30924d2b7768bbc9a429462319c8ca0822444d 100644 +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java +@@ -61,7 +61,12 @@ public abstract class Container { } private IChatBaseComponent title; public final IChatBaseComponent getTitle() { diff --git a/Spigot-Server-Patches/0655-Make-schedule-command-per-world.patch b/Spigot-Server-Patches/0655-Make-schedule-command-per-world.patch index 095f298245..87d12b6191 100644 --- a/Spigot-Server-Patches/0655-Make-schedule-command-per-world.patch +++ b/Spigot-Server-Patches/0655-Make-schedule-command-per-world.patch @@ -4,11 +4,11 @@ Date: Mon, 4 Jan 2021 19:52:44 -0800 Subject: [PATCH] Make schedule command per-world -diff --git a/src/main/java/net/minecraft/server/CommandSchedule.java b/src/main/java/net/minecraft/server/CommandSchedule.java -index c4cb8fb2b611cc8e2df82497a7248e106cdc188e..4f167cace29637ca5c4624a2628e1df7066bb0de 100644 ---- a/src/main/java/net/minecraft/server/CommandSchedule.java -+++ b/src/main/java/net/minecraft/server/CommandSchedule.java -@@ -19,7 +19,7 @@ public class CommandSchedule { +diff --git a/src/main/java/net/minecraft/server/commands/CommandSchedule.java b/src/main/java/net/minecraft/server/commands/CommandSchedule.java +index b88a91072032b75f83d811d63e1b5e3808faa9be..440b25dde0299037032d535c4c751f252775d6ad 100644 +--- a/src/main/java/net/minecraft/server/commands/CommandSchedule.java ++++ b/src/main/java/net/minecraft/server/commands/CommandSchedule.java +@@ -32,7 +32,7 @@ public class CommandSchedule { return new ChatMessage("commands.schedule.cleared.failure", new Object[]{object}); }); private static final SuggestionProvider c = (commandcontext, suggestionsbuilder) -> { @@ -16,8 +16,8 @@ index c4cb8fb2b611cc8e2df82497a7248e106cdc188e..4f167cace29637ca5c4624a2628e1df7 + return ICompletionProvider.b((Iterable) ((CommandListenerWrapper) commandcontext.getSource()).getWorld().worldDataServer.H().u().a(), suggestionsbuilder); // Paper }; - public static void a(com.mojang.brigadier.CommandDispatcher com_mojang_brigadier_commanddispatcher) { -@@ -42,7 +42,7 @@ public class CommandSchedule { + public static void a(CommandDispatcher commanddispatcher) { +@@ -55,7 +55,7 @@ public class CommandSchedule { } else { long j = commandlistenerwrapper.getWorld().getTime() + (long) i; MinecraftKey minecraftkey = (MinecraftKey) pair.getFirst(); @@ -26,7 +26,7 @@ index c4cb8fb2b611cc8e2df82497a7248e106cdc188e..4f167cace29637ca5c4624a2628e1df7 ((Either) pair.getSecond()).ifLeft((customfunction) -> { String s = minecraftkey.toString(); -@@ -68,7 +68,7 @@ public class CommandSchedule { +@@ -81,7 +81,7 @@ public class CommandSchedule { } private static int a(CommandListenerWrapper commandlistenerwrapper, String s) throws CommandSyntaxException { diff --git a/Spigot-Server-Patches/0656-Configurable-max-leash-distance.patch b/Spigot-Server-Patches/0656-Configurable-max-leash-distance.patch index 74a03c722c..d9c34d52f9 100644 --- a/Spigot-Server-Patches/0656-Configurable-max-leash-distance.patch +++ b/Spigot-Server-Patches/0656-Configurable-max-leash-distance.patch @@ -21,11 +21,11 @@ index 89f3a28c20f0e4db4650c435dbcbc923b7bde8aa..4735dcba31b556fafe9c7d7440c89e94 public boolean disableEndCredits; private void disableEndCredits() { disableEndCredits = getBoolean("game-mechanics.disable-end-credits", false); -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index 4757e5a92c9cf04fa52d62bac6dae782e08ddab1..eaa10d6e3a3c37b83fed58637941273fee9b0be8 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java -@@ -40,7 +40,7 @@ public abstract class EntityCreature extends EntityInsentient { +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java +index bbf0f345bfdd8a3a1f7fe902a42b2b18cdcf07a5..20570580367697e37e6c45147168c3beb6c8d31b 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java +@@ -47,7 +47,7 @@ public abstract class EntityCreature extends EntityInsentient { float f = this.g(entity); if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) { @@ -34,7 +34,7 @@ index 4757e5a92c9cf04fa52d62bac6dae782e08ddab1..eaa10d6e3a3c37b83fed58637941273f this.world.getServer().getPluginManager().callEvent(new EntityUnleashEvent(this.getBukkitEntity(), EntityUnleashEvent.UnleashReason.DISTANCE)); // CraftBukkit this.unleash(true, true); } -@@ -49,7 +49,7 @@ public abstract class EntityCreature extends EntityInsentient { +@@ -56,7 +56,7 @@ public abstract class EntityCreature extends EntityInsentient { } this.x(f); diff --git a/Spigot-Server-Patches/0657-Implement-BlockPreDispenseEvent.patch b/Spigot-Server-Patches/0657-Implement-BlockPreDispenseEvent.patch index 8e42faa840..7a6ff4e374 100644 --- a/Spigot-Server-Patches/0657-Implement-BlockPreDispenseEvent.patch +++ b/Spigot-Server-Patches/0657-Implement-BlockPreDispenseEvent.patch @@ -4,11 +4,11 @@ Date: Sun, 17 Jan 2021 13:16:09 +1000 Subject: [PATCH] Implement BlockPreDispenseEvent -diff --git a/src/main/java/net/minecraft/server/BlockDispenser.java b/src/main/java/net/minecraft/server/BlockDispenser.java -index 063453552b7b6c2395c8f9be27cdb71a15a56ca4..89325af931b5ca43729758e94e971b612f65eea2 100644 ---- a/src/main/java/net/minecraft/server/BlockDispenser.java -+++ b/src/main/java/net/minecraft/server/BlockDispenser.java -@@ -55,6 +55,7 @@ public class BlockDispenser extends BlockTileEntity { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockDispenser.java b/src/main/java/net/minecraft/world/level/block/BlockDispenser.java +index 966051ab3e720e5b3f0fb9ab852c8908c5f23f3b..9b92824f1c2797e321ced953d33d2c2fd339374a 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockDispenser.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockDispenser.java +@@ -88,6 +88,7 @@ public class BlockDispenser extends BlockTileEntity { IDispenseBehavior idispensebehavior = this.a(itemstack); if (idispensebehavior != IDispenseBehavior.NONE) { @@ -17,18 +17,18 @@ index 063453552b7b6c2395c8f9be27cdb71a15a56ca4..89325af931b5ca43729758e94e971b61 tileentitydispenser.setItem(i, idispensebehavior.dispense(sourceblock, itemstack)); } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 579e1b3cde06a1138d90cda61a2bcf87aed3be98..a7ac877014853bb2b2e826ad6950da959f56b268 100644 +index 7ad42020c0ac735d5c24912a7de98d7a40870d0a..ed006c05510cd4113463efff6d28791275c2b214 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -13,6 +13,7 @@ import java.util.List; - import java.util.Map; - import java.util.stream.Collectors; - import javax.annotation.Nullable; -+import io.papermc.paper.event.block.BlockPreDispenseEvent; - import net.minecraft.server.BlockPosition; - import net.minecraft.server.BlockPropertyInstrument; - import net.minecraft.server.Container; -@@ -1778,5 +1779,11 @@ public class CraftEventFactory { +@@ -66,6 +66,7 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParameters; + import net.minecraft.world.phys.MovingObjectPosition; + import net.minecraft.world.phys.MovingObjectPositionBlock; + import net.minecraft.world.phys.MovingObjectPositionEntity; ++import io.papermc.paper.event.block.BlockPreDispenseEvent; // Paper + import org.bukkit.Bukkit; + import org.bukkit.Location; // Paper + import org.bukkit.Material; +@@ -1777,5 +1778,11 @@ public class CraftEventFactory { BlockFailedDispenseEvent event = new BlockFailedDispenseEvent(block); return event.callEvent(); } diff --git a/Spigot-Server-Patches/0658-Added-Vanilla-Entity-Tags.patch b/Spigot-Server-Patches/0658-Added-Vanilla-Entity-Tags.patch index dda8fd3e8a..0aaed0f636 100644 --- a/Spigot-Server-Patches/0658-Added-Vanilla-Entity-Tags.patch +++ b/Spigot-Server-Patches/0658-Added-Vanilla-Entity-Tags.patch @@ -6,16 +6,15 @@ Subject: [PATCH] Added Vanilla Entity Tags diff --git a/src/main/java/io/papermc/paper/CraftEntityTag.java b/src/main/java/io/papermc/paper/CraftEntityTag.java new file mode 100644 -index 0000000000000000000000000000000000000000..4a689a2769ac343c2ffab49631c416014ce46d02 +index 0000000000000000000000000000000000000000..2ca8e1bade5450a14125b77540792e0b18c3e19b --- /dev/null +++ b/src/main/java/io/papermc/paper/CraftEntityTag.java -@@ -0,0 +1,30 @@ +@@ -0,0 +1,29 @@ +package io.papermc.paper; + -+import net.minecraft.server.Entity; -+import net.minecraft.server.EntityTypes; -+import net.minecraft.server.MinecraftKey; -+import net.minecraft.server.Tags; ++import net.minecraft.resources.MinecraftKey; ++import net.minecraft.tags.Tags; ++import net.minecraft.world.entity.EntityTypes; +import org.bukkit.craftbukkit.tag.CraftTag; +import org.bukkit.craftbukkit.util.CraftMagicNumbers; +import org.bukkit.entity.EntityType; @@ -41,7 +40,7 @@ index 0000000000000000000000000000000000000000..4a689a2769ac343c2ffab49631c41601 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index c1c087cf9a3addef41d9dbec76f23177176dd44f..db0f0550ea011ff8222473de9940e4bfdc7b9e06 100644 +index fe2ad3f9298af4d405711b4798e34ae484a19db9..a4755e2cdb40afe6af47435f92963a53d7b719c7 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -2216,6 +2216,11 @@ public final class CraftServer implements Server { @@ -57,7 +56,7 @@ index c1c087cf9a3addef41d9dbec76f23177176dd44f..db0f0550ea011ff8222473de9940e4bf throw new IllegalArgumentException(); } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index db241142e892940571c39e95f2dce648e79702bb..00e53d577b1dcaccb409e62d35165ee015de9330 100644 +index 4b7ca6d2e13fad43a75a345608b739f47adba738..ca911ed346daf8c43b7b6e0acabf9ac0c64223aa 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -98,8 +98,17 @@ public final class CraftMagicNumbers implements UnsafeValues { @@ -65,14 +64,14 @@ index db241142e892940571c39e95f2dce648e79702bb..00e53d577b1dcaccb409e62d35165ee0 private static final Map MATERIAL_BLOCK = new HashMap<>(); private static final Map MATERIAL_FLUID = new HashMap<>(); + // Paper start -+ private static final Map> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); -+ private static final Map, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); ++ private static final Map> ENTITY_TYPE_ENTITY_TYPES = new HashMap<>(); ++ private static final Map, org.bukkit.entity.EntityType> ENTITY_TYPES_ENTITY_TYPE = new HashMap<>(); static { + for (org.bukkit.entity.EntityType type : org.bukkit.entity.EntityType.values()) { + if (type == org.bukkit.entity.EntityType.UNKNOWN) continue; -+ ENTITY_TYPE_ENTITY_TYPES.put(type, net.minecraft.server.IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))); -+ ENTITY_TYPES_ENTITY_TYPE.put(net.minecraft.server.IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type); ++ ENTITY_TYPE_ENTITY_TYPES.put(type, IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))); ++ ENTITY_TYPES_ENTITY_TYPE.put(IRegistry.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type); + } + // Paper end for (Block block : IRegistry.BLOCK) { @@ -83,10 +82,10 @@ index db241142e892940571c39e95f2dce648e79702bb..00e53d577b1dcaccb409e62d35165ee0 return CraftNamespacedKey.toMinecraft(mat.getKey()); } + // Paper start -+ public static net.minecraft.server.EntityTypes getEntityTypes(org.bukkit.entity.EntityType type) { ++ public static net.minecraft.world.entity.EntityTypes getEntityTypes(org.bukkit.entity.EntityType type) { + return ENTITY_TYPE_ENTITY_TYPES.get(type); + } -+ public static org.bukkit.entity.EntityType getEntityType(net.minecraft.server.EntityTypes entityTypes) { ++ public static org.bukkit.entity.EntityType getEntityType(net.minecraft.world.entity.EntityTypes entityTypes) { + return ENTITY_TYPES_ENTITY_TYPE.get(entityTypes); + } + // Paper end diff --git a/Spigot-Server-Patches/0659-added-Wither-API.patch b/Spigot-Server-Patches/0659-added-Wither-API.patch index d6fc933d83..29bb22ea9d 100644 --- a/Spigot-Server-Patches/0659-added-Wither-API.patch +++ b/Spigot-Server-Patches/0659-added-Wither-API.patch @@ -4,11 +4,11 @@ Date: Sun, 5 Jul 2020 15:39:19 -0700 Subject: [PATCH] added Wither API -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 53482a420c356fd50e5ab6dd729a271d6594dac7..2e623ef9be036ea467e9e41817c2eced018f8f93 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -32,6 +32,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +index 30290c0208a4725b2eb0e7764465c354e592e4ee..891905712903bf3ba241187791cfa995375430d5 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +@@ -82,6 +82,11 @@ public class EntityWither extends EntityMonster implements IRangedEntity { return entityliving.getMonsterType() != EnumMonsterType.UNDEAD && entityliving.ei(); }; private static final PathfinderTargetCondition bz = (new PathfinderTargetCondition()).a(20.0D).a(EntityWither.by); @@ -20,7 +20,7 @@ index 53482a420c356fd50e5ab6dd729a271d6594dac7..2e623ef9be036ea467e9e41817c2eced public EntityWither(EntityTypes entitytypes, World world) { super(entitytypes, world); -@@ -530,6 +535,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +@@ -580,6 +585,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.datawatcher.set((DataWatcherObject) EntityWither.bo.get(i), j); } @@ -28,7 +28,7 @@ index 53482a420c356fd50e5ab6dd729a271d6594dac7..2e623ef9be036ea467e9e41817c2eced public boolean S_() { return this.getHealth() <= this.getMaxHealth() / 2.0F; } -@@ -546,7 +552,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +@@ -596,7 +602,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { @Override public boolean canPortal() { @@ -38,10 +38,10 @@ index 53482a420c356fd50e5ab6dd729a271d6594dac7..2e623ef9be036ea467e9e41817c2eced @Override diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -index 03cf6136e64bab7180933e106234b92c1255268d..8c75f6df9749246fbbad55dcdc4292bd3bab4e2b 100644 +index 1d94aeec37dcb9758d88ef25a5cad1333bbfbf6c..adf4ce8afa3a42ea8a184905969e03b6b756830f 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftWither.java -@@ -39,4 +39,31 @@ public class CraftWither extends CraftMonster implements Wither, CraftRangedEnti +@@ -38,4 +38,31 @@ public class CraftWither extends CraftMonster implements Wither, com.destroystok public BossBar getBossBar() { return bossBar; } diff --git a/Spigot-Server-Patches/0660-Added-firing-of-PlayerChangeBeaconEffectEvent.patch b/Spigot-Server-Patches/0660-Added-firing-of-PlayerChangeBeaconEffectEvent.patch index f90e695e12..8300eca18e 100644 --- a/Spigot-Server-Patches/0660-Added-firing-of-PlayerChangeBeaconEffectEvent.patch +++ b/Spigot-Server-Patches/0660-Added-firing-of-PlayerChangeBeaconEffectEvent.patch @@ -4,21 +4,22 @@ Date: Wed, 24 Jun 2020 15:14:51 -0600 Subject: [PATCH] Added firing of PlayerChangeBeaconEffectEvent -diff --git a/src/main/java/net/minecraft/server/ContainerBeacon.java b/src/main/java/net/minecraft/server/ContainerBeacon.java -index 288390bf9210f0fcc7c85e3093a4924614dc1573..2b09368ad998aef7d1e76a45515c6ac7ebf5c6fb 100644 ---- a/src/main/java/net/minecraft/server/ContainerBeacon.java -+++ b/src/main/java/net/minecraft/server/ContainerBeacon.java -@@ -1,6 +1,9 @@ - package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java b/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java +index 7e5a0bad616d9477e01426ab1604184ef3fab1c1..085298a9c3837dfa48dfbbf02d6261db12c79036 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerBeacon.java +@@ -13,6 +13,10 @@ import net.minecraft.world.entity.player.PlayerInventory; + import org.bukkit.craftbukkit.inventory.CraftInventoryView; + // CraftBukkit end - import org.bukkit.craftbukkit.inventory.CraftInventoryView; // CraftBukkit +// Paper start +import io.papermc.paper.event.player.PlayerChangeBeaconEffectEvent; +// Paper end - ++ public class ContainerBeacon extends Container { -@@ -128,9 +131,15 @@ public class ContainerBeacon extends Container { + private final IInventory beacon; +@@ -139,9 +143,15 @@ public class ContainerBeacon extends Container { public void c(int i, int j) { if (this.d.hasItem()) { diff --git a/Spigot-Server-Patches/0661-Fix-console-spam-when-removing-chests-in-water.patch b/Spigot-Server-Patches/0661-Fix-console-spam-when-removing-chests-in-water.patch index b557cb51b8..d05dbe7aff 100644 --- a/Spigot-Server-Patches/0661-Fix-console-spam-when-removing-chests-in-water.patch +++ b/Spigot-Server-Patches/0661-Fix-console-spam-when-removing-chests-in-water.patch @@ -4,11 +4,11 @@ Date: Thu, 19 Nov 2020 02:07:10 +0000 Subject: [PATCH] Fix console spam when removing chests in water -diff --git a/src/main/java/net/minecraft/server/BlockChest.java b/src/main/java/net/minecraft/server/BlockChest.java -index 12a0230448dd8d56f6dc20e23cacaf0b8a9433d1..c4ff93a6b908c1bd157c7fe45b504909b189d09c 100644 ---- a/src/main/java/net/minecraft/server/BlockChest.java -+++ b/src/main/java/net/minecraft/server/BlockChest.java -@@ -195,7 +195,7 @@ public class BlockChest extends BlockChestAbstract implements I +diff --git a/src/main/java/net/minecraft/world/level/block/BlockChest.java b/src/main/java/net/minecraft/world/level/block/BlockChest.java +index b2c29cff5883868cb56a4e376ab946ac929abc94..a45ee959f41e7f349ff2c309f21fa44ec671cb87 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockChest.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockChest.java +@@ -239,7 +239,7 @@ public class BlockChest extends BlockChestAbstract implements I @Override public void remove(IBlockData iblockdata, World world, BlockPosition blockposition, IBlockData iblockdata1, boolean flag) { if (!iblockdata.a(iblockdata1.getBlock())) { diff --git a/Spigot-Server-Patches/0662-Add-toggle-for-always-placing-the-dragon-egg.patch b/Spigot-Server-Patches/0662-Add-toggle-for-always-placing-the-dragon-egg.patch index ee3eca7239..504d8e7ebd 100644 --- a/Spigot-Server-Patches/0662-Add-toggle-for-always-placing-the-dragon-egg.patch +++ b/Spigot-Server-Patches/0662-Add-toggle-for-always-placing-the-dragon-egg.patch @@ -18,11 +18,11 @@ index 4735dcba31b556fafe9c7d7440c89e940755c81f..ac96011d4e104c99bb37833d91b8121f + enderDragonsDeathAlwaysPlacesDragonEgg = getBoolean("ender-dragons-death-always-places-dragon-egg", enderDragonsDeathAlwaysPlacesDragonEgg); + } } -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index 38dc6086d18951e065d4048d1d8eee288c5c5fd1..7f11adbc5d8527b50f7657d46459516a471017b3 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -358,7 +358,7 @@ public class EnderDragonBattle { +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +index c0a6b340810b8ea4f454290b1ac22316ff0e6e22..80fcceec519ef59d057d27a81fcd0649a20447da 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -400,7 +400,7 @@ public class EnderDragonBattle { this.bossBattle.setVisible(false); this.generateExitPortal(true); this.n(); diff --git a/Spigot-Server-Patches/0663-Added-PlayerStonecutterRecipeSelectEvent.patch b/Spigot-Server-Patches/0663-Added-PlayerStonecutterRecipeSelectEvent.patch index 51c21c63eb..ef33f09d13 100644 --- a/Spigot-Server-Patches/0663-Added-PlayerStonecutterRecipeSelectEvent.patch +++ b/Spigot-Server-Patches/0663-Added-PlayerStonecutterRecipeSelectEvent.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Added PlayerStonecutterRecipeSelectEvent Co-Authored-By: MiniDigger -diff --git a/src/main/java/net/minecraft/server/Container.java b/src/main/java/net/minecraft/server/Container.java -index 3de58cd344c37451873aa8a12b5d9e65f390ec8f..a5c92b2b7fe42b81e7feebf8969a08bd7d08e0e6 100644 ---- a/src/main/java/net/minecraft/server/Container.java -+++ b/src/main/java/net/minecraft/server/Container.java -@@ -101,7 +101,7 @@ public abstract class Container { +diff --git a/src/main/java/net/minecraft/world/inventory/Container.java b/src/main/java/net/minecraft/world/inventory/Container.java +index cd30924d2b7768bbc9a429462319c8ca0822444d..eddd35c91f590755fe11a05c73f3b75a89294175 100644 +--- a/src/main/java/net/minecraft/world/inventory/Container.java ++++ b/src/main/java/net/minecraft/world/inventory/Container.java +@@ -117,7 +117,7 @@ public abstract class Container { return slot; } @@ -18,10 +18,10 @@ index 3de58cd344c37451873aa8a12b5d9e65f390ec8f..a5c92b2b7fe42b81e7feebf8969a08bd this.d.add(containerproperty); return containerproperty; } -diff --git a/src/main/java/net/minecraft/server/ContainerProperty.java b/src/main/java/net/minecraft/server/ContainerProperty.java -index e26b8569340fb0240439ff85d481bd3de19c0ae3..7523c77a914d7e78b4ef08c1ef329d2ef38d3091 100644 ---- a/src/main/java/net/minecraft/server/ContainerProperty.java -+++ b/src/main/java/net/minecraft/server/ContainerProperty.java +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerProperty.java b/src/main/java/net/minecraft/world/inventory/ContainerProperty.java +index 67c3b7ddb0b0f10c82577cbea7506c9d80d41368..b9c82e68a811c2ef6bf2d5ce3ae9f858bcb263d5 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerProperty.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerProperty.java @@ -20,7 +20,7 @@ public abstract class ContainerProperty { }; } @@ -40,11 +40,11 @@ index e26b8569340fb0240439ff85d481bd3de19c0ae3..7523c77a914d7e78b4ef08c1ef329d2e int i = this.get(); boolean flag = i != this.a; -diff --git a/src/main/java/net/minecraft/server/ContainerStonecutter.java b/src/main/java/net/minecraft/server/ContainerStonecutter.java -index 232a46021edcaa90d29dfa5e8b6857f4ab4a8eac..d64c154615f1ff424f5a627f02e3a8fb6136ea8c 100644 ---- a/src/main/java/net/minecraft/server/ContainerStonecutter.java -+++ b/src/main/java/net/minecraft/server/ContainerStonecutter.java -@@ -9,13 +9,14 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter; +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java +index 1589d9ca201d386d11d9fd57fa8ba6848bae215c..dc667dd5d8514ae4c8a2087cb913f44320ebfc48 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerStonecutter.java +@@ -22,13 +22,14 @@ import org.bukkit.craftbukkit.inventory.CraftInventoryStonecutter; import org.bukkit.craftbukkit.inventory.CraftInventoryView; import org.bukkit.entity.Player; // CraftBukkit end @@ -60,7 +60,7 @@ index 232a46021edcaa90d29dfa5e8b6857f4ab4a8eac..d64c154615f1ff424f5a627f02e3a8fb private ItemStack j; private long k; final Slot c; -@@ -45,7 +46,7 @@ public class ContainerStonecutter extends Container { +@@ -58,7 +59,7 @@ public class ContainerStonecutter extends Container { public ContainerStonecutter(int i, PlayerInventory playerinventory, final ContainerAccess containeraccess) { super(Containers.STONECUTTER, i); @@ -69,7 +69,7 @@ index 232a46021edcaa90d29dfa5e8b6857f4ab4a8eac..d64c154615f1ff424f5a627f02e3a8fb this.i = Lists.newArrayList(); this.j = ItemStack.b; this.l = () -> { -@@ -123,13 +124,36 @@ public class ContainerStonecutter extends Container { +@@ -136,13 +137,36 @@ public class ContainerStonecutter extends Container { @Override public boolean a(EntityHuman entityhuman, int i) { if (this.d(i)) { diff --git a/Spigot-Server-Patches/0664-Add-dropLeash-variable-to-EntityUnleashEvent.patch b/Spigot-Server-Patches/0664-Add-dropLeash-variable-to-EntityUnleashEvent.patch index 514c740b09..036edd98ca 100644 --- a/Spigot-Server-Patches/0664-Add-dropLeash-variable-to-EntityUnleashEvent.patch +++ b/Spigot-Server-Patches/0664-Add-dropLeash-variable-to-EntityUnleashEvent.patch @@ -4,11 +4,11 @@ Date: Fri, 29 Jan 2021 15:13:11 +0100 Subject: [PATCH] Add dropLeash variable to EntityUnleashEvent -diff --git a/src/main/java/net/minecraft/server/EntityCreature.java b/src/main/java/net/minecraft/server/EntityCreature.java -index eaa10d6e3a3c37b83fed58637941273fee9b0be8..2a5160a937a6a9968f9357c5ea3e4ced739dc0f4 100644 ---- a/src/main/java/net/minecraft/server/EntityCreature.java -+++ b/src/main/java/net/minecraft/server/EntityCreature.java -@@ -41,8 +41,11 @@ public abstract class EntityCreature extends EntityInsentient { +diff --git a/src/main/java/net/minecraft/world/entity/EntityCreature.java b/src/main/java/net/minecraft/world/entity/EntityCreature.java +index 20570580367697e37e6c45147168c3beb6c8d31b..831414980d40f4382cf7370db28dd8fae534384b 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityCreature.java ++++ b/src/main/java/net/minecraft/world/entity/EntityCreature.java +@@ -48,8 +48,11 @@ public abstract class EntityCreature extends EntityInsentient { if (this instanceof EntityTameableAnimal && ((EntityTameableAnimal) this).isSitting()) { if (f > entity.world.paperConfig.maxLeashDistance) { // Paper @@ -22,7 +22,7 @@ index eaa10d6e3a3c37b83fed58637941273fee9b0be8..2a5160a937a6a9968f9357c5ea3e4ced } return; -@@ -50,8 +53,11 @@ public abstract class EntityCreature extends EntityInsentient { +@@ -57,8 +60,11 @@ public abstract class EntityCreature extends EntityInsentient { this.x(f); if (f > entity.world.paperConfig.maxLeashDistance) { // Paper @@ -36,11 +36,11 @@ index eaa10d6e3a3c37b83fed58637941273fee9b0be8..2a5160a937a6a9968f9357c5ea3e4ced this.goalSelector.a(PathfinderGoal.Type.MOVE); } else if (f > 6.0F) { double d0 = (entity.locX() - this.locX()) / (double) f; -diff --git a/src/main/java/net/minecraft/server/EntityInsentient.java b/src/main/java/net/minecraft/server/EntityInsentient.java -index eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f..a88521745f9f9b6935a61db52db915ea483af227 100644 ---- a/src/main/java/net/minecraft/server/EntityInsentient.java -+++ b/src/main/java/net/minecraft/server/EntityInsentient.java -@@ -20,6 +20,7 @@ import org.bukkit.event.entity.EntityTargetEvent; +diff --git a/src/main/java/net/minecraft/world/entity/EntityInsentient.java b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +index 7e608cc9ff4a03a6b1eac5c74c072ac5febc38c3..b618a10e18281e33529cda83eb1e154c0fe4cb69 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityInsentient.java ++++ b/src/main/java/net/minecraft/world/entity/EntityInsentient.java +@@ -85,6 +85,7 @@ import org.bukkit.event.entity.EntityTargetEvent; import org.bukkit.event.entity.EntityTransformEvent; import org.bukkit.event.entity.EntityUnleashEvent; import org.bukkit.event.entity.EntityUnleashEvent.UnleashReason; @@ -48,7 +48,7 @@ index eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f..a88521745f9f9b6935a61db52db915ea // CraftBukkit end public abstract class EntityInsentient extends EntityLiving { -@@ -1139,12 +1140,15 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1204,12 +1205,15 @@ public abstract class EntityInsentient extends EntityLiving { return EnumInteractionResult.PASS; } else if (this.getLeashHolder() == entityhuman) { // CraftBukkit start - fire PlayerUnleashEntityEvent @@ -66,7 +66,7 @@ index eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f..a88521745f9f9b6935a61db52db915ea return EnumInteractionResult.a(this.world.isClientSide); } else { EnumInteractionResult enuminteractionresult = this.c(entityhuman, enumhand); -@@ -1298,8 +1302,11 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1363,8 +1367,11 @@ public abstract class EntityInsentient extends EntityLiving { if (this.leashHolder != null) { if (!this.isAlive() || !this.leashHolder.isAlive()) { @@ -80,7 +80,7 @@ index eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f..a88521745f9f9b6935a61db52db915ea } } -@@ -1367,8 +1374,11 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1432,8 +1439,11 @@ public abstract class EntityInsentient extends EntityLiving { boolean flag1 = super.a(entity, flag); if (flag1 && this.isLeashed()) { @@ -94,7 +94,7 @@ index eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f..a88521745f9f9b6935a61db52db915ea } return flag1; -@@ -1570,7 +1580,10 @@ public abstract class EntityInsentient extends EntityLiving { +@@ -1635,7 +1645,10 @@ public abstract class EntityInsentient extends EntityLiving { @Override protected void bN() { super.bN(); @@ -107,19 +107,20 @@ index eb5c3a1f0d9ff665631caf5bf579e83d1ed25e4f..a88521745f9f9b6935a61db52db915ea + // Paper end } } -diff --git a/src/main/java/net/minecraft/server/EntityLeash.java b/src/main/java/net/minecraft/server/EntityLeash.java -index 6bd25833bc3ff3ca46367a48da001ed9bda8c19d..5e4652e997362e7c3fac05ac8a4fcdd6051c4f4a 100644 ---- a/src/main/java/net/minecraft/server/EntityLeash.java -+++ b/src/main/java/net/minecraft/server/EntityLeash.java -@@ -5,6 +5,7 @@ import java.util.List; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java b/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java +index 8f6d2a6a388021f437ac5554e9ece8eca89e1f46..519f0cabadcf97a44a112fd963a8d3ab194650c4 100644 +--- a/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java ++++ b/src/main/java/net/minecraft/world/entity/decoration/EntityLeash.java +@@ -30,6 +30,8 @@ import net.minecraft.server.level.WorldServer; + import org.bukkit.craftbukkit.event.CraftEventFactory; + // CraftBukkit end - import org.bukkit.craftbukkit.event.CraftEventFactory; // CraftBukkit +import org.bukkit.event.player.PlayerUnleashEntityEvent; // Paper - ++ public class EntityLeash extends EntityHanging { -@@ -101,11 +102,14 @@ public class EntityLeash extends EntityHanging { + public EntityLeash(EntityTypes entitytypes, World world) { +@@ -125,11 +127,14 @@ public class EntityLeash extends EntityHanging { entityinsentient = (EntityInsentient) iterator.next(); if (entityinsentient.isLeashed() && entityinsentient.getLeashHolder() == this) { // CraftBukkit start @@ -137,10 +138,10 @@ index 6bd25833bc3ff3ca46367a48da001ed9bda8c19d..5e4652e997362e7c3fac05ac8a4fcdd6 } } diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index a7ac877014853bb2b2e826ad6950da959f56b268..479270bae88f10de80c6fe97536ac7d2c198a6f2 100644 +index ed006c05510cd4113463efff6d28791275c2b214..c0a66ca6c8f32cbd04cebfbb0e6f2ea668295cf0 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -1448,8 +1448,10 @@ public class CraftEventFactory { +@@ -1447,8 +1447,10 @@ public class CraftEventFactory { return itemInHand; } diff --git a/Spigot-Server-Patches/0665-Skip-distance-map-update-when-spawning-disabled.patch b/Spigot-Server-Patches/0665-Skip-distance-map-update-when-spawning-disabled.patch index def8b55602..3f37100ac5 100644 --- a/Spigot-Server-Patches/0665-Skip-distance-map-update-when-spawning-disabled.patch +++ b/Spigot-Server-Patches/0665-Skip-distance-map-update-when-spawning-disabled.patch @@ -4,11 +4,11 @@ Date: Fri, 14 Feb 2020 19:39:59 +0000 Subject: [PATCH] Skip distance map update when spawning disabled. -diff --git a/src/main/java/net/minecraft/server/ChunkProviderServer.java b/src/main/java/net/minecraft/server/ChunkProviderServer.java -index 12e417d2fe8e7f6a2f664ef916c141305ce1b29c..0ea1b25bf98d71c251351807fa92d4d08eb6b06e 100644 ---- a/src/main/java/net/minecraft/server/ChunkProviderServer.java -+++ b/src/main/java/net/minecraft/server/ChunkProviderServer.java -@@ -800,7 +800,7 @@ public class ChunkProviderServer extends IChunkProvider { +diff --git a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +index 3a7b7df4080c04b618dfaf0b47cc54293332c41d..f74d027fc1b4ffaaa056eec697eccf8bf54271e5 100644 +--- a/src/main/java/net/minecraft/server/level/ChunkProviderServer.java ++++ b/src/main/java/net/minecraft/server/level/ChunkProviderServer.java +@@ -822,7 +822,7 @@ public class ChunkProviderServer extends IChunkProvider { int l = this.chunkMapDistance.b(); // Paper start - per player mob spawning SpawnerCreature.d spawnercreature_d; // moved down diff --git a/Spigot-Server-Patches/0666-Reset-shield-blocking-on-dimension-change.patch b/Spigot-Server-Patches/0666-Reset-shield-blocking-on-dimension-change.patch index 4811b72338..2f3f867f20 100644 --- a/Spigot-Server-Patches/0666-Reset-shield-blocking-on-dimension-change.patch +++ b/Spigot-Server-Patches/0666-Reset-shield-blocking-on-dimension-change.patch @@ -4,11 +4,11 @@ Date: Sun, 24 Jan 2021 08:55:19 -0800 Subject: [PATCH] Reset shield blocking on dimension change -diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java -index 3f480b6a419403536d87194525a82c5d3745963a..17f6031558d98182c32b3df3fb60daf528d5e684 100644 ---- a/src/main/java/net/minecraft/server/EntityPlayer.java -+++ b/src/main/java/net/minecraft/server/EntityPlayer.java -@@ -987,6 +987,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { +diff --git a/src/main/java/net/minecraft/server/level/EntityPlayer.java b/src/main/java/net/minecraft/server/level/EntityPlayer.java +index a2971272602f5c2556ccb46042926617138a1d55..667bb0288324f8be79b6a5e4c22c784fdeae4327 100644 +--- a/src/main/java/net/minecraft/server/level/EntityPlayer.java ++++ b/src/main/java/net/minecraft/server/level/EntityPlayer.java +@@ -1114,6 +1114,11 @@ public class EntityPlayer extends EntityHuman implements ICrafting { this.world.getServer().getPluginManager().callEvent(changeEvent); // CraftBukkit end } diff --git a/Spigot-Server-Patches/0667-add-DragonEggFormEvent.patch b/Spigot-Server-Patches/0667-add-DragonEggFormEvent.patch index ef80ead904..609439176d 100644 --- a/Spigot-Server-Patches/0667-add-DragonEggFormEvent.patch +++ b/Spigot-Server-Patches/0667-add-DragonEggFormEvent.patch @@ -4,19 +4,19 @@ Date: Mon, 25 Jan 2021 14:53:57 +0100 Subject: [PATCH] add DragonEggFormEvent -diff --git a/src/main/java/net/minecraft/server/EnderDragonBattle.java b/src/main/java/net/minecraft/server/EnderDragonBattle.java -index 7f11adbc5d8527b50f7657d46459516a471017b3..0d8fba494ed11ad79201dfd1c7f3ad5b288ca0ca 100644 ---- a/src/main/java/net/minecraft/server/EnderDragonBattle.java -+++ b/src/main/java/net/minecraft/server/EnderDragonBattle.java -@@ -15,6 +15,7 @@ import java.util.function.Predicate; - import javax.annotation.Nullable; +diff --git a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +index 80fcceec519ef59d057d27a81fcd0649a20447da..0ab6319aa3e4e1f5679f37be36999ca56ca2484c 100644 +--- a/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java ++++ b/src/main/java/net/minecraft/world/level/dimension/end/EnderDragonBattle.java +@@ -57,6 +57,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeature + import net.minecraft.world.phys.AxisAlignedBB; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +import io.papermc.paper.event.block.DragonEggFormEvent; // Paper - DragonEggFormEvent public class EnderDragonBattle { -@@ -358,9 +359,24 @@ public class EnderDragonBattle { +@@ -400,9 +401,24 @@ public class EnderDragonBattle { this.bossBattle.setVisible(false); this.generateExitPortal(true); this.n(); @@ -42,11 +42,11 @@ index 7f11adbc5d8527b50f7657d46459516a471017b3..0d8fba494ed11ad79201dfd1c7f3ad5b this.previouslyKilled = true; this.dragonKilled = true; -diff --git a/src/main/java/net/minecraft/server/WorldGenEndTrophy.java b/src/main/java/net/minecraft/server/WorldGenEndTrophy.java -index dde3c2553adf29b6c97aa9a17b666f2e8ad4d2e6..441f3b6d57f128644ad952ab7f2d090d2140bd0c 100644 ---- a/src/main/java/net/minecraft/server/WorldGenEndTrophy.java -+++ b/src/main/java/net/minecraft/server/WorldGenEndTrophy.java -@@ -5,7 +5,7 @@ import java.util.Random; +diff --git a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java +index 18395a3b4a7df1c99e952b9c8e738f165648eba5..851b8c2a86d7155278b49c44c6db8b1cbd2065f2 100644 +--- a/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java ++++ b/src/main/java/net/minecraft/world/level/levelgen/feature/WorldGenEndTrophy.java +@@ -14,7 +14,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.WorldGenFeature public class WorldGenEndTrophy extends WorldGenerator { @@ -55,7 +55,7 @@ index dde3c2553adf29b6c97aa9a17b666f2e8ad4d2e6..441f3b6d57f128644ad952ab7f2d090d private final boolean ab; public WorldGenEndTrophy(boolean flag) { -@@ -13,7 +13,7 @@ public class WorldGenEndTrophy extends WorldGenerator 0; // Paper ++ worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper + TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper + + this.methodProfiler.a(() -> { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 0bd2ce4f27182c4190892c0a20ab6d99727f27b9..25d69db585c77da26d579c8a5d5dee1014031441 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -209,6 +209,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { + public final Convertable.ConversionSession convertable; + public final UUID uuid; + boolean hasPhysicsEvent = true; // Paper ++ boolean hasEntityMoveEvent = false; // Paper + private static Throwable getAddToWorldStackTrace(Entity entity) { + return new Throwable(entity + " Added to world at " + new java.util.Date()); + } +diff --git a/src/main/java/net/minecraft/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java +index 3a1eb1570f76f13d1633a24b7fa7ed448b705978..088a5f7ed100ccc963e26573292e42099ddef6d5 100644 +--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java ++++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java @@ -10,6 +10,7 @@ import com.mojang.datafixers.util.Pair; import com.mojang.serialization.DataResult; import com.mojang.serialization.Dynamic; @@ -16,7 +48,7 @@ index b89eba804ab6cb6735bfcc6dd0219b468126e982..9a79371b40803947ed5deef68c50d456 import java.util.Collection; import java.util.ConcurrentModificationException; import java.util.Iterator; -@@ -2818,6 +2819,20 @@ public abstract class EntityLiving extends Entity { +@@ -2911,6 +2912,20 @@ public abstract class EntityLiving extends Entity { this.collideNearby(); this.world.getMethodProfiler().exit(); @@ -37,35 +69,3 @@ index b89eba804ab6cb6735bfcc6dd0219b468126e982..9a79371b40803947ed5deef68c50d456 if (!this.world.isClientSide && this.dO() && this.aG()) { this.damageEntity(DamageSource.DROWN, 1.0F); } -diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index 20f44f9952d94aebc64b3ccd9271592bb0890735..b29705cb25423e2017f5b38cfa7affa738e0e592 100644 ---- a/src/main/java/net/minecraft/server/MinecraftServer.java -+++ b/src/main/java/net/minecraft/server/MinecraftServer.java -@@ -12,6 +12,7 @@ import com.mojang.datafixers.DataFixer; - import io.netty.buffer.ByteBuf; - import io.netty.buffer.ByteBufOutputStream; - import io.netty.buffer.Unpooled; -+import io.papermc.paper.event.entity.EntityMoveEvent; - import it.unimi.dsi.fastutil.longs.LongIterator; - import java.awt.image.BufferedImage; - import java.io.BufferedWriter; -@@ -1336,6 +1337,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant 0; // Paper -+ worldserver.hasEntityMoveEvent = EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper - TileEntityHopper.skipHopperEvents = worldserver.paperConfig.disableHopperMoveEvents || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper - - this.methodProfiler.a(() -> { -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 53d3e1561ea33c38de5dc5dde181439153fa2775..466bb6297bd3bf7bb0ff1f4d0bd1f4ddfe294fa2 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -100,6 +100,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { - public final Convertable.ConversionSession convertable; - public final UUID uuid; - boolean hasPhysicsEvent = true; // Paper -+ boolean hasEntityMoveEvent = false; // Paper - private static Throwable getAddToWorldStackTrace(Entity entity) { - return new Throwable(entity + " Added to world at " + new java.util.Date()); - } diff --git a/Spigot-Server-Patches/0669-added-option-to-disable-pathfinding-updates-on-block.patch b/Spigot-Server-Patches/0669-added-option-to-disable-pathfinding-updates-on-block.patch index 565c4df9b7..690f7e9c68 100644 --- a/Spigot-Server-Patches/0669-added-option-to-disable-pathfinding-updates-on-block.patch +++ b/Spigot-Server-Patches/0669-added-option-to-disable-pathfinding-updates-on-block.patch @@ -18,11 +18,11 @@ index ac96011d4e104c99bb37833d91b8121f03b9d349..0776e68340b0510cc99084bea80791d5 + updatePathfindingOnBlockUpdate = getBoolean("update-pathfinding-on-block-update", this.updatePathfindingOnBlockUpdate); + } } -diff --git a/src/main/java/net/minecraft/server/WorldServer.java b/src/main/java/net/minecraft/server/WorldServer.java -index 466bb6297bd3bf7bb0ff1f4d0bd1f4ddfe294fa2..cf7d94aabab600822eb5e27f38690b06456d5fcc 100644 ---- a/src/main/java/net/minecraft/server/WorldServer.java -+++ b/src/main/java/net/minecraft/server/WorldServer.java -@@ -1571,6 +1571,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +diff --git a/src/main/java/net/minecraft/server/level/WorldServer.java b/src/main/java/net/minecraft/server/level/WorldServer.java +index 25d69db585c77da26d579c8a5d5dee1014031441..b4db139720e803c72b5a835646548b10f1d99ea0 100644 +--- a/src/main/java/net/minecraft/server/level/WorldServer.java ++++ b/src/main/java/net/minecraft/server/level/WorldServer.java +@@ -1680,6 +1680,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { @Override public void notify(BlockPosition blockposition, IBlockData iblockdata, IBlockData iblockdata1, int i) { this.getChunkProvider().flagDirty(blockposition); @@ -30,7 +30,7 @@ index 466bb6297bd3bf7bb0ff1f4d0bd1f4ddfe294fa2..cf7d94aabab600822eb5e27f38690b06 VoxelShape voxelshape = iblockdata.getCollisionShape(this, blockposition); VoxelShape voxelshape1 = iblockdata1.getCollisionShape(this, blockposition); -@@ -1599,6 +1600,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { +@@ -1708,6 +1709,7 @@ public class WorldServer extends World implements GeneratorAccessSeed { this.tickingEntities = wasTicking; // Paper } diff --git a/Spigot-Server-Patches/0670-Inline-shift-direction-fields.patch b/Spigot-Server-Patches/0670-Inline-shift-direction-fields.patch index 72b0485651..e044ac5972 100644 --- a/Spigot-Server-Patches/0670-Inline-shift-direction-fields.patch +++ b/Spigot-Server-Patches/0670-Inline-shift-direction-fields.patch @@ -6,11 +6,11 @@ Subject: [PATCH] Inline shift direction fields Removes a layer of indirection for EnumDirection.getAdjacent(X|Y|Z)(), which is in the critical section for much of the server, including the lighting engine. -diff --git a/src/main/java/net/minecraft/server/EnumDirection.java b/src/main/java/net/minecraft/server/EnumDirection.java -index 1aa070db60f5473576fb5d056cadde5106766489..05b0090ae36cf61f67e26aad478df30c89f31941 100644 ---- a/src/main/java/net/minecraft/server/EnumDirection.java -+++ b/src/main/java/net/minecraft/server/EnumDirection.java -@@ -49,6 +49,11 @@ public enum EnumDirection implements INamable { +diff --git a/src/main/java/net/minecraft/core/EnumDirection.java b/src/main/java/net/minecraft/core/EnumDirection.java +index a699005582293326076eaa80655c5343e6c22ff0..703bdefeb615ef8d15b428a893b5e4939d726f13 100644 +--- a/src/main/java/net/minecraft/core/EnumDirection.java ++++ b/src/main/java/net/minecraft/core/EnumDirection.java +@@ -53,6 +53,11 @@ public enum EnumDirection implements INamable { }, (enumdirection, enumdirection1) -> { throw new IllegalArgumentException("Duplicate keys"); }, Long2ObjectOpenHashMap::new)); @@ -22,7 +22,7 @@ index 1aa070db60f5473576fb5d056cadde5106766489..05b0090ae36cf61f67e26aad478df30c private EnumDirection(int i, int j, int k, String s, EnumDirection.EnumAxisDirection enumdirection_enumaxisdirection, EnumDirection.EnumAxis enumdirection_enumaxis, BaseBlockPosition baseblockposition) { this.g = i; -@@ -58,6 +63,11 @@ public enum EnumDirection implements INamable { +@@ -62,6 +67,11 @@ public enum EnumDirection implements INamable { this.k = enumdirection_enumaxis; this.l = enumdirection_enumaxisdirection; this.m = baseblockposition; @@ -34,7 +34,7 @@ index 1aa070db60f5473576fb5d056cadde5106766489..05b0090ae36cf61f67e26aad478df30c } public static EnumDirection[] a(Entity entity) { -@@ -133,15 +143,15 @@ public enum EnumDirection implements INamable { +@@ -137,15 +147,15 @@ public enum EnumDirection implements INamable { } public int getAdjacentX() { diff --git a/Spigot-Server-Patches/0671-Allow-adding-items-to-BlockDropItemEvent.patch b/Spigot-Server-Patches/0671-Allow-adding-items-to-BlockDropItemEvent.patch index ed33086039..f15a692696 100644 --- a/Spigot-Server-Patches/0671-Allow-adding-items-to-BlockDropItemEvent.patch +++ b/Spigot-Server-Patches/0671-Allow-adding-items-to-BlockDropItemEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Allow adding items to BlockDropItemEvent diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -index 479270bae88f10de80c6fe97536ac7d2c198a6f2..82e36ba35c0bd4d5b3e13281bad1a0664c25c6e0 100644 +index c0a66ca6c8f32cbd04cebfbb0e6f2ea668295cf0..9687d864311d6fb98c5c5b535073e0bc0601112a 100644 --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java -@@ -381,13 +381,30 @@ public class CraftEventFactory { +@@ -380,13 +380,30 @@ public class CraftEventFactory { } public static void handleBlockDropItemEvent(Block block, BlockState state, EntityPlayer player, List items) { diff --git a/Spigot-Server-Patches/0673-living-entity-allow-attribute-registration.patch b/Spigot-Server-Patches/0673-living-entity-allow-attribute-registration.patch index e6ddc4d971..3f8f8f25e0 100644 --- a/Spigot-Server-Patches/0673-living-entity-allow-attribute-registration.patch +++ b/Spigot-Server-Patches/0673-living-entity-allow-attribute-registration.patch @@ -4,11 +4,11 @@ Date: Sat, 24 Oct 2020 16:37:44 +0200 Subject: [PATCH] living entity allow attribute registration -diff --git a/src/main/java/net/minecraft/server/AttributeMapBase.java b/src/main/java/net/minecraft/server/AttributeMapBase.java -index c57e23e16b79017fe6dc084d634226cfdac772b5..f5f2f31e88433d894ff1e7c2f26686f671744c56 100644 ---- a/src/main/java/net/minecraft/server/AttributeMapBase.java -+++ b/src/main/java/net/minecraft/server/AttributeMapBase.java -@@ -16,7 +16,7 @@ import org.apache.logging.log4j.Logger; +diff --git a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java +index 8f6b78c68da555f96033df567da581af52195e6c..efced2c92dc56da9cc60d7eeb3661eb5e40e634b 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java ++++ b/src/main/java/net/minecraft/world/entity/ai/attributes/AttributeMapBase.java +@@ -21,7 +21,7 @@ import org.apache.logging.log4j.Logger; public class AttributeMapBase { private static final Logger LOGGER = LogManager.getLogger(); @@ -17,7 +17,7 @@ index c57e23e16b79017fe6dc084d634226cfdac772b5..f5f2f31e88433d894ff1e7c2f26686f6 private final Set c = Sets.newHashSet(); private final AttributeProvider d; -@@ -130,4 +130,12 @@ public class AttributeMapBase { +@@ -135,4 +135,12 @@ public class AttributeMapBase { } } @@ -31,7 +31,7 @@ index c57e23e16b79017fe6dc084d634226cfdac772b5..f5f2f31e88433d894ff1e7c2f26686f6 + } diff --git a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java -index c5dd25add39298342a6f4b2a05e137de93d1e62b..e343878a1755ee885f84c082ccba2777927c64bb 100644 +index 673948947bd918c1dbb6c4c99486b4200e3c09fe..2e83b8855070077e90e5ab2c4beae819c620e480 100644 --- a/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java +++ b/src/main/java/org/bukkit/craftbukkit/attribute/CraftAttributeMap.java @@ -40,6 +40,14 @@ public class CraftAttributeMap implements Attributable { @@ -50,7 +50,7 @@ index c5dd25add39298342a6f4b2a05e137de93d1e62b..e343878a1755ee885f84c082ccba2777 return IRegistry.ATTRIBUTE.get(CraftNamespacedKey.toMinecraft(attribute.getKey())); } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java -index 16e69cfd4994fd6850ee3635ea819379412351c9..c1350bbf62fc5c5e18509f378edf16e8b210cfe8 100644 +index 07a8d184038231b5f1a9c112c978528aaf79f34b..4c3bad053d15c50cad2715e459ec0ace45ee1580 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftLivingEntity.java @@ -665,6 +665,13 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity { diff --git a/Spigot-Server-Patches/0675-Merchant-getRecipes-should-return-an-immutable-list.patch b/Spigot-Server-Patches/0675-Merchant-getRecipes-should-return-an-immutable-list.patch index 396542d64a..f368eba156 100644 --- a/Spigot-Server-Patches/0675-Merchant-getRecipes-should-return-an-immutable-list.patch +++ b/Spigot-Server-Patches/0675-Merchant-getRecipes-should-return-an-immutable-list.patch @@ -5,15 +5,15 @@ Subject: [PATCH] Merchant#getRecipes should return an immutable list diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java -index 50bc720d4268804f53b204091c9e8f0c17d8dd23..7159d73ac5c3ef881d9635d64e82847ac3731e22 100644 +index 00d43e4a77ed03bc9672cbaccad50b48aed0fb93..3c66d9217eb0b60595a59e2f296de332095d4a4c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMerchant.java @@ -25,7 +25,7 @@ public class CraftMerchant implements Merchant { @Override public List getRecipes() { -- return Collections.unmodifiableList(Lists.transform(merchant.getOffers(), new Function() { -+ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) +- return Collections.unmodifiableList(Lists.transform(merchant.getOffers(), new Function() { ++ return com.google.common.collect.ImmutableList.copyOf(Lists.transform(merchant.getOffers(), new Function() { // Paper - javadoc says 'an immutable list of trades' - not 'an unmodifiable view of a list of trades'. fixes issue with setRecipes(getRecipes()) @Override - public MerchantRecipe apply(net.minecraft.server.MerchantRecipe recipe) { + public MerchantRecipe apply(net.minecraft.world.item.trading.MerchantRecipe recipe) { return recipe.asBukkit(); diff --git a/Spigot-Server-Patches/0676-misc-debugging-dumps.patch b/Spigot-Server-Patches/0676-misc-debugging-dumps.patch index f1186ecec0..274c4c056f 100644 --- a/Spigot-Server-Patches/0676-misc-debugging-dumps.patch +++ b/Spigot-Server-Patches/0676-misc-debugging-dumps.patch @@ -29,7 +29,7 @@ index 0000000000000000000000000000000000000000..2d5494d2813b773e60ddba6790b750a9 + } +} diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java -index b29705cb25423e2017f5b38cfa7affa738e0e592..c572ef2830f2653e2b30622bbac0a3b072bacd7a 100644 +index 36823b17aea61af9b0bf4565e3b33ade95f50c97..e6e54b1a9d3fbe4da72bf096af7db8d8844a8e55 100644 --- a/src/main/java/net/minecraft/server/MinecraftServer.java +++ b/src/main/java/net/minecraft/server/MinecraftServer.java @@ -13,6 +13,7 @@ import io.netty.buffer.ByteBuf; @@ -40,7 +40,7 @@ index b29705cb25423e2017f5b38cfa7affa738e0e592..c572ef2830f2653e2b30622bbac0a3b0 import it.unimi.dsi.fastutil.longs.LongIterator; import java.awt.image.BufferedImage; import java.io.BufferedWriter; -@@ -733,6 +734,7 @@ public abstract class MinecraftServer extends IAsyncTaskHandlerReentrant { +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java +index 418cd6d8b40d35aa3be73eb12f2e3b75597238b9..2e3149a0b15299468079796bd3ea56eabdb4998c 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestItems.java +@@ -27,18 +27,16 @@ public class SensorNearestItems extends Sensor { List list = worldserver.a(EntityItem.class, entityinsentient.getBoundingBox().grow(8.0D, 4.0D, 8.0D), (entityitem) -> { return true; }); @@ -51,11 +51,11 @@ index 2e747158d48ab28ac1611990cc97aa4a9e30b30e..edf7d31e8e06f67be58282b2a76d1ac8 + // Paper end } } -diff --git a/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java b/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java -index f6568a54ab85bc3a682f6fbb19dda7a783625bbe..b3388d4a665e8f91083a2e746482a9f0bd988da1 100644 ---- a/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java -+++ b/src/main/java/net/minecraft/server/SensorNearestLivingEntities.java -@@ -21,10 +21,12 @@ public class SensorNearestLivingEntities extends Sensor { +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java +index d3bb1c02d80fcd3586030b07f84e7ebdd97d873e..0bc17d148e91277efdf72541e5470fa56d455670 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestLivingEntities.java +@@ -26,10 +26,12 @@ public class SensorNearestLivingEntities extends Sensor { list.sort(Comparator.comparingDouble(entityliving::h)); BehaviorController behaviorcontroller = entityliving.getBehaviorController(); @@ -72,11 +72,11 @@ index f6568a54ab85bc3a682f6fbb19dda7a783625bbe..b3388d4a665e8f91083a2e746482a9f0 } @Override -diff --git a/src/main/java/net/minecraft/server/SensorNearestPlayers.java b/src/main/java/net/minecraft/server/SensorNearestPlayers.java -index 904a6d5ac61d2ac81f1057068383e9ab432852db..ae946619f10a757171e4217e414d6a5248a45494 100644 ---- a/src/main/java/net/minecraft/server/SensorNearestPlayers.java -+++ b/src/main/java/net/minecraft/server/SensorNearestPlayers.java -@@ -19,22 +19,26 @@ public class SensorNearestPlayers extends Sensor { +diff --git a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java +index 29abc7feec5358dce7d16958f0c5807f4bda992f..60e4da9217d4d950b5077baf6b50eaee20f8df09 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java ++++ b/src/main/java/net/minecraft/world/entity/ai/sensing/SensorNearestPlayers.java +@@ -26,22 +26,26 @@ public class SensorNearestPlayers extends Sensor { @Override protected void a(WorldServer worldserver, EntityLiving entityliving) { diff --git a/Spigot-Server-Patches/0681-do-not-create-unnecessary-copies-of-passenger-list.patch b/Spigot-Server-Patches/0681-do-not-create-unnecessary-copies-of-passenger-list.patch index faa2abc2f3..11c76f2b57 100644 --- a/Spigot-Server-Patches/0681-do-not-create-unnecessary-copies-of-passenger-list.patch +++ b/Spigot-Server-Patches/0681-do-not-create-unnecessary-copies-of-passenger-list.patch @@ -4,11 +4,63 @@ Date: Sun, 13 Dec 2020 13:42:55 +0100 Subject: [PATCH] do not create unnecessary copies of passenger list -diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java -index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9c0504089 100644 ---- a/src/main/java/net/minecraft/server/Entity.java -+++ b/src/main/java/net/minecraft/server/Entity.java -@@ -2138,7 +2138,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +diff --git a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java +index edc6fff87c4abad2c123b1a46d6e5b792602b3be..5e739b26b6b5490b2c7651d3e9ff8649e776137e 100644 +--- a/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java ++++ b/src/main/java/net/minecraft/network/protocol/game/PacketPlayOutMount.java +@@ -15,7 +15,7 @@ public class PacketPlayOutMount implements Packet { + + public PacketPlayOutMount(Entity entity) { + this.a = entity.getId(); +- List list = entity.getPassengers(); ++ List list = entity.passengers; // Paper - do not create a copy of the list + + this.b = new int[list.size()]; + +diff --git a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +index aa5ba862f18ff706f11b0b26cea55a904a5a9473..f65eb0168ed365e5c1b490c56ec84e3b7ff87c1d 100644 +--- a/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java ++++ b/src/main/java/net/minecraft/server/level/EntityTrackerEntry.java +@@ -103,10 +103,10 @@ public class EntityTrackerEntry { + + public final void tick() { this.a(); } // Paper - OBFHELPER + public void a() { +- List list = this.tracker.getPassengers(); ++ List list = this.tracker.passengers; // Paper - do not copy list + + if (!list.equals(this.p)) { +- this.p = list; ++ this.p = com.google.common.collect.ImmutableList.copyOf(list); // Paper - only copy list if something has changed + this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit + } + +@@ -377,7 +377,7 @@ public class EntityTrackerEntry { + } + } + +- if (!this.tracker.getPassengers().isEmpty()) { ++ if (!this.tracker.passengers.isEmpty()) { // Paper - do not create copy of list + consumer.accept(new PacketPlayOutMount(this.tracker)); + } + +diff --git a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +index f3f906d8ffa195b100d5bd2d232ae8489d48d60d..5e5545f16daf20682e7984e1b4d3ffa0151ad1c1 100644 +--- a/src/main/java/net/minecraft/server/level/PlayerChunkMap.java ++++ b/src/main/java/net/minecraft/server/level/PlayerChunkMap.java +@@ -2297,7 +2297,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially + list.add(entity); + } + +- if (!entity.getPassengers().isEmpty()) { ++ if (!entity.passengers.isEmpty()) { // Paper - do not copy list + list1.add(entity); + } + } +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index bb3211d0177f569b018852fc2a9094431e952b02..f88af0aa6a86d7d2f7e12b710fce4d37c9ee421f 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -2223,7 +2223,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } protected boolean q(Entity entity) { @@ -17,7 +69,7 @@ index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9 } public final float getCollisionBorderSize() { return bg(); } // Paper - OBFHELPER -@@ -2234,7 +2234,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -2319,7 +2319,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean isVehicle() { @@ -26,7 +78,7 @@ index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9 } public boolean bt() { -@@ -3046,7 +3046,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3131,7 +3131,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean w(Entity entity) { @@ -35,7 +87,7 @@ index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9 Entity entity1; -@@ -3062,7 +3062,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3147,7 +3147,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne } public boolean a(Class oclass) { @@ -44,7 +96,7 @@ index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9 Entity entity; -@@ -3079,7 +3079,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3164,7 +3164,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne public Collection getAllPassengers() { Set set = Sets.newHashSet(); @@ -53,7 +105,7 @@ index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9 while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); -@@ -3105,7 +3105,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke +@@ -3190,7 +3190,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne private void a(boolean flag, Set set) { Entity entity; @@ -62,11 +114,63 @@ index e87e1b04e13593f1efa4d1c59cb9e433f2b3c694..534238688be75c53058dcfeabcdf86d9 entity = (Entity) iterator.next(); if (!flag || EntityPlayer.class.isAssignableFrom(entity.getClass())) { set.add(entity); -diff --git a/src/main/java/net/minecraft/server/EntityBoat.java b/src/main/java/net/minecraft/server/EntityBoat.java -index baa4a61114e7460c74027e1519332f0dd9582647..15ce9f90306d062f36d1651d7426813e897523bf 100644 ---- a/src/main/java/net/minecraft/server/EntityBoat.java -+++ b/src/main/java/net/minecraft/server/EntityBoat.java -@@ -272,7 +272,7 @@ public class EntityBoat extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java +index ec51a5532576ce25465bacf61c716ddaffca514e..d285f5aa66fa81a2f56920c05afb4506cb82fa54 100644 +--- a/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java ++++ b/src/main/java/net/minecraft/world/entity/ai/goal/PathfinderGoalTame.java +@@ -52,7 +52,7 @@ public class PathfinderGoalTame extends PathfinderGoal { + @Override + public void e() { + if (!this.entity.isTamed() && this.entity.getRandom().nextInt(50) == 0) { +- Entity entity = (Entity) this.entity.getPassengers().get(0); ++ Entity entity = this.entity.passengers.isEmpty() ? null : this.entity.passengers.get(0); // Paper - do not copy list, fixed array out of bounds exception as well + + if (entity == null) { + return; +diff --git a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java +index d6e1697f64e60f2a567288c604a1690159955f37..676ca381a5e111fc15f319e73504e4e60dbf0d2b 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/EntityPig.java ++++ b/src/main/java/net/minecraft/world/entity/animal/EntityPig.java +@@ -86,7 +86,7 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { + @Nullable + @Override + public Entity getRidingPassenger() { +- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); ++ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +index d678e3164ecdb7f0c600597bcb39d1054dfbc4b2..1e41c45af6dbcf097d7d6104e63db637f199301a 100644 +--- a/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/animal/horse/EntityHorseAbstract.java +@@ -972,7 +972,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven + @Nullable + @Override + public Entity getRidingPassenger() { +- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); ++ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list + } + + @Nullable +diff --git a/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java b/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java +index 7781386da593a1c4f3ad7e7e8761767dda7cb66c..16d5cae64887b82e67eeb61ccb714e6125ff0c09 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EntityRavager.java +@@ -134,7 +134,7 @@ public class EntityRavager extends EntityRaider { + @Nullable + @Override + public Entity getRidingPassenger() { +- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); ++ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list + } + + @Override +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +index 5ae7620be7b0b5fba6aab8173aed45dc28bf36e3..0e3fcf5facdac7f5d2d509f20cb45d5de38f72d4 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityBoat.java +@@ -316,7 +316,7 @@ public class EntityBoat extends Entity { super.tick(); this.r(); if (this.cs()) { @@ -75,7 +179,7 @@ index baa4a61114e7460c74027e1519332f0dd9582647..15ce9f90306d062f36d1651d7426813e this.a(false, false); } -@@ -335,7 +335,7 @@ public class EntityBoat extends Entity { +@@ -379,7 +379,7 @@ public class EntityBoat extends Entity { Entity entity = (Entity) list.get(j); if (!entity.w(this)) { @@ -84,7 +188,7 @@ index baa4a61114e7460c74027e1519332f0dd9582647..15ce9f90306d062f36d1651d7426813e entity.startRiding(this); } else { this.collide(entity); -@@ -682,8 +682,8 @@ public class EntityBoat extends Entity { +@@ -726,8 +726,8 @@ public class EntityBoat extends Entity { float f = 0.0F; float f1 = (float) ((this.dead ? 0.009999999776482582D : this.bc()) + entity.bb()); @@ -95,7 +199,7 @@ index baa4a61114e7460c74027e1519332f0dd9582647..15ce9f90306d062f36d1651d7426813e if (i == 0) { f = 0.2F; -@@ -702,7 +702,7 @@ public class EntityBoat extends Entity { +@@ -746,7 +746,7 @@ public class EntityBoat extends Entity { entity.yaw += this.ak; entity.setHeadRotation(entity.getHeadRotation() + this.ak); this.a(entity); @@ -104,7 +208,7 @@ index baa4a61114e7460c74027e1519332f0dd9582647..15ce9f90306d062f36d1651d7426813e int j = entity.getId() % 2 == 0 ? 90 : 270; entity.n(((EntityAnimal) entity).aA + (float) j); -@@ -862,13 +862,13 @@ public class EntityBoat extends Entity { +@@ -906,13 +906,13 @@ public class EntityBoat extends Entity { @Override protected boolean q(Entity entity) { @@ -120,24 +224,11 @@ index baa4a61114e7460c74027e1519332f0dd9582647..15ce9f90306d062f36d1651d7426813e return list.isEmpty() ? null : (Entity) list.get(0); } -diff --git a/src/main/java/net/minecraft/server/EntityHorseAbstract.java b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -index 410578d7baf08db330b708a6c5517c4986258f97..acbdaa097dfd1cba18add0a09ad54ca78d3e0c24 100644 ---- a/src/main/java/net/minecraft/server/EntityHorseAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityHorseAbstract.java -@@ -911,7 +911,7 @@ public abstract class EntityHorseAbstract extends EntityAnimal implements IInven - @Nullable - @Override - public Entity getRidingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Nullable -diff --git a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -index 022dfdc5b6af4b243e7e4da8660e8e41d04e1a30..be859a1b41254b299a507d03e453dc8efee6f3dd 100644 ---- a/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -+++ b/src/main/java/net/minecraft/server/EntityMinecartAbstract.java -@@ -522,7 +522,7 @@ public abstract class EntityMinecartAbstract extends Entity { +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +index c79474ffb455bb87bfdd98bc68b3dc8dfcdca45e..f2b905e5689ee419e9d83bb4ca671ef44ccb031f 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/EntityMinecartAbstract.java +@@ -560,7 +560,7 @@ public abstract class EntityMinecartAbstract extends Entity { vec3d1 = new Vec3D(d8 * d4 / d6, vec3d1.y, d8 * d5 / d6); this.setMot(vec3d1); @@ -146,94 +237,3 @@ index 022dfdc5b6af4b243e7e4da8660e8e41d04e1a30..be859a1b41254b299a507d03e453dc8e if (entity instanceof EntityHuman) { Vec3D vec3d2 = entity.getMot(); -diff --git a/src/main/java/net/minecraft/server/EntityPig.java b/src/main/java/net/minecraft/server/EntityPig.java -index ee94c2827cfc53f7a37e61d8c1c0c30a52374cf8..01ca5983cade997b1f0d27fdf495c74c6daa0922 100644 ---- a/src/main/java/net/minecraft/server/EntityPig.java -+++ b/src/main/java/net/minecraft/server/EntityPig.java -@@ -39,7 +39,7 @@ public class EntityPig extends EntityAnimal implements ISteerable, ISaddleable { - @Nullable - @Override - public Entity getRidingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Override -diff --git a/src/main/java/net/minecraft/server/EntityRavager.java b/src/main/java/net/minecraft/server/EntityRavager.java -index fd1ac7df68a0caebe35290cdf7a9c37519342b61..e78f158d9c682c60d42c17e0f171d492552e4079 100644 ---- a/src/main/java/net/minecraft/server/EntityRavager.java -+++ b/src/main/java/net/minecraft/server/EntityRavager.java -@@ -93,7 +93,7 @@ public class EntityRavager extends EntityRaider { - @Nullable - @Override - public Entity getRidingPassenger() { -- return this.getPassengers().isEmpty() ? null : (Entity) this.getPassengers().get(0); -+ return this.passengers.isEmpty() ? null : (Entity) this.passengers.get(0); // Paper - do not copy list - } - - @Override -diff --git a/src/main/java/net/minecraft/server/EntityTrackerEntry.java b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -index 3960a975e74ed81c45819fe5e0f01c6c18252982..f2a9396c2ec64c79391782249db7507f12a69a9e 100644 ---- a/src/main/java/net/minecraft/server/EntityTrackerEntry.java -+++ b/src/main/java/net/minecraft/server/EntityTrackerEntry.java -@@ -74,10 +74,10 @@ public class EntityTrackerEntry { - - public final void tick() { this.a(); } // Paper - OBFHELPER - public void a() { -- List list = this.tracker.getPassengers(); -+ List list = this.tracker.passengers; // Paper - do not copy list - - if (!list.equals(this.p)) { -- this.p = list; -+ this.p = com.google.common.collect.ImmutableList.copyOf(list); // Paper - only copy list if something has changed - this.broadcastIncludingSelf(new PacketPlayOutMount(this.tracker)); // CraftBukkit - } - -@@ -348,7 +348,7 @@ public class EntityTrackerEntry { - } - } - -- if (!this.tracker.getPassengers().isEmpty()) { -+ if (!this.tracker.passengers.isEmpty()) { // Paper - do not create copy of list - consumer.accept(new PacketPlayOutMount(this.tracker)); - } - -diff --git a/src/main/java/net/minecraft/server/PacketPlayOutMount.java b/src/main/java/net/minecraft/server/PacketPlayOutMount.java -index 1d495e53fb4330ac4235721238d09e7163b2cd20..c4387df2f5c66c350184407b7f5a4db80542d1f6 100644 ---- a/src/main/java/net/minecraft/server/PacketPlayOutMount.java -+++ b/src/main/java/net/minecraft/server/PacketPlayOutMount.java -@@ -12,7 +12,7 @@ public class PacketPlayOutMount implements Packet { - - public PacketPlayOutMount(Entity entity) { - this.a = entity.getId(); -- List list = entity.getPassengers(); -+ List list = entity.passengers; // Paper - do not create a copy of the list - - this.b = new int[list.size()]; - -diff --git a/src/main/java/net/minecraft/server/PathfinderGoalTame.java b/src/main/java/net/minecraft/server/PathfinderGoalTame.java -index fc831dc26eaeab802d5fee456d5c662fe3f8bdfd..8757c6487a433b1fa5c46b50c559aeca82f84b8d 100644 ---- a/src/main/java/net/minecraft/server/PathfinderGoalTame.java -+++ b/src/main/java/net/minecraft/server/PathfinderGoalTame.java -@@ -47,7 +47,7 @@ public class PathfinderGoalTame extends PathfinderGoal { - @Override - public void e() { - if (!this.entity.isTamed() && this.entity.getRandom().nextInt(50) == 0) { -- Entity entity = (Entity) this.entity.getPassengers().get(0); -+ Entity entity = this.entity.passengers.isEmpty() ? null : this.entity.passengers.get(0); // Paper - do not copy list, fixed array out of bounds exception as well - - if (entity == null) { - return; -diff --git a/src/main/java/net/minecraft/server/PlayerChunkMap.java b/src/main/java/net/minecraft/server/PlayerChunkMap.java -index 4264fab9164b8a59cbbcedfb97272413a6303ac9..00d0a5fd7c5d2db19756f3c6cfb2381868af51fd 100644 ---- a/src/main/java/net/minecraft/server/PlayerChunkMap.java -+++ b/src/main/java/net/minecraft/server/PlayerChunkMap.java -@@ -2253,7 +2253,7 @@ Sections go from 0..16. Now whenever a section is not empty, it can potentially - list.add(entity); - } - -- if (!entity.getPassengers().isEmpty()) { -+ if (!entity.passengers.isEmpty()) { // Paper - do not copy list - list1.add(entity); - } - } diff --git a/Spigot-Server-Patches/0682-MC-29274-Fix-Wither-hostility-towards-players.patch b/Spigot-Server-Patches/0682-MC-29274-Fix-Wither-hostility-towards-players.patch index 49e44638c6..ee2363ade3 100644 --- a/Spigot-Server-Patches/0682-MC-29274-Fix-Wither-hostility-towards-players.patch +++ b/Spigot-Server-Patches/0682-MC-29274-Fix-Wither-hostility-towards-players.patch @@ -19,11 +19,11 @@ index 0776e68340b0510cc99084bea80791d562dfea40..b473709774fbbd502d5e04c98041ae7c + log("Withers properly target players: " + fixWitherTargetingBug); + } } -diff --git a/src/main/java/net/minecraft/server/EntityWither.java b/src/main/java/net/minecraft/server/EntityWither.java -index 2e623ef9be036ea467e9e41817c2eced018f8f93..b1159f0258eca2bee52ec0939ba86792d24a1f99 100644 ---- a/src/main/java/net/minecraft/server/EntityWither.java -+++ b/src/main/java/net/minecraft/server/EntityWither.java -@@ -54,6 +54,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { +diff --git a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +index 891905712903bf3ba241187791cfa995375430d5..229eabe0510e6c3660236ed0fb3e80d41074642c 100644 +--- a/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java ++++ b/src/main/java/net/minecraft/world/entity/boss/wither/EntityWither.java +@@ -104,6 +104,7 @@ public class EntityWither extends EntityMonster implements IRangedEntity { this.goalSelector.a(6, new PathfinderGoalLookAtPlayer(this, EntityHuman.class, 8.0F)); this.goalSelector.a(7, new PathfinderGoalRandomLookaround(this)); this.targetSelector.a(1, new PathfinderGoalHurtByTarget(this, new Class[0])); diff --git a/Spigot-Server-Patches/0683-Throw-proper-exception-on-empty-JsonList-file.patch b/Spigot-Server-Patches/0683-Throw-proper-exception-on-empty-JsonList-file.patch index d5890e49a7..a65efb398f 100644 --- a/Spigot-Server-Patches/0683-Throw-proper-exception-on-empty-JsonList-file.patch +++ b/Spigot-Server-Patches/0683-Throw-proper-exception-on-empty-JsonList-file.patch @@ -4,11 +4,11 @@ Date: Sun, 1 Nov 2020 16:43:11 +0100 Subject: [PATCH] Throw proper exception on empty JsonList file -diff --git a/src/main/java/net/minecraft/server/JsonList.java b/src/main/java/net/minecraft/server/JsonList.java -index 1fc0139cb9694ddea41f57d95774c3b47e8530c5..8da5f976109accc84b26ec4045776aa8a9799f3d 100644 ---- a/src/main/java/net/minecraft/server/JsonList.java -+++ b/src/main/java/net/minecraft/server/JsonList.java -@@ -187,6 +187,7 @@ public abstract class JsonList> { +diff --git a/src/main/java/net/minecraft/server/players/JsonList.java b/src/main/java/net/minecraft/server/players/JsonList.java +index cd35b833d3047a38be980ee550641e87bd3b9b01..c960852dc60d0598012c5eef0d139fe38bde63fb 100644 +--- a/src/main/java/net/minecraft/server/players/JsonList.java ++++ b/src/main/java/net/minecraft/server/players/JsonList.java +@@ -189,6 +189,7 @@ public abstract class JsonList> { try { JsonArray jsonarray = (JsonArray) JsonList.b.fromJson(bufferedreader, JsonArray.class); diff --git a/Spigot-Server-Patches/0684-Improve-ServerGUI.patch b/Spigot-Server-Patches/0684-Improve-ServerGUI.patch index cec607827c..b1e5476621 100644 --- a/Spigot-Server-Patches/0684-Improve-ServerGUI.patch +++ b/Spigot-Server-Patches/0684-Improve-ServerGUI.patch @@ -39,11 +39,11 @@ index e463a86a6ad6c4f2885f4df159411bad294e1208..d21d081ef3e3eee1d14ce3dfdd8c810c + return ( ( tps > 21.0 ) ? "*" : "" ) + Math.min( Math.round( tps * 100.0 ) / 100.0, 20.0 ); + } } -diff --git a/src/main/java/net/minecraft/server/GuiStatsComponent.java b/src/main/java/net/minecraft/server/GuiStatsComponent.java -index 859e31c63f94bdc7729c6d475990750b76e24b9c..d7ed094a4f9337c42b661b1ff1bdd93b357b550f 100644 ---- a/src/main/java/net/minecraft/server/GuiStatsComponent.java -+++ b/src/main/java/net/minecraft/server/GuiStatsComponent.java -@@ -16,7 +16,7 @@ public class GuiStatsComponent extends JComponent { +diff --git a/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java b/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java +index f85a4079bb2931fd29a526379ba350eb7e8ae636..79cc587d8ad9f576f9e4478a41baabcaf690c568 100644 +--- a/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java ++++ b/src/main/java/net/minecraft/server/gui/GuiStatsComponent.java +@@ -18,7 +18,7 @@ public class GuiStatsComponent extends JComponent { }); private final int[] b = new int[256]; private int c; @@ -52,7 +52,7 @@ index 859e31c63f94bdc7729c6d475990750b76e24b9c..d7ed094a4f9337c42b661b1ff1bdd93b private final MinecraftServer e; private final Timer f; -@@ -35,8 +35,18 @@ public class GuiStatsComponent extends JComponent { +@@ -37,8 +37,18 @@ public class GuiStatsComponent extends JComponent { private void b() { long i = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory(); @@ -71,7 +71,7 @@ index 859e31c63f94bdc7729c6d475990750b76e24b9c..d7ed094a4f9337c42b661b1ff1bdd93b this.b[this.c++ & 255] = (int) (i * 100L / Runtime.getRuntime().maxMemory()); this.repaint(); } -@@ -83,4 +93,10 @@ public class GuiStatsComponent extends JComponent { +@@ -85,4 +95,10 @@ public class GuiStatsComponent extends JComponent { public void a() { this.f.stop(); } @@ -82,12 +82,12 @@ index 859e31c63f94bdc7729c6d475990750b76e24b9c..d7ed094a4f9337c42b661b1ff1bdd93b + } + // Paper end } -diff --git a/src/main/java/net/minecraft/server/ServerGUI.java b/src/main/java/net/minecraft/server/ServerGUI.java -index e51434f2323bcb9385d11e99d0438d66434e3e63..232a8c2fb98bc0d079484bea1da4e35b7f55ac0d 100644 ---- a/src/main/java/net/minecraft/server/ServerGUI.java -+++ b/src/main/java/net/minecraft/server/ServerGUI.java -@@ -29,6 +29,11 @@ import javax.swing.text.BadLocationException; - import javax.swing.text.Document; +diff --git a/src/main/java/net/minecraft/server/gui/ServerGUI.java b/src/main/java/net/minecraft/server/gui/ServerGUI.java +index c2c075b9e3b70f863b6c450e4f31d6fde2935be6..d1d98c2f192514a3f511bebb00c088b03e6be84c 100644 +--- a/src/main/java/net/minecraft/server/gui/ServerGUI.java ++++ b/src/main/java/net/minecraft/server/gui/ServerGUI.java +@@ -31,6 +31,11 @@ import net.minecraft.DefaultUncaughtExceptionHandler; + import net.minecraft.server.dedicated.DedicatedServer; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; +// Paper start @@ -98,7 +98,7 @@ index e51434f2323bcb9385d11e99d0438d66434e3e63..232a8c2fb98bc0d079484bea1da4e35b public class ServerGUI extends JComponent { -@@ -54,6 +59,15 @@ public class ServerGUI extends JComponent { +@@ -56,6 +61,15 @@ public class ServerGUI extends JComponent { jframe.pack(); jframe.setLocationRelativeTo((Component) null); jframe.setVisible(true); diff --git a/Spigot-Server-Patches/0685-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch b/Spigot-Server-Patches/0685-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch index a4425dfe42..852ff8decb 100644 --- a/Spigot-Server-Patches/0685-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch +++ b/Spigot-Server-Patches/0685-stop-firing-pressure-plate-EntityInteractEvent-for-i.patch @@ -5,11 +5,11 @@ Subject: [PATCH] stop firing pressure plate EntityInteractEvent for ignored entities -diff --git a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java -index ef79fbb628c4eaffe9d34de6129d6e833aac7c76..2e1dbd4786f77a8822d039206000799b927ff24c 100644 ---- a/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java -+++ b/src/main/java/net/minecraft/server/BlockPressurePlateBinary.java -@@ -67,6 +67,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { +diff --git a/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java b/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java +index 4c4c8b23c39d26c646b1950023a20446ac798c6f..fba720bf2349a69d0f93642eea4e77063f83380c 100644 +--- a/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java ++++ b/src/main/java/net/minecraft/world/level/block/BlockPressurePlateBinary.java +@@ -82,6 +82,7 @@ public class BlockPressurePlateBinary extends BlockPressurePlateAbstract { while (iterator.hasNext()) { Entity entity = (Entity) iterator.next(); diff --git a/Spigot-Server-Patches/0686-fix-converting-txt-to-json-file.patch b/Spigot-Server-Patches/0686-fix-converting-txt-to-json-file.patch index 812a44e6c9..03a0dd8e54 100644 --- a/Spigot-Server-Patches/0686-fix-converting-txt-to-json-file.patch +++ b/Spigot-Server-Patches/0686-fix-converting-txt-to-json-file.patch @@ -4,11 +4,11 @@ Date: Mon, 4 Jan 2021 19:49:15 -0800 Subject: [PATCH] fix converting txt to json file -diff --git a/src/main/java/net/minecraft/server/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/DedicatedPlayerList.java -index a8cb602be410fb269f4d7e19e40ee07a84ea86e5..73b1022e192d2cc4a953a784408ef909a3192c59 100644 ---- a/src/main/java/net/minecraft/server/DedicatedPlayerList.java -+++ b/src/main/java/net/minecraft/server/DedicatedPlayerList.java -@@ -15,6 +15,11 @@ public class DedicatedPlayerList extends PlayerList { +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +index b13e6f9923a9c5703f4eaeab2d0c112e4726b496..a762cf4c4a52bcbc8dbfd60b3ad7fef5489ba5c5 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedPlayerList.java +@@ -18,6 +18,11 @@ public class DedicatedPlayerList extends PlayerList { this.a(dedicatedserverproperties.viewDistance); super.setHasWhitelist((Boolean) dedicatedserverproperties.whiteList.get()); @@ -20,11 +20,11 @@ index a8cb602be410fb269f4d7e19e40ee07a84ea86e5..73b1022e192d2cc4a953a784408ef909 this.y(); this.w(); this.x(); -diff --git a/src/main/java/net/minecraft/server/DedicatedServer.java b/src/main/java/net/minecraft/server/DedicatedServer.java -index 5504facd2e453238caa71d98743be5416d4dd4fe..d4793a1d476d8d6687ec8782501c31265f284daa 100644 ---- a/src/main/java/net/minecraft/server/DedicatedServer.java -+++ b/src/main/java/net/minecraft/server/DedicatedServer.java -@@ -159,6 +159,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +diff --git a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +index c4df472050622eb2469b2ddb4d2ed917994f6e95..52bb528e75eb43156ee2bf19877bc051a35bb6e3 100644 +--- a/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java ++++ b/src/main/java/net/minecraft/server/dedicated/DedicatedServer.java +@@ -198,6 +198,12 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer org.spigotmc.SpigotConfig.init((java.io.File) options.valueOf("spigot-settings")); org.spigotmc.SpigotConfig.registerCommands(); // Spigot end @@ -37,7 +37,7 @@ index 5504facd2e453238caa71d98743be5416d4dd4fe..d4793a1d476d8d6687ec8782501c3126 // Paper start try { com.destroystokyo.paper.PaperConfig.init((java.io.File) options.valueOf("paper-settings")); -@@ -221,10 +227,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer +@@ -260,10 +266,6 @@ public class DedicatedServer extends MinecraftServer implements IMinecraftServer DedicatedServer.LOGGER.warn("To change this, set \"online-mode\" to \"true\" in the server.properties file."); } @@ -48,11 +48,11 @@ index 5504facd2e453238caa71d98743be5416d4dd4fe..d4793a1d476d8d6687ec8782501c3126 if (!NameReferencingFileConverter.e(this)) { return false; } else { -diff --git a/src/main/java/net/minecraft/server/PlayerList.java b/src/main/java/net/minecraft/server/PlayerList.java -index 568b404e85e6f96cc025ff48bbc9f466c036b841..1c85ba153a87ae3cf8962034308384ae53f2c730 100644 ---- a/src/main/java/net/minecraft/server/PlayerList.java -+++ b/src/main/java/net/minecraft/server/PlayerList.java -@@ -93,6 +93,7 @@ public abstract class PlayerList { +diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java +index 5a371a7ce4cc70d5916b87874a960427c882f9b1..213c9c425722c670f950d0485263c115d7f22812 100644 +--- a/src/main/java/net/minecraft/server/players/PlayerList.java ++++ b/src/main/java/net/minecraft/server/players/PlayerList.java +@@ -166,6 +166,7 @@ public abstract class PlayerList { this.maxPlayers = i; this.playerFileData = worldnbtstorage; } @@ -60,11 +60,11 @@ index 568b404e85e6f96cc025ff48bbc9f466c036b841..1c85ba153a87ae3cf8962034308384ae public void a(NetworkManager networkmanager, EntityPlayer entityplayer) { EntityPlayer prev = pendingPlayers.put(entityplayer.getUniqueID(), entityplayer);// Paper -diff --git a/src/main/java/net/minecraft/server/UserCache.java b/src/main/java/net/minecraft/server/UserCache.java -index aa1b18ffa1e2b7f865f63b7df81d8f3b3d5aa966..8c3aa47a28914fd69a7f2e55a8c8f91d8e02371e 100644 ---- a/src/main/java/net/minecraft/server/UserCache.java -+++ b/src/main/java/net/minecraft/server/UserCache.java -@@ -239,6 +239,7 @@ public class UserCache { +diff --git a/src/main/java/net/minecraft/server/players/UserCache.java b/src/main/java/net/minecraft/server/players/UserCache.java +index bc3deb1d9710c744388ce6e89a6f5f4f3f05238d..08d279d7a1bc73f4043b944beb1c64132ededef5 100644 +--- a/src/main/java/net/minecraft/server/players/UserCache.java ++++ b/src/main/java/net/minecraft/server/players/UserCache.java +@@ -240,6 +240,7 @@ public class UserCache { return arraylist; } diff --git a/Spigot-Server-Patches/0687-Add-worldborder-events.patch b/Spigot-Server-Patches/0687-Add-worldborder-events.patch index 20d40df51b..49bf0c1ca5 100644 --- a/Spigot-Server-Patches/0687-Add-worldborder-events.patch +++ b/Spigot-Server-Patches/0687-Add-worldborder-events.patch @@ -4,21 +4,21 @@ Date: Mon, 4 Jan 2021 22:40:34 -0800 Subject: [PATCH] Add worldborder events -diff --git a/src/main/java/net/minecraft/server/WorldBorder.java b/src/main/java/net/minecraft/server/WorldBorder.java -index f011869880fedae4b69e505491e8bdbc5f51dfba..6e82c1d1b272a95144bfc78d34b630c24466fa3e 100644 ---- a/src/main/java/net/minecraft/server/WorldBorder.java -+++ b/src/main/java/net/minecraft/server/WorldBorder.java -@@ -4,6 +4,9 @@ import com.google.common.collect.Lists; - import com.mojang.serialization.DynamicLike; - import java.util.Iterator; - import java.util.List; +diff --git a/src/main/java/net/minecraft/world/level/border/WorldBorder.java b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +index bedaa9dd6390e81df5872c2dd6e202a038367bf6..3c25021835d6d8fd112fc89636616bfd744e7f1a 100644 +--- a/src/main/java/net/minecraft/world/level/border/WorldBorder.java ++++ b/src/main/java/net/minecraft/world/level/border/WorldBorder.java +@@ -14,6 +14,9 @@ import net.minecraft.world.phys.AxisAlignedBB; + import net.minecraft.world.phys.shapes.OperatorBoolean; + import net.minecraft.world.phys.shapes.VoxelShape; + import net.minecraft.world.phys.shapes.VoxelShapes; +import io.papermc.paper.event.world.border.WorldBorderBoundsChangeFinishEvent; // Paper +import io.papermc.paper.event.world.border.WorldBorderCenterChangeEvent; // Paper +import io.papermc.paper.event.world.border.WorldBorderBoundsChangeEvent; // Paper public class WorldBorder { -@@ -92,15 +95,19 @@ public class WorldBorder { +@@ -102,15 +105,19 @@ public class WorldBorder { } public void setCenter(double d0, double d1) { @@ -41,7 +41,7 @@ index f011869880fedae4b69e505491e8bdbc5f51dfba..6e82c1d1b272a95144bfc78d34b630c2 } } -@@ -118,25 +125,43 @@ public class WorldBorder { +@@ -128,25 +135,43 @@ public class WorldBorder { } public void setSize(double d0) { @@ -89,7 +89,7 @@ index f011869880fedae4b69e505491e8bdbc5f51dfba..6e82c1d1b272a95144bfc78d34b630c2 } } -@@ -424,11 +449,11 @@ public class WorldBorder { +@@ -434,11 +459,11 @@ public class WorldBorder { class b implements WorldBorder.a { @@ -104,7 +104,7 @@ index f011869880fedae4b69e505491e8bdbc5f51dfba..6e82c1d1b272a95144bfc78d34b630c2 private b(double d0, double d1, long i) { this.b = d0; -@@ -483,6 +508,7 @@ public class WorldBorder { +@@ -493,6 +518,7 @@ public class WorldBorder { @Override public WorldBorder.a l() { @@ -112,7 +112,7 @@ index f011869880fedae4b69e505491e8bdbc5f51dfba..6e82c1d1b272a95144bfc78d34b630c2 return (WorldBorder.a) (this.g() <= 0L ? WorldBorder.this.new d(this.c) : this); } -@@ -504,6 +530,7 @@ public class WorldBorder { +@@ -514,6 +540,7 @@ public class WorldBorder { double e(); diff --git a/Spigot-Server-Patches/0688-added-PlayerNameEntityEvent.patch b/Spigot-Server-Patches/0688-added-PlayerNameEntityEvent.patch index fcc4d586d8..bd505483ca 100644 --- a/Spigot-Server-Patches/0688-added-PlayerNameEntityEvent.patch +++ b/Spigot-Server-Patches/0688-added-PlayerNameEntityEvent.patch @@ -4,12 +4,13 @@ Date: Sun, 5 Jul 2020 00:33:54 -0700 Subject: [PATCH] added PlayerNameEntityEvent -diff --git a/src/main/java/net/minecraft/server/ItemNameTag.java b/src/main/java/net/minecraft/server/ItemNameTag.java -index 01163ce38602f9345f00ee0535b4e73be7c6d735..a34772e329df62d9176b0aa392197e2771c69da4 100644 ---- a/src/main/java/net/minecraft/server/ItemNameTag.java -+++ b/src/main/java/net/minecraft/server/ItemNameTag.java -@@ -1,5 +1,10 @@ - package net.minecraft.server; +diff --git a/src/main/java/net/minecraft/world/item/ItemNameTag.java b/src/main/java/net/minecraft/world/item/ItemNameTag.java +index 140a865f4f8fb3e4f787cf8d334d20fac6cb5eef..542ffc79cdd76d71da2c749548abca2dad2fef41 100644 +--- a/src/main/java/net/minecraft/world/item/ItemNameTag.java ++++ b/src/main/java/net/minecraft/world/item/ItemNameTag.java +@@ -6,6 +6,11 @@ import net.minecraft.world.entity.EntityInsentient; + import net.minecraft.world.entity.EntityLiving; + import net.minecraft.world.entity.player.EntityHuman; +// Paper start +import io.papermc.paper.adventure.PaperAdventure; @@ -19,7 +20,7 @@ index 01163ce38602f9345f00ee0535b4e73be7c6d735..a34772e329df62d9176b0aa392197e27 public class ItemNameTag extends Item { public ItemNameTag(Item.Info item_info) { -@@ -10,11 +15,15 @@ public class ItemNameTag extends Item { +@@ -16,11 +21,15 @@ public class ItemNameTag extends Item { public EnumInteractionResult a(ItemStack itemstack, EntityHuman entityhuman, EntityLiving entityliving, EnumHand enumhand) { if (itemstack.hasName() && !(entityliving instanceof EntityHuman)) { if (!entityhuman.world.isClientSide && entityliving.isAlive()) { diff --git a/Spigot-Server-Patches/0689-Prevent-grindstones-from-overstacking-items.patch b/Spigot-Server-Patches/0689-Prevent-grindstones-from-overstacking-items.patch index d5c51a2cdc..7eba41fbef 100644 --- a/Spigot-Server-Patches/0689-Prevent-grindstones-from-overstacking-items.patch +++ b/Spigot-Server-Patches/0689-Prevent-grindstones-from-overstacking-items.patch @@ -4,11 +4,11 @@ Date: Tue, 16 Feb 2021 21:37:51 -0600 Subject: [PATCH] Prevent grindstones from overstacking items -diff --git a/src/main/java/net/minecraft/server/ContainerGrindstone.java b/src/main/java/net/minecraft/server/ContainerGrindstone.java -index 57b3c42b6b3fcf791591897fa12d12c2c396191c..99e342038172d7e74a45789bd4b58d4660c775d3 100644 ---- a/src/main/java/net/minecraft/server/ContainerGrindstone.java -+++ b/src/main/java/net/minecraft/server/ContainerGrindstone.java -@@ -184,13 +184,13 @@ public class ContainerGrindstone extends Container { +diff --git a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +index 1d5dcbbd3870eb8e1013a97f6ce882bfc096bf95..a841c47c25287080738b04352ea4e8eaa77dacdd 100644 +--- a/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java ++++ b/src/main/java/net/minecraft/world/inventory/ContainerGrindstone.java +@@ -196,13 +196,13 @@ public class ContainerGrindstone extends Container { i = Math.max(item.getMaxDurability() - l, 0); itemstack2 = this.b(itemstack, itemstack1); if (!itemstack2.e()) { diff --git a/Spigot-Server-Patches/0690-Add-recipe-to-cook-events.patch b/Spigot-Server-Patches/0690-Add-recipe-to-cook-events.patch index bd6dc58358..a8630ee2eb 100644 --- a/Spigot-Server-Patches/0690-Add-recipe-to-cook-events.patch +++ b/Spigot-Server-Patches/0690-Add-recipe-to-cook-events.patch @@ -4,11 +4,11 @@ Date: Wed, 6 Jan 2021 12:04:03 -0800 Subject: [PATCH] Add recipe to cook events -diff --git a/src/main/java/net/minecraft/server/TileEntityCampfire.java b/src/main/java/net/minecraft/server/TileEntityCampfire.java -index c56c588f508b51677c599412215f043aa0a35f98..3239d8dd120fda2faa6b770603c5f613c13f7c43 100644 ---- a/src/main/java/net/minecraft/server/TileEntityCampfire.java -+++ b/src/main/java/net/minecraft/server/TileEntityCampfire.java -@@ -56,7 +56,10 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java +index bd213deedf47e71f0983bb950c7e74d4bf30f54e..d263b5a95cd482fa15a20fd742158f9ab837038f 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityCampfire.java +@@ -73,7 +73,10 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab if (this.cookingTimes[i] >= this.cookingTotalTimes[i]) { InventorySubcontainer inventorysubcontainer = new InventorySubcontainer(new ItemStack[]{itemstack}); @@ -20,7 +20,7 @@ index c56c588f508b51677c599412215f043aa0a35f98..3239d8dd120fda2faa6b770603c5f613 return recipecampfire.a(inventorysubcontainer); }).orElse(itemstack); BlockPosition blockposition = this.getPosition(); -@@ -65,7 +68,7 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab +@@ -82,7 +85,7 @@ public class TileEntityCampfire extends TileEntity implements Clearable, ITickab CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); @@ -29,11 +29,11 @@ index c56c588f508b51677c599412215f043aa0a35f98..3239d8dd120fda2faa6b770603c5f613 this.world.getServer().getPluginManager().callEvent(blockCookEvent); if (blockCookEvent.isCancelled()) { -diff --git a/src/main/java/net/minecraft/server/TileEntityFurnace.java b/src/main/java/net/minecraft/server/TileEntityFurnace.java -index eb6aa82c3c25928070475815288ec215938322c7..935c7f111a7d7b9cc7c8e384d43e7ab6092cfc5f 100644 ---- a/src/main/java/net/minecraft/server/TileEntityFurnace.java -+++ b/src/main/java/net/minecraft/server/TileEntityFurnace.java -@@ -366,7 +366,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I +diff --git a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +index 54316a8079b4331a48cac3c43f3f8c506a4af091..1997139fb87dc1947acfdf02e1f116577c3fa943 100644 +--- a/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java ++++ b/src/main/java/net/minecraft/world/level/block/entity/TileEntityFurnace.java +@@ -395,7 +395,7 @@ public abstract class TileEntityFurnace extends TileEntityContainer implements I CraftItemStack source = CraftItemStack.asCraftMirror(itemstack); org.bukkit.inventory.ItemStack result = CraftItemStack.asBukkitCopy(itemstack1); diff --git a/Spigot-Server-Patches/0692-Allow-using-signs-inside-spawn-protection.patch b/Spigot-Server-Patches/0692-Allow-using-signs-inside-spawn-protection.patch index 09b7fb78a0..c1f601db71 100644 --- a/Spigot-Server-Patches/0692-Allow-using-signs-inside-spawn-protection.patch +++ b/Spigot-Server-Patches/0692-Allow-using-signs-inside-spawn-protection.patch @@ -18,11 +18,11 @@ index b473709774fbbd502d5e04c98041ae7c829b4083..fd675585c61387156892b179af593ad6 + allowUsingSignsInsideSpawnProtection = getBoolean("allow-using-signs-inside-spawn-protection", allowUsingSignsInsideSpawnProtection); + } } -diff --git a/src/main/java/net/minecraft/server/PlayerConnection.java b/src/main/java/net/minecraft/server/PlayerConnection.java -index f3679a3ad2d51612381bc47bb23eeffec924d478..3435eb1584546d2963324372ddab1645dcf6327a 100644 ---- a/src/main/java/net/minecraft/server/PlayerConnection.java -+++ b/src/main/java/net/minecraft/server/PlayerConnection.java -@@ -1545,7 +1545,7 @@ public class PlayerConnection implements PacketListenerPlayIn { +diff --git a/src/main/java/net/minecraft/server/network/PlayerConnection.java b/src/main/java/net/minecraft/server/network/PlayerConnection.java +index 3da824081892a2ab9071351b77150b42915742d0..f7e73d69f88e1952c05c674073fc0922c5fddf54 100644 +--- a/src/main/java/net/minecraft/server/network/PlayerConnection.java ++++ b/src/main/java/net/minecraft/server/network/PlayerConnection.java +@@ -1688,7 +1688,7 @@ public class PlayerConnection implements PacketListenerPlayIn { this.player.resetIdleTimer(); if (blockposition.getY() < this.minecraftServer.getMaxBuildHeight()) { diff --git a/Spigot-Server-Patches/0693-Implement-Keyed-on-World.patch b/Spigot-Server-Patches/0693-Implement-Keyed-on-World.patch index 192466a7f3..58a61a09dc 100644 --- a/Spigot-Server-Patches/0693-Implement-Keyed-on-World.patch +++ b/Spigot-Server-Patches/0693-Implement-Keyed-on-World.patch @@ -4,11 +4,11 @@ Date: Wed, 6 Jan 2021 00:34:04 -0800 Subject: [PATCH] Implement Keyed on World -diff --git a/src/main/java/net/minecraft/server/IRegistry.java b/src/main/java/net/minecraft/server/IRegistry.java -index 6c7caef36b484a16b62977b5495247588c34dc2b..eb578c2f3e0193f18143d7cc0e38edc2e4a32d7a 100644 ---- a/src/main/java/net/minecraft/server/IRegistry.java -+++ b/src/main/java/net/minecraft/server/IRegistry.java -@@ -57,7 +57,7 @@ public abstract class IRegistry implements Codec, Keyable, Registry { +diff --git a/src/main/java/net/minecraft/core/IRegistry.java b/src/main/java/net/minecraft/core/IRegistry.java +index 3e9ebeffdf66f8a959630b344149d17137c6901c..4f04d8081912e0fe771f0db9e086c789328f246f 100644 +--- a/src/main/java/net/minecraft/core/IRegistry.java ++++ b/src/main/java/net/minecraft/core/IRegistry.java +@@ -130,7 +130,7 @@ public abstract class IRegistry implements Codec, Keyable, Registry { public static final ResourceKey> I = a("loot_function_type"); public static final ResourceKey> J = a("loot_condition_type"); public static final ResourceKey> K = a("dimension_type"); @@ -17,7 +17,7 @@ index 6c7caef36b484a16b62977b5495247588c34dc2b..eb578c2f3e0193f18143d7cc0e38edc2 public static final ResourceKey> M = a("dimension"); public static final IRegistry SOUND_EVENT = a(IRegistry.g, () -> { return SoundEffects.ENTITY_ITEM_PICKUP; -@@ -266,9 +266,9 @@ public abstract class IRegistry implements Codec, Keyable, Registry { +@@ -339,9 +339,9 @@ public abstract class IRegistry implements Codec, Keyable, Registry { MinecraftKey minecraftkey = resourcekey.a(); IRegistry.a.put(minecraftkey, supplier); @@ -29,7 +29,7 @@ index 6c7caef36b484a16b62977b5495247588c34dc2b..eb578c2f3e0193f18143d7cc0e38edc2 } protected IRegistry(ResourceKey> resourcekey, Lifecycle lifecycle) { -@@ -355,11 +355,11 @@ public abstract class IRegistry implements Codec, Keyable, Registry { +@@ -428,11 +428,11 @@ public abstract class IRegistry implements Codec, Keyable, Registry { } public static T a(IRegistry iregistry, MinecraftKey minecraftkey, T t0) { @@ -43,11 +43,11 @@ index 6c7caef36b484a16b62977b5495247588c34dc2b..eb578c2f3e0193f18143d7cc0e38edc2 } static { -diff --git a/src/main/java/net/minecraft/server/ResourceKey.java b/src/main/java/net/minecraft/server/ResourceKey.java -index b35f0340b15fb22e979eb4343537b105281295f4..09781906d1a15560836392ebb8eacb6f3db94958 100644 ---- a/src/main/java/net/minecraft/server/ResourceKey.java -+++ b/src/main/java/net/minecraft/server/ResourceKey.java -@@ -11,6 +11,7 @@ public class ResourceKey { +diff --git a/src/main/java/net/minecraft/resources/ResourceKey.java b/src/main/java/net/minecraft/resources/ResourceKey.java +index 760579921927b4c8b0f20b2611b95fd626e4b27f..3075700dfa992da81b10246fcf7c7ad1115c4ba3 100644 +--- a/src/main/java/net/minecraft/resources/ResourceKey.java ++++ b/src/main/java/net/minecraft/resources/ResourceKey.java +@@ -12,6 +12,7 @@ public class ResourceKey { private final MinecraftKey b; private final MinecraftKey c; @@ -55,7 +55,7 @@ index b35f0340b15fb22e979eb4343537b105281295f4..09781906d1a15560836392ebb8eacb6f public static ResourceKey a(ResourceKey> resourcekey, MinecraftKey minecraftkey) { return a(resourcekey.c, minecraftkey); } -@@ -40,6 +41,7 @@ public class ResourceKey { +@@ -41,6 +42,7 @@ public class ResourceKey { return this.b.equals(resourcekey.a()); } @@ -64,15 +64,15 @@ index b35f0340b15fb22e979eb4343537b105281295f4..09781906d1a15560836392ebb8eacb6f return this.c; } diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java -index f84d879ef982ee4adcaa43e7c3db1f1003961983..1398b18409db3b3741ce199ee7156a2dfe2cc96c 100644 +index cbac3c96c5d3c1551912f5769bfc50d690519495..03b8d67a5f0088c0254b2099f27e8dcae32a6221 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java @@ -1154,7 +1154,7 @@ public final class CraftServer implements Server { chunkgenerator = worlddimension.c(); } -- ResourceKey worldKey = ResourceKey.a(IRegistry.L, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH))); -+ ResourceKey worldKey = ResourceKey.newResourceKey(IRegistry.getWorldRegistry(), new MinecraftKey(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper +- ResourceKey worldKey = ResourceKey.a(IRegistry.L, new MinecraftKey(name.toLowerCase(java.util.Locale.ENGLISH))); ++ ResourceKey worldKey = ResourceKey.newResourceKey(IRegistry.getWorldRegistry(), new MinecraftKey(creator.key().getNamespace().toLowerCase(java.util.Locale.ENGLISH), creator.key().getKey().toLowerCase(java.util.Locale.ENGLISH))); // Paper WorldServer internal = (WorldServer) new WorldServer(console, console.executorService, worldSession, worlddata, worldKey, dimensionmanager, getServer().worldLoadListenerFactory.create(11), chunkgenerator, worlddata.getGeneratorSettings().isDebugWorld(), j, creator.environment() == Environment.NORMAL ? list : ImmutableList.of(), true, creator.environment(), generator); @@ -93,12 +93,12 @@ index f84d879ef982ee4adcaa43e7c3db1f1003961983..1398b18409db3b3741ce199ee7156a2d // Check if a World already exists with the UID. if (getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -index d9b683264da17ba65409e2b976c885875fe09c89..cade3ed6079011f44eba613dece3d69ec18f8f04 100644 +index 04ab5f395c565e998478564fd5b3081457317537..9cd907baa38a5b04fb56873009ac7cf3b92e0b9e 100644 --- a/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftWorld.java -@@ -2585,6 +2585,11 @@ public class CraftWorld implements World { +@@ -2583,6 +2583,11 @@ public class CraftWorld implements World { return CompletableFuture.completedFuture(chunk == null ? null : chunk.getBukkitChunk()); - }, MinecraftServer.getServer()); + }, net.minecraft.server.MinecraftServer.getServer()); } + + @Override diff --git a/Spigot-Server-Patches/0694-Add-fast-alternative-constructor-for-Vector3f.patch b/Spigot-Server-Patches/0694-Add-fast-alternative-constructor-for-Vector3f.patch index e8ff8b39a6..65430ea1e7 100644 --- a/Spigot-Server-Patches/0694-Add-fast-alternative-constructor-for-Vector3f.patch +++ b/Spigot-Server-Patches/0694-Add-fast-alternative-constructor-for-Vector3f.patch @@ -5,11 +5,11 @@ Subject: [PATCH] Add fast alternative constructor for Vector3f Signed-off-by: Irmo van den Berge -diff --git a/src/main/java/net/minecraft/server/Vector3f.java b/src/main/java/net/minecraft/server/Vector3f.java -index fa25e5d1530e099f73355c2779e0d57a51ad4b6e..c8de8056e60c159d85d14e80bdbf12f1dac9a621 100644 ---- a/src/main/java/net/minecraft/server/Vector3f.java -+++ b/src/main/java/net/minecraft/server/Vector3f.java -@@ -16,6 +16,18 @@ public class Vector3f { +diff --git a/src/main/java/net/minecraft/core/Vector3f.java b/src/main/java/net/minecraft/core/Vector3f.java +index 93590ceb0bbe369a1bda987f0c4c21ea6a3b3a1a..da53e294fa5e28406b25614039db49b48c2dcdac 100644 +--- a/src/main/java/net/minecraft/core/Vector3f.java ++++ b/src/main/java/net/minecraft/core/Vector3f.java +@@ -19,6 +19,18 @@ public class Vector3f { this(nbttaglist.i(0), nbttaglist.i(1), nbttaglist.i(2)); } diff --git a/Spigot-Server-Patches/0695-Item-Rarity-API.patch b/Spigot-Server-Patches/0695-Item-Rarity-API.patch index 9ed8a591d6..9a04445788 100644 --- a/Spigot-Server-Patches/0695-Item-Rarity-API.patch +++ b/Spigot-Server-Patches/0695-Item-Rarity-API.patch @@ -4,11 +4,11 @@ Date: Fri, 12 Mar 2021 17:09:42 -0800 Subject: [PATCH] Item Rarity API -diff --git a/src/main/java/net/minecraft/server/Item.java b/src/main/java/net/minecraft/server/Item.java -index c3b57e8d572d13ec74d6df5544072cdc55756690..2304730bbd66f9a37975f2684794bb8402654fad 100644 ---- a/src/main/java/net/minecraft/server/Item.java -+++ b/src/main/java/net/minecraft/server/Item.java -@@ -15,7 +15,7 @@ public class Item implements IMaterial { +diff --git a/src/main/java/net/minecraft/world/item/Item.java b/src/main/java/net/minecraft/world/item/Item.java +index 5d7c44a53fb98532057b09176677ce0d719b055b..e6a838430084d64326d1042c7b2089f49a24a789 100644 +--- a/src/main/java/net/minecraft/world/item/Item.java ++++ b/src/main/java/net/minecraft/world/item/Item.java +@@ -45,7 +45,7 @@ public class Item implements IMaterial { protected static final UUID g = UUID.fromString("FA233E1C-4180-4865-B01B-BCCE9785ACA3"); protected static final Random RANDOM = new Random(); protected final CreativeModeTab i; @@ -17,7 +17,7 @@ index c3b57e8d572d13ec74d6df5544072cdc55756690..2304730bbd66f9a37975f2684794bb84 private final int maxStackSize; private final int durability; private final boolean d; -@@ -178,6 +178,7 @@ public class Item implements IMaterial { +@@ -208,6 +208,7 @@ public class Item implements IMaterial { return itemstack.hasEnchantments(); } @@ -26,11 +26,11 @@ index c3b57e8d572d13ec74d6df5544072cdc55756690..2304730bbd66f9a37975f2684794bb84 if (!itemstack.hasEnchantments()) { return this.a; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 00e53d577b1dcaccb409e62d35165ee015de9330..57d56ff1b41582f0d249b24165d5b08b02b0f9fe 100644 +index ca911ed346daf8c43b7b6e0acabf9ac0c64223aa..712a32c0b64dace1f3e3d6f8acb8cbef1736b1f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java @@ -447,6 +447,20 @@ public final class CraftMagicNumbers implements UnsafeValues { - return net.minecraft.server.Entity.nextEntityId(); + return net.minecraft.world.entity.Entity.nextEntityId(); } + @Override diff --git a/work/BuildData b/work/BuildData index 656df5e622..80d35549ec 160000 --- a/work/BuildData +++ b/work/BuildData @@ -1 +1 @@ -Subproject commit 656df5e622bba97efb4e858e8cd3ec428a0b2d71 +Subproject commit 80d35549ec67b87a0cdf0d897abbe826ba34ac27 diff --git a/work/CraftBukkit b/work/CraftBukkit index 2ffdb31ec0..90d6905b15 160000 --- a/work/CraftBukkit +++ b/work/CraftBukkit @@ -1 +1 @@ -Subproject commit 2ffdb31ec0d6827d7cd5e832b5393514f46c0c19 +Subproject commit 90d6905b1587ac1c5c075e2da471f77d00e0f50d diff --git a/work/Spigot b/work/Spigot index bff526193e..79d53c285f 160000 --- a/work/Spigot +++ b/work/Spigot @@ -1 +1 @@ -Subproject commit bff526193eec525c624bf7e65f8a5239866bfcbf +Subproject commit 79d53c285f44559efad1f2aba24fb785f0cf0cfe