From a8db5274493f3bf6c91c8bc9d4a3618a02ba5500 Mon Sep 17 00:00:00 2001 From: Nassim Jahnke Date: Thu, 18 Jul 2024 16:50:16 +0200 Subject: [PATCH] Even more cleanup of mcutil patch --- patches/server/0009-MC-Utils.patch | 862 +----------------- ...n-prefixes-using-Log4J-configuration.patch | 4 +- patches/server/0019-Paper-Plugins.patch | 21 +- ...ion-calls-in-plugins-using-internals.patch | 6 +- patches/server/0023-Timings-v2.patch | 55 +- .../0030-Allow-nerfed-mobs-to-jump.patch | 4 +- ...onfigurable-entity-despawn-distances.patch | 4 +- ...0033-Expose-server-build-information.patch | 4 +- .../0034-Player-affects-spawning-API.patch | 6 +- .../0062-Add-exception-reporting-event.patch | 29 +- ...e-CraftScheduler-Async-Task-Debugger.patch | 8 +- .../server/0132-Item-canEntityPickup.patch | 4 +- .../server/0136-Basic-PlayerProfile-API.patch | 31 - .../0145-ProfileWhitelistVerifyEvent.patch | 7 +- ...nt-extended-PaperServerListPingEvent.patch | 4 +- .../0178-Improved-Async-Task-Scheduler.patch | 34 +- .../0202-Add-entity-knockback-events.patch | 4 +- ...dd-Early-Warning-Feature-to-WatchDog.patch | 4 +- .../server/0243-Improve-death-events.patch | 8 +- patches/server/0245-Mob-Pathfinding-API.patch | 4 +- ...oggleEvent-when-whitelist-is-toggled.patch | 4 +- .../0315-Add-debug-for-sync-chunk-loads.patch | 10 +- ...Add-Raw-Byte-ItemStack-Serialization.patch | 4 +- ...layer-is-attempted-to-be-removed-fro.patch | 4 +- ...er-runTaskTimerAsynchronously-Plugin.patch | 4 +- ...CreateEvent-needs-to-know-its-entity.patch | 4 +- ...y-Counter-to-allow-plugins-to-use-va.patch | 6 +- ...ix-client-lag-on-advancement-loading.patch | 4 +- .../0485-Expand-EntityUnleashEvent.patch | 4 +- ...ainThreadExecutor-to-BukkitScheduler.patch | 4 +- .../server/0504-Expand-world-key-API.patch | 4 +- .../server/0509-Expose-protocol-version.patch | 4 +- .../0536-ItemStack-repair-check-API.patch | 4 +- ...3-Improve-item-default-attribute-API.patch | 4 +- .../0547-Add-PlayerKickEvent-causes.patch | 6 +- .../0588-Get-entity-default-attributes.patch | 4 +- ...97-Add-Raw-Byte-Entity-Serialization.patch | 6 +- ...n-t-log-debug-logging-being-disabled.patch | 4 +- ...max-block-light-for-monster-spawning.patch | 4 +- ...tead-of-display-name-in-PlayerList-g.patch | 4 +- ...0736-Add-NamespacedKey-biome-methods.patch | 4 +- ...-for-some-hot-BlockBehavior-and-Flui.patch | 8 +- ...-Fix-SpawnEggMeta-get-setSpawnedType.patch | 6 +- ...-API-for-updating-recipes-on-clients.patch | 6 +- ...x-custom-statistic-criteria-creation.patch | 4 +- ...Fix-silent-equipment-change-for-mobs.patch | 4 +- ...897-Fix-UnsafeValues-loadAdvancement.patch | 4 +- ...date-ResourceLocation-in-NBT-reading.patch | 4 +- ...e-experience-dropping-on-block-break.patch | 6 +- ...Add-api-for-spawn-egg-texture-colors.patch | 4 +- .../0932-Add-Lifecycle-Event-system.patch | 20 +- .../server/0933-ItemStack-Tooltip-API.patch | 4 +- ...and-End-Portal-Frames-from-being-des.patch | 10 +- .../0988-Moonrise-optimisation-patches.patch | 120 +-- .../0989-Rewrite-dataconverter-system.patch | 6 +- .../0997-Entity-Activation-Range-2.0.patch | 17 +- .../1021-Registry-Modification-API.patch | 6 +- ...24-Proxy-ItemStack-to-CraftItemStack.patch | 4 +- ...-Incremental-chunk-and-player-saving.patch | 4 +- 59 files changed, 282 insertions(+), 1154 deletions(-) diff --git a/patches/server/0009-MC-Utils.patch b/patches/server/0009-MC-Utils.patch index 0b42652674..bb4e8413c9 100644 --- a/patches/server/0009-MC-Utils.patch +++ b/patches/server/0009-MC-Utils.patch @@ -4077,54 +4077,42 @@ index 0000000000000000000000000000000000000000..197224e31175252d8438a8df585bbb65 +} diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java new file mode 100644 -index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98dff097cd0 +index 0000000000000000000000000000000000000000..c9bebadaf4be03cc92774b7367aeecdd380046f1 --- /dev/null +++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -0,0 +1,550 @@ +@@ -0,0 +1,176 @@ +package io.papermc.paper.util; + -+import com.google.common.collect.ImmutableList; +import com.google.common.util.concurrent.ThreadFactoryBuilder; +import io.papermc.paper.math.BlockPosition; +import io.papermc.paper.math.FinePosition; +import io.papermc.paper.math.Position; -+import it.unimi.dsi.fastutil.objects.ObjectRBTreeSet; -+import java.lang.ref.Cleaner; -+import net.minecraft.core.BlockPos; -+import net.minecraft.core.Direction; -+import net.minecraft.core.Vec3i; -+import net.minecraft.server.MinecraftServer; -+import net.minecraft.server.level.ServerLevel; -+import net.minecraft.world.entity.Entity; -+import net.minecraft.world.level.ChunkPos; -+import net.minecraft.world.level.ClipContext; -+import net.minecraft.world.level.Level; -+import net.minecraft.world.phys.Vec3; -+import org.apache.commons.lang.exception.ExceptionUtils; -+import org.bukkit.Location; -+import org.bukkit.block.BlockFace; -+import org.bukkit.craftbukkit.CraftWorld; -+import org.bukkit.craftbukkit.util.Waitable; -+import org.jetbrains.annotations.NotNull; -+import org.spigotmc.AsyncCatcher; -+ -+import javax.annotation.Nonnull; -+import javax.annotation.Nullable; +import java.util.List; -+import java.util.Queue; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.LinkedBlockingQueue; +import java.util.concurrent.ThreadPoolExecutor; +import java.util.concurrent.TimeUnit; -+import java.util.concurrent.TimeoutException; -+import java.util.concurrent.atomic.AtomicBoolean; +import java.util.function.BiConsumer; +import java.util.function.Consumer; -+import java.util.function.Predicate; +import java.util.function.Supplier; ++import net.minecraft.core.BlockPos; ++import net.minecraft.core.Vec3i; ++import net.minecraft.server.MinecraftServer; ++import net.minecraft.world.level.ChunkPos; ++import net.minecraft.world.level.Level; ++import net.minecraft.world.phys.Vec3; ++import org.bukkit.Location; ++import org.bukkit.craftbukkit.util.Waitable; + +public final class MCUtil { ++ public static final java.util.concurrent.Executor MAIN_EXECUTOR = (run) -> { ++ if (!isMainThread()) { ++ MinecraftServer.getServer().execute(run); ++ } else { ++ run.run(); ++ } ++ }; + public static final ThreadPoolExecutor asyncExecutor = new ThreadPoolExecutor( + 0, 2, 60L, TimeUnit.SECONDS, + new LinkedBlockingQueue<>(), @@ -4133,79 +4121,8 @@ index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98d + .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(MinecraftServer.LOGGER)) + .build() + ); -+ public static final ThreadPoolExecutor cleanerExecutor = new ThreadPoolExecutor( -+ 1, 1, 0L, TimeUnit.SECONDS, -+ new LinkedBlockingQueue<>(), -+ new ThreadFactoryBuilder() -+ .setNameFormat("Paper Object Cleaner") -+ .setUncaughtExceptionHandler(new net.minecraft.DefaultUncaughtExceptionHandlerWithName(MinecraftServer.LOGGER)) -+ .build() -+ ); + -+ public static final long INVALID_CHUNK_KEY = getCoordinateKey(Integer.MAX_VALUE, Integer.MAX_VALUE); -+ -+ -+ public static Runnable once(Runnable run) { -+ AtomicBoolean ran = new AtomicBoolean(false); -+ return () -> { -+ if (ran.compareAndSet(false, true)) { -+ run.run(); -+ } -+ }; -+ } -+ -+ public static Runnable once(List list, Consumer cb) { -+ return once(() -> { -+ list.forEach(cb); -+ }); -+ } -+ -+ private static Runnable makeCleanerCallback(Runnable run) { -+ return once(() -> cleanerExecutor.execute(run)); -+ } -+ -+ /** -+ * DANGER WILL ROBINSON: Be sure you do not use a lambda that lives in the object being monitored, or leaky leaky! -+ * @param obj -+ * @param run -+ * @return -+ */ -+ public static Runnable registerCleaner(Object obj, Runnable run) { -+ // Wrap callback in its own method above or the lambda will leak object -+ Runnable cleaner = makeCleanerCallback(run); -+ CleanerHolder.CLEANER.register(obj, cleaner); -+ return cleaner; -+ } -+ -+ private static final class CleanerHolder { -+ private static final Cleaner CLEANER = Cleaner.create(); -+ } -+ -+ /** -+ * DANGER WILL ROBINSON: Be sure you do not use a lambda that lives in the object being monitored, or leaky leaky! -+ * @param obj -+ * @param list -+ * @param cleaner -+ * @param -+ * @return -+ */ -+ public static Runnable registerListCleaner(Object obj, List list, Consumer cleaner) { -+ return registerCleaner(obj, () -> { -+ list.forEach(cleaner); -+ list.clear(); -+ }); -+ } -+ -+ /** -+ * DANGER WILL ROBINSON: Be sure you do not use a lambda that lives in the object being monitored, or leaky leaky! -+ * @param obj -+ * @param resource -+ * @param cleaner -+ * @param -+ * @return -+ */ -+ public static Runnable registerCleaner(Object obj, T resource, java.util.function.Consumer cleaner) { -+ return registerCleaner(obj, () -> cleaner.accept(resource)); ++ private MCUtil() { + } + + public static List getSpiralOutChunks(BlockPos blockposition, int radius) { @@ -4231,115 +4148,6 @@ index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98d + return list; + } + -+ public static int fastFloor(double x) { -+ int truncated = (int)x; -+ return x < (double)truncated ? truncated - 1 : truncated; -+ } -+ -+ public static int fastFloor(float x) { -+ int truncated = (int)x; -+ return x < (double)truncated ? truncated - 1 : truncated; -+ } -+ -+ public static float normalizeYaw(float f) { -+ float f1 = f % 360.0F; -+ -+ if (f1 >= 180.0F) { -+ f1 -= 360.0F; -+ } -+ -+ if (f1 < -180.0F) { -+ f1 += 360.0F; -+ } -+ -+ return f1; -+ } -+ -+ /** -+ * Quickly generate a stack trace for current location -+ * -+ * @return Stacktrace -+ */ -+ public static String stack() { -+ return ExceptionUtils.getFullStackTrace(new Throwable()); -+ } -+ -+ /** -+ * Quickly generate a stack trace for current location with message -+ * -+ * @param str -+ * @return Stacktrace -+ */ -+ public static String stack(String str) { -+ return ExceptionUtils.getFullStackTrace(new Throwable(str)); -+ } -+ -+ public static long getCoordinateKey(final BlockPos blockPos) { -+ return ((long)(blockPos.getZ() >> 4) << 32) | ((blockPos.getX() >> 4) & 0xFFFFFFFFL); -+ } -+ -+ public static long getCoordinateKey(final Entity entity) { -+ return ((long)(MCUtil.fastFloor(entity.getZ()) >> 4) << 32) | ((MCUtil.fastFloor(entity.getX()) >> 4) & 0xFFFFFFFFL); -+ } -+ -+ public static long getCoordinateKey(final ChunkPos pair) { -+ return ((long)pair.z << 32) | (pair.x & 0xFFFFFFFFL); -+ } -+ -+ public static long getCoordinateKey(final int x, final int z) { -+ return ((long)z << 32) | (x & 0xFFFFFFFFL); -+ } -+ -+ public static int getCoordinateX(final long key) { -+ return (int)key; -+ } -+ -+ public static int getCoordinateZ(final long key) { -+ return (int)(key >>> 32); -+ } -+ -+ public static int getChunkCoordinate(final double coordinate) { -+ return MCUtil.fastFloor(coordinate) >> 4; -+ } -+ -+ public static int getBlockCoordinate(final double coordinate) { -+ return MCUtil.fastFloor(coordinate); -+ } -+ -+ public static long getBlockKey(final int x, final int y, final int z) { -+ return ((long)x & 0x7FFFFFF) | (((long)z & 0x7FFFFFF) << 27) | ((long)y << 54); -+ } -+ -+ public static long getBlockKey(final BlockPos pos) { -+ return ((long)pos.getX() & 0x7FFFFFF) | (((long)pos.getZ() & 0x7FFFFFF) << 27) | ((long)pos.getY() << 54); -+ } -+ -+ public static long getBlockKey(final Entity entity) { -+ return getBlockKey(getBlockCoordinate(entity.getX()), getBlockCoordinate(entity.getY()), getBlockCoordinate(entity.getZ())); -+ } -+ -+ // assumes the sets have the same comparator, and if this comparator is null then assume T is Comparable -+ public static void mergeSortedSets(final java.util.function.Consumer consumer, final java.util.Comparator comparator, final java.util.SortedSet...sets) { -+ final ObjectRBTreeSet all = new ObjectRBTreeSet<>(comparator); -+ // note: this is done in log(n!) ~ nlogn time. It could be improved if it were to mimic what mergesort does. -+ for (java.util.SortedSet set : sets) { -+ if (set != null) { -+ all.addAll(set); -+ } -+ } -+ all.forEach(consumer); -+ } -+ -+ private MCUtil() {} -+ -+ public static final java.util.concurrent.Executor MAIN_EXECUTOR = (run) -> { -+ if (!isMainThread()) { -+ MinecraftServer.getServer().execute(run); -+ } else { -+ run.run(); -+ } -+ }; -+ + public static CompletableFuture ensureMain(CompletableFuture future) { + return future.thenApplyAsync(r -> r, MAIN_EXECUTOR); + } @@ -4347,6 +4155,7 @@ index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98d + public static void thenOnMain(CompletableFuture future, Consumer consumer) { + future.thenAcceptAsync(consumer, MAIN_EXECUTOR); + } ++ + public static void thenOnMain(CompletableFuture future, BiConsumer consumer) { + future.whenCompleteAsync(consumer, MAIN_EXECUTOR); + } @@ -4355,87 +4164,43 @@ index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98d + return MinecraftServer.getServer().isSameThread(); + } + -+ public static org.bukkit.scheduler.BukkitTask scheduleTask(int ticks, Runnable runnable) { -+ return scheduleTask(ticks, runnable, null); -+ } -+ -+ public static org.bukkit.scheduler.BukkitTask scheduleTask(int ticks, Runnable runnable, String taskName) { -+ return MinecraftServer.getServer().server.getScheduler().scheduleInternalTask(runnable, ticks, taskName); -+ } -+ -+ public static void processQueue() { -+ Runnable runnable; -+ Queue processQueue = getProcessQueue(); -+ while ((runnable = processQueue.poll()) != null) { -+ try { -+ runnable.run(); -+ } catch (Exception e) { -+ MinecraftServer.LOGGER.error("Error executing task", e); -+ } -+ } -+ } -+ public static T processQueueWhileWaiting(CompletableFuture future) { -+ try { -+ if (isMainThread()) { -+ while (!future.isDone()) { -+ try { -+ return future.get(1, TimeUnit.MILLISECONDS); -+ } catch (TimeoutException ignored) { -+ processQueue(); -+ } -+ } -+ } -+ return future.get(); -+ } catch (Exception e) { -+ throw new RuntimeException(e); -+ } -+ } -+ + public static void ensureMain(Runnable run) { + ensureMain(null, run); + } ++ + /** -+ * Ensures the target code is running on the main thread -+ * @param reason -+ * @param run ++ * Ensures the target code is running on the main thread. + */ + public static void ensureMain(String reason, Runnable run) { + if (!isMainThread()) { + if (reason != null) { + MinecraftServer.LOGGER.warn("Asynchronous " + reason + "!", new IllegalStateException()); + } -+ getProcessQueue().add(run); ++ MinecraftServer.getServer().processQueue.add(run); + return; + } + run.run(); + } + -+ private static Queue getProcessQueue() { -+ return MinecraftServer.getServer().processQueue; -+ } -+ + public static T ensureMain(Supplier run) { + return ensureMain(null, run); + } ++ + /** -+ * Ensures the target code is running on the main thread -+ * @param reason -+ * @param run -+ * @param -+ * @return ++ * Ensures the target code is running on the main thread. + */ + public static T ensureMain(String reason, Supplier run) { + if (!isMainThread()) { + if (reason != null) { + MinecraftServer.LOGGER.warn("Asynchronous " + reason + "! Blocking thread until it returns ", new IllegalStateException()); + } -+ Waitable wait = new Waitable() { ++ Waitable wait = new Waitable<>() { + @Override + protected T evaluate() { + return run.get(); + } + }; -+ getProcessQueue().add(wait); ++ MinecraftServer.getServer().processQueue.add(wait); + try { + return wait.get(); + } catch (InterruptedException | ExecutionException e) { @@ -4446,106 +4211,22 @@ index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98d + return run.get(); + } + -+ /** -+ * Calculates distance between 2 entities -+ * @param e1 -+ * @param e2 -+ * @return -+ */ -+ public static double distance(Entity e1, Entity e2) { -+ return Math.sqrt(distanceSq(e1, e2)); -+ } -+ -+ -+ /** -+ * Calculates distance between 2 block positions -+ * @param e1 -+ * @param e2 -+ * @return -+ */ -+ public static double distance(BlockPos e1, BlockPos e2) { -+ return Math.sqrt(distanceSq(e1, e2)); -+ } -+ -+ /** -+ * Gets the distance between 2 positions -+ * @param x1 -+ * @param y1 -+ * @param z1 -+ * @param x2 -+ * @param y2 -+ * @param z2 -+ * @return -+ */ + public static double distance(double x1, double y1, double z1, double x2, double y2, double z2) { + return Math.sqrt(distanceSq(x1, y1, z1, x2, y2, z2)); + } + -+ /** -+ * Get's the distance squared between 2 entities -+ * @param e1 -+ * @param e2 -+ * @return -+ */ -+ public static double distanceSq(Entity e1, Entity e2) { -+ return distanceSq(e1.getX(),e1.getY(),e1.getZ(), e2.getX(),e2.getY(),e2.getZ()); -+ } -+ -+ /** -+ * Gets the distance sqaured between 2 block positions -+ * @param pos1 -+ * @param pos2 -+ * @return -+ */ -+ public static double distanceSq(BlockPos pos1, BlockPos pos2) { -+ return distanceSq(pos1.getX(), pos1.getY(), pos1.getZ(), pos2.getX(), pos2.getY(), pos2.getZ()); -+ } -+ -+ /** -+ * Gets the distance squared between 2 positions -+ * @param x1 -+ * @param y1 -+ * @param z1 -+ * @param x2 -+ * @param y2 -+ * @param z2 -+ * @return -+ */ + public static double distanceSq(double x1, double y1, double z1, double x2, double y2, double z2) { + return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) + (z1 - z2) * (z1 - z2); + } + -+ /** -+ * Converts a NMS World/BlockPosition to Bukkit Location -+ * @param world -+ * @param x -+ * @param y -+ * @param z -+ * @return -+ */ + public static Location toLocation(Level world, double x, double y, double z) { + return new Location(world.getWorld(), x, y, z); + } + -+ /** -+ * Converts a NMS World/BlockPosition to Bukkit Location -+ * @param world -+ * @param pos -+ * @return -+ */ + public static Location toLocation(Level world, BlockPos pos) { + return new Location(world.getWorld(), pos.getX(), pos.getY(), pos.getZ()); + } + -+ /** -+ * Converts an NMS entity's current location to a Bukkit Location -+ * @param entity -+ * @return -+ */ -+ public static Location toLocation(Entity entity) { -+ return new Location(entity.getCommandSenderWorld().getWorld(), entity.getX(), entity.getY(), entity.getZ()); -+ } -+ + public static BlockPos toBlockPosition(Location loc) { + return new BlockPos(loc.getBlockX(), loc.getBlockY(), loc.getBlockZ()); + } @@ -4572,64 +4253,9 @@ index 0000000000000000000000000000000000000000..c6c723d9378c593c8608d5940f63c98d + return (modX == 0 || modX == 15 || modZ == 0 || modZ == 15); + } + -+ /** -+ * Posts a task to be executed asynchronously -+ * @param run -+ */ + public static void scheduleAsyncTask(Runnable run) { + asyncExecutor.execute(run); + } -+ -+ @Nonnull -+ public static ServerLevel getNMSWorld(@Nonnull org.bukkit.World world) { -+ return ((CraftWorld) world).getHandle(); -+ } -+ -+ public static ServerLevel getNMSWorld(@Nonnull org.bukkit.entity.Entity entity) { -+ return getNMSWorld(entity.getWorld()); -+ } -+ -+ public static BlockFace toBukkitBlockFace(Direction enumDirection) { -+ switch (enumDirection) { -+ case DOWN: -+ return BlockFace.DOWN; -+ case UP: -+ return BlockFace.UP; -+ case NORTH: -+ return BlockFace.NORTH; -+ case SOUTH: -+ return BlockFace.SOUTH; -+ case WEST: -+ return BlockFace.WEST; -+ case EAST: -+ return BlockFace.EAST; -+ default: -+ return null; -+ } -+ } -+ -+ @NotNull -+ public static List copyListAndAdd(@NotNull final List original, -+ @NotNull final T newElement) { -+ return ImmutableList.builderWithExpectedSize(original.size() + 1) -+ .addAll(original) -+ .add(newElement) -+ .build(); -+ } -+ -+ @NotNull -+ public static List copyListAndRemoveIf(@NotNull final List original, -+ @NotNull final Predicate removalPredicate) { -+ final ImmutableList.Builder builder = ImmutableList.builderWithExpectedSize(original.size()); -+ for (int i = 0; i < original.size(); i++) { -+ final T value = original.get(i); -+ if (removalPredicate.test(value)) continue; -+ -+ builder.add(value); -+ } -+ -+ return builder.build(); -+ } +} diff --git a/src/main/java/io/papermc/paper/util/StackWalkerUtil.java b/src/main/java/io/papermc/paper/util/StackWalkerUtil.java new file mode 100644 @@ -4675,18 +4301,9 @@ index 5135cd504ec5864a4603c004e748947a7d88d2b4..396f368a7e21a7c7b1630b4e20cdbc45 public static long getEpochMillis() { diff --git a/src/main/java/net/minecraft/nbt/CompoundTag.java b/src/main/java/net/minecraft/nbt/CompoundTag.java -index 6b588a4e639da11edeb933ec2bc4afde8f0b47f1..1cbc42c44911b71dfadebc2d60e0e5cb9b6cafe6 100644 +index 6b588a4e639da11edeb933ec2bc4afde8f0b47f1..d721ae6d9b54cbace5b7ade657e9739fc7c42d14 100644 --- a/src/main/java/net/minecraft/nbt/CompoundTag.java +++ b/src/main/java/net/minecraft/nbt/CompoundTag.java -@@ -159,7 +159,7 @@ public class CompoundTag implements Tag { - return "TAG_Compound"; - } - }; -- private final Map tags; -+ public final Map tags; // Paper - - protected CompoundTag(Map entries) { - this.tags = entries; @@ -235,6 +235,10 @@ public class CompoundTag implements Tag { this.tags.put(key, NbtUtils.createUUID(value)); } @@ -4837,7 +4454,7 @@ index 40adb6117b9e0d5f70103113202a07715e403e2a..cef1761cdaf3e456695f2de61f4295fb long j = Util.getNanos() - i; int k = this.tickCount % 100; diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index f40a2f348c45a29168ca3d4eef07b5b628060bee..2f253f33b866ff74e959c41d9501264cf226f45e 100644 +index f40a2f348c45a29168ca3d4eef07b5b628060bee..9a009a688c02e990723917766c51e1c0e71e338d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -37,9 +37,9 @@ public class ChunkHolder extends GenerationChunkHolder { @@ -4944,27 +4561,8 @@ index f40a2f348c45a29168ca3d4eef07b5b628060bee..2f253f33b866ff74e959c41d9501264c this.entityTickingChunkFuture = ChunkHolder.UNLOADED_LEVEL_CHUNK_FUTURE; } -@@ -425,4 +468,18 @@ public class ChunkHolder extends GenerationChunkHolder { - - List getPlayers(ChunkPos chunkPos, boolean onlyOnWatchDistanceEdge); - } -+ -+ // Paper start -+ public final boolean isEntityTickingReady() { -+ return this.isEntityTickingReady; -+ } -+ -+ public final boolean isTickingReady() { -+ return this.isTickingReady; -+ } -+ -+ public final boolean isFullChunkReady() { -+ return this.isFullChunkReady; -+ } -+ // Paper end - } diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 5b920beb39dad8d392b4e5e12a89880720e41942..16cfa946f2e121594875a57e4ff982052cf5ffd1 100644 +index 5b920beb39dad8d392b4e5e12a89880720e41942..449608e60f3900778247101581ff598f1637499b 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -170,6 +170,12 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -5127,7 +4725,7 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..16cfa946f2e121594875a57e4ff98205 Optional optional = Optional.ofNullable(playerchunk.getLatestChunk()); Optional optional1 = optional.flatMap((ichunkaccess) -> { return ichunkaccess instanceof LevelChunk ? Optional.of((LevelChunk) ichunkaccess) : Optional.empty(); -@@ -1385,10 +1406,10 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider +@@ -1385,7 +1406,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider }); } @@ -5135,35 +4733,12 @@ index 5b920beb39dad8d392b4e5e12a89880720e41942..16cfa946f2e121594875a57e4ff98205 + public class ChunkDistanceManager extends DistanceManager { // Paper - public protected ChunkDistanceManager(final Executor workerExecutor, final Executor mainThreadExecutor) { -- super(workerExecutor, mainThreadExecutor); -+ super(workerExecutor, mainThreadExecutor, ChunkMap.this); // Paper - } - - @Override + super(workerExecutor, mainThreadExecutor); diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index b6cc33943fe7e4667944f3e6f868b3033ea9ca18..27065ffc5473c518acee3a3096b83fac61eb7860 100644 +index b6cc33943fe7e4667944f3e6f868b3033ea9ca18..3d46412b307f08968bb9b96c0649e0405813462e 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -55,8 +55,9 @@ public abstract class DistanceManager { - final Executor mainThreadExecutor; - private long ticketTickCounter; - public int simulationDistance = 10; -+ private final ChunkMap chunkMap; // Paper - -- protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { -+ protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor, ChunkMap chunkMap) { - Objects.requireNonNull(mainThreadExecutor); - ProcessorHandle mailbox = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute); - ChunkTaskPriorityQueueSorter chunktaskqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(mailbox), workerExecutor, 4); -@@ -65,6 +66,7 @@ public abstract class DistanceManager { - this.ticketThrottlerInput = chunktaskqueuesorter.getProcessor(mailbox, true); - this.ticketThrottlerReleaser = chunktaskqueuesorter.getReleaseProcessor(mailbox); - this.mainThreadExecutor = mainThreadExecutor; -+ this.chunkMap = chunkMap; // Paper - } - - protected void purgeStaleTickets() { -@@ -365,7 +367,7 @@ public abstract class DistanceManager { +@@ -365,7 +365,7 @@ public abstract class DistanceManager { } public void removeTicketsOnClosing() { @@ -5443,7 +5018,7 @@ index 0914b2f9fef1f49df9f0ce7c85cdde94c2c39b6c..6abe921099ff00ecfaf0f423ef27d708 GameProfileCache usercache = this.server.getProfileCache(); // Optional optional; // CraftBukkit - decompile error diff --git a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java -index aede9b65e799a1f123f71f9390fb05acddda676b..2510589400b3012b827efcab477c6483d9d55901 100644 +index aede9b65e799a1f123f71f9390fb05acddda676b..ca94a1aaccdcc9f28b5f7936b871216a75ab762a 100644 --- a/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java +++ b/src/main/java/net/minecraft/util/thread/BlockableEventLoop.java @@ -79,6 +79,13 @@ public abstract class BlockableEventLoop implements Profiler @@ -5451,10 +5026,10 @@ index aede9b65e799a1f123f71f9390fb05acddda676b..2510589400b3012b827efcab477c6483 } } + // Paper start -+ public void scheduleOnMain(Runnable r0) { ++ public void scheduleOnMain(Runnable runnable) { + // 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.tell(this.wrapRunnable(r0)); ++ this.tell(this.wrapRunnable(runnable)); + } + // Paper end @@ -5488,44 +5063,6 @@ index 12db4c5db3d7951df984db03d09d14d808e58699..44d4aee059d74676bffb8b6bc6f6ad4d @Override public float getBukkitYaw() { -diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 930b5002aa6eaa1137314f7b38fad99778b6edaa..fcc8b66702f761c443fb647a8ab6e1ab49e5acfe 100644 ---- a/src/main/java/net/minecraft/world/entity/Mob.java -+++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -282,6 +282,8 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab - return this.target; - } - -+ public org.bukkit.craftbukkit.entity.CraftMob getBukkitMob() { return (org.bukkit.craftbukkit.entity.CraftMob) super.getBukkitEntity(); } // Paper -+ - @Nullable - protected final LivingEntity getTargetFromBrain() { - return (LivingEntity) this.getBrain().getMemory(MemoryModuleType.ATTACK_TARGET).orElse(null); // CraftBukkit - decompile error -diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index 812aecb88641c09fb5030d145620b95aff19c9cb..bd8d56aa5a3557e7a2aa1dd066b27c2054d1eef8 100644 ---- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java -+++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -@@ -22,6 +22,8 @@ public abstract class PathfinderMob extends Mob { - super(type, world); - } - -+ public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper -+ - public float getWalkTargetValue(BlockPos pos) { - return this.getWalkTargetValue(pos, this.level()); - } -diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index f73604d762efbac400d40f536ec1782fca584efa..4701bf9ee203f2f15b0b68e84bbfa2c489b66631 100644 ---- a/src/main/java/net/minecraft/world/entity/monster/Monster.java -+++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java -@@ -27,6 +27,7 @@ import net.minecraft.world.level.ServerLevelAccessor; - import net.minecraft.world.level.dimension.DimensionType; - - public abstract class Monster extends PathfinderMob implements Enemy { -+ public org.bukkit.craftbukkit.entity.CraftMonster getBukkitMonster() { return (org.bukkit.craftbukkit.entity.CraftMonster) super.getBukkitEntity(); } // Paper - protected Monster(EntityType type, Level world) { - super(type, world); - this.xpReward = 5; diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java index 15f0b0977fe7b41e29346df9d49120f14f02ea43..b6cb1de08e955dfc99a0cb736b2ed456c99fde5c 100644 --- a/src/main/java/net/minecraft/world/item/ItemStack.java @@ -5814,20 +5351,14 @@ index 497792978bdf0e6a53d772304770e8df3e7416ea..c5454b92ca2565461c799d7340160f9f public WorldBorder getWorldBorder() { return this.level.getWorldBorder(); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 9569d9d1c8f809420e08038e5bc38c2c7887ff90..4ac248f9f5f4f7aa95ddd6e3c3dab1ce94e73d66 100644 +index 9569d9d1c8f809420e08038e5bc38c2c7887ff90..d5d638d955dbcc1034bc79aace77d43e20db5995 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -834,12 +834,20 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -834,12 +834,14 @@ public abstract class BlockBehaviour implements FeatureElement { } } -+ // Paper start -+ protected boolean shapeExceedsCube = true; -+ public final boolean shapeExceedsCube() { -+ return this.shapeExceedsCube; -+ } -+ // Paper end -+ ++ protected boolean shapeExceedsCube = true; // Paper - moved from actual method to here public void initCache() { this.fluidState = ((Block) this.owner).getFluidState(this.asState()); this.isRandomlyTicking = ((Block) this.owner).isRandomlyTicking(this.asState()); @@ -5838,7 +5369,7 @@ index 9569d9d1c8f809420e08038e5bc38c2c7887ff90..4ac248f9f5f4f7aa95ddd6e3c3dab1ce this.legacySolid = this.calculateSolid(); } -@@ -886,8 +894,8 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -886,8 +888,8 @@ public abstract class BlockBehaviour implements FeatureElement { return this.getBlock().getOcclusionShape(this.asState(), world, pos); } @@ -6189,265 +5720,6 @@ index 952c6ebde7031dc060efe98992f82c02bf3534ea..17fa2d3db112762bcb8b941b69b8ddcc public static net.minecraft.world.item.ItemStack asNMSCopy(ItemStack original) { if (original instanceof CraftItemStack) { CraftItemStack stack = (CraftItemStack) original; -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index c017ce2ca1bc535795c958a2e509af2adf88efa9..0f7c3a44acf3c59ae43605e573f9da7f7c594647 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -46,6 +46,7 @@ import org.bukkit.scheduler.BukkitWorker; - */ - public class CraftScheduler implements BukkitScheduler { - -+ static Plugin MINECRAFT = new MinecraftInternalPlugin(); - /** - * The start ID for the counter. - */ -@@ -194,6 +195,11 @@ public class CraftScheduler implements BukkitScheduler { - this.runTaskTimer(plugin, (Object) task, delay, period); - } - -+ public BukkitTask scheduleInternalTask(Runnable run, int delay, String taskName) { -+ final CraftTask task = new CraftTask(run, nextId(), taskName); -+ return handle(task, delay); -+ } -+ - public BukkitTask runTaskTimer(Plugin plugin, Object runnable, long delay, long period) { - CraftScheduler.validate(plugin, runnable); - if (delay < 0L) { -@@ -417,13 +423,20 @@ public class CraftScheduler implements BukkitScheduler { - task.run(); - task.timings.stopTiming(); // Spigot - } catch (final Throwable throwable) { -- task.getOwner().getLogger().log( -+ // Paper start -+ String msg = String.format( -+ "Task #%s for %s generated an exception", -+ task.getTaskId(), -+ task.getOwner().getDescription().getFullName()); -+ if (task.getOwner() == MINECRAFT) { -+ net.minecraft.server.MinecraftServer.LOGGER.error(msg, throwable); -+ } else { -+ task.getOwner().getLogger().log( - Level.WARNING, -- String.format( -- "Task #%s for %s generated an exception", -- task.getTaskId(), -- task.getOwner().getDescription().getFullName()), -+ msg, - throwable); -+ } -+ // Paper end - } finally { - this.currentTask = null; - } -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index e4d1eb4a0ce2c9874922585f6bb0d9ead433fde1..d56abf283f38548faa790c57045033f7ade6f958 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -@@ -40,6 +40,21 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot - CraftTask(final Object task) { - this(null, task, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING); - } -+ // Paper start -+ public String taskName = null; -+ boolean internal = false; -+ CraftTask(final Object task, int id, String taskName) { -+ this.rTask = (Runnable) task; -+ this.cTask = null; -+ this.plugin = CraftScheduler.MINECRAFT; -+ this.taskName = taskName; -+ this.internal = true; -+ this.id = id; -+ this.period = CraftTask.NO_REPEATING; -+ this.taskName = taskName; -+ this.timings = null; // Will be changed in later patch -+ } -+ // Paper end - - CraftTask(final Plugin plugin, final Object task, final int id, final long period) { - this.plugin = plugin; -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -new file mode 100644 -index 0000000000000000000000000000000000000000..909b2c98e7a9117d2f737245e4661792ffafb744 ---- /dev/null -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -@@ -0,0 +1,140 @@ -+package org.bukkit.craftbukkit.scheduler; -+ -+ -+import org.bukkit.Server; -+import org.bukkit.command.Command; -+import org.bukkit.command.CommandSender; -+import org.bukkit.configuration.file.FileConfiguration; -+import org.bukkit.generator.BiomeProvider; -+import org.bukkit.generator.ChunkGenerator; -+import org.bukkit.plugin.PluginBase; -+import org.bukkit.plugin.PluginDescriptionFile; -+import org.bukkit.plugin.PluginLoader; -+import org.bukkit.plugin.PluginLogger; -+import org.jetbrains.annotations.NotNull; -+import org.jetbrains.annotations.Nullable; -+ -+import java.io.File; -+import java.io.InputStream; -+import java.util.List; -+ -+public class MinecraftInternalPlugin extends PluginBase { -+ private boolean enabled = true; -+ -+ private final String pluginName; -+ private PluginDescriptionFile pdf; -+ -+ public MinecraftInternalPlugin() { -+ this.pluginName = "Minecraft"; -+ pdf = new PluginDescriptionFile(pluginName, "1.0", "nms"); -+ } -+ -+ public void setEnabled(boolean enabled) { -+ this.enabled = enabled; -+ } -+ -+ @Override -+ public File getDataFolder() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public PluginDescriptionFile getDescription() { -+ return pdf; -+ } -+ -+ @Override -+ public FileConfiguration getConfig() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public InputStream getResource(String filename) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void saveConfig() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void saveDefaultConfig() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void saveResource(String resourcePath, boolean replace) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void reloadConfig() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public PluginLogger getLogger() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public PluginLoader getPluginLoader() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public Server getServer() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public boolean isEnabled() { -+ return enabled; -+ } -+ -+ @Override -+ public void onDisable() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void onLoad() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void onEnable() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public boolean isNaggable() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public void setNaggable(boolean canNag) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public ChunkGenerator getDefaultWorldGenerator(String worldName, String id) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public @Nullable BiomeProvider getDefaultBiomeProvider(@NotNull String worldName, @Nullable String id) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public boolean onCommand(CommandSender sender, Command command, String label, String[] args) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ -+ @Override -+ public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+} -diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index aa6a9dcd5528df38dddc0c661334c35658a19cee..65b92a787b131984ad3e48d8dd6812e1b433c77f 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -106,8 +106,17 @@ public final class CraftMagicNumbers implements UnsafeValues { - private static final Map ITEM_MATERIAL = new HashMap<>(); - private static final Map MATERIAL_ITEM = new HashMap<>(); - private static final Map MATERIAL_BLOCK = 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<>(); - - 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, BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey()))); -+ ENTITY_TYPES_ENTITY_TYPE.put(BuiltInRegistries.ENTITY_TYPE.get(CraftNamespacedKey.toMinecraft(type.getKey())), type); -+ } -+ // Paper end - for (Block block : BuiltInRegistries.BLOCK) { - BLOCK_MATERIAL.put(block, Material.getMaterial(BuiltInRegistries.BLOCK.getKey(block).getPath().toUpperCase(Locale.ROOT))); - } -@@ -158,6 +167,14 @@ public final class CraftMagicNumbers implements UnsafeValues { - public static ResourceLocation key(Material mat) { - return CraftNamespacedKey.toMinecraft(mat.getKey()); - } -+ // Paper start -+ public static net.minecraft.world.entity.EntityType getEntityTypes(org.bukkit.entity.EntityType type) { -+ return ENTITY_TYPE_ENTITY_TYPES.get(type); -+ } -+ public static org.bukkit.entity.EntityType getEntityType(net.minecraft.world.entity.EntityType entityTypes) { -+ return ENTITY_TYPES_ENTITY_TYPE.get(entityTypes); -+ } -+ // Paper end - // ======================================================================== - - public static byte toLegacyData(BlockState data) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java b/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java index 5fd6eb754c4edebed6798c65b06507a4e89ca48f..524b51a0ab808a0629c871ad813115abd4b49dbd 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/DelegatedGeneratorAccess.java @@ -6513,43 +5785,6 @@ index e837d76e833d73d888bc1dad3515c2b82bc0e437..4705aed1dd98378c146bf9e346df1a17 @Override public WorldBorder getWorldBorder() { throw new UnsupportedOperationException("Not supported yet."); -diff --git a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java -index 96c4f7aed548a181f6b1487e58dcf157bae52daa..837e3d6ee71566b5a6f37a49438291333c47f5d1 100644 ---- a/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java -+++ b/src/main/java/org/bukkit/craftbukkit/util/UnsafeList.java -@@ -120,6 +120,32 @@ public class UnsafeList extends AbstractList implements List, RandomAcc - return this.indexOf(o) >= 0; - } - -+ // Paper start -+ protected transient int maxSize; -+ public void setSize(int size) { -+ if (this.maxSize < this.size) { -+ this.maxSize = this.size; -+ } -+ this.size = size; -+ } -+ -+ public void completeReset() { -+ if (this.data != null) { -+ Arrays.fill(this.data, 0, Math.max(this.size, this.maxSize), null); -+ } -+ this.size = 0; -+ this.maxSize = 0; -+ if (this.iterPool != null) { -+ for (Iterator temp : this.iterPool) { -+ if (temp == null) { -+ continue; -+ } -+ ((Itr)temp).valid = false; -+ } -+ } -+ } -+ // Paper end -+ - @Override - public void clear() { - // Create new array to reset memory usage to initial capacity diff --git a/src/main/java/org/spigotmc/ActivationRange.java b/src/main/java/org/spigotmc/ActivationRange.java index 0c7c97f27853843ec714e47f5b570f9d09bbba14..ff422d4d4f2b764370f0ee2af13034853c1d3fe1 100644 --- a/src/main/java/org/spigotmc/ActivationRange.java @@ -6564,20 +5799,3 @@ index 0c7c97f27853843ec714e47f5b570f9d09bbba14..ff422d4d4f2b764370f0ee2af1303485 MONSTER, ANIMAL, RAIDER, -diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index e42677a14ec8e1a42747603fb4112822e326fb70..518ff88b32d1b5653a617ec2eaa23813c53b6acc 100644 ---- a/src/main/java/org/spigotmc/SpigotConfig.java -+++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -118,7 +118,11 @@ public class SpigotConfig - } - } - } -- -+ // Paper start -+ SpigotConfig.save(); -+ } -+ public static void save() { -+ // Paper end - try - { - SpigotConfig.config.save( SpigotConfig.CONFIG_FILE ); diff --git a/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch b/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch index 714d232818..8128ee5424 100644 --- a/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch +++ b/patches/server/0012-Handle-plugin-prefixes-using-Log4J-configuration.patch @@ -28,10 +28,10 @@ index 0a05e753ff5e7b1d741c7719524715d7364cac4f..d82d1e90cbda544b3d20edcc13d1cb95 runtimeOnly(log4jPlugins.output) alsoShade(log4jPlugins.output) diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index fbbc08c5a189b99f8047e0f0f5cd31101149dbec..b717c9d8b6edc2cafc9281140913b7bdb6108cf0 100644 +index e42677a14ec8e1a42747603fb4112822e326fb70..744edd40128c910c3ad2f3657bde995612e0a1e4 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -288,7 +288,7 @@ public class SpigotConfig +@@ -284,7 +284,7 @@ public class SpigotConfig private static void playerSample() { SpigotConfig.playerSample = SpigotConfig.getInt( "settings.sample-count", 12 ); diff --git a/patches/server/0019-Paper-Plugins.patch b/patches/server/0019-Paper-Plugins.patch index 0c8a4a74f2..420963ff9e 100644 --- a/patches/server/0019-Paper-Plugins.patch +++ b/patches/server/0019-Paper-Plugins.patch @@ -7328,28 +7328,11 @@ index 29f94e574e39714caec95af5c176c9dba481728e..b532c72ec2c048554e496b4b63afa0e9 this.loadPlugins(); this.enablePlugins(PluginLoadOrder.STARTUP); this.enablePlugins(PluginLoadOrder.POSTWORLD); -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -index 909b2c98e7a9117d2f737245e4661792ffafb744..d96399e9bf1a58db5a4a22e58abb99e7660e0694 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -@@ -42,6 +42,12 @@ public class MinecraftInternalPlugin extends PluginBase { - public PluginDescriptionFile getDescription() { - return pdf; - } -+ // Paper start -+ @Override -+ public io.papermc.paper.plugin.configuration.PluginMeta getPluginMeta() { -+ return pdf; -+ } -+ // Paper end - - @Override - public FileConfiguration getConfig() { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 1bf1f10f8691922a69cd13c6a4e643b863801b4f..e8205646dbe7088e6bdece2567151bd7f64f36cb 100644 +index 5a89b9ca6a62f0bfb5fe01ed4097870788cf5d83..a6de88625aeb2c5ababd476e804e9b45b1185efe 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -412,6 +412,16 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -395,6 +395,16 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.world.item.ItemStack nmsItemStack = CraftItemStack.asNMSCopy(itemStack); return nmsItemStack.getItem().getDescriptionId(nmsItemStack); } diff --git a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch index f9cbe5fc85..b2618a220f 100644 --- a/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch +++ b/patches/server/0022-Remap-reflection-calls-in-plugins-using-internals.patch @@ -710,10 +710,10 @@ index 421ddf6ca955215dff77655a7eda62eb9d90aa92..1cef3614e81e751c98b504c26da4718d String className; boolean isInterface; diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e8205646dbe7088e6bdece2567151bd7f64f36cb..10b5fcf6575255000e52166eb73b60f6a3f88e84 100644 +index a6de88625aeb2c5ababd476e804e9b45b1185efe..7fdc5f5b8ce2401ac480dd5691d99b2d297c6168 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -357,7 +357,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -340,7 +340,7 @@ public final class CraftMagicNumbers implements UnsafeValues { throw new InvalidPluginException("Plugin API version " + pdf.getAPIVersion() + " is lower than the minimum allowed version. Please update or replace it."); } @@ -722,7 +722,7 @@ index e8205646dbe7088e6bdece2567151bd7f64f36cb..10b5fcf6575255000e52166eb73b60f6 CraftLegacy.init(); } -@@ -372,6 +372,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -355,6 +355,7 @@ public final class CraftMagicNumbers implements UnsafeValues { @Override public byte[] processClass(PluginDescriptionFile pdf, String path, byte[] clazz) { diff --git a/patches/server/0023-Timings-v2.patch b/patches/server/0023-Timings-v2.patch index c9b5110de5..605ff6a94f 100644 --- a/patches/server/0023-Timings-v2.patch +++ b/patches/server/0023-Timings-v2.patch @@ -1823,7 +1823,7 @@ index 807184636a99c17fe6ed8dd1cd07e1872d613657..68b9b4aba7dba31e4526165e6efb8c40 public Player.Spigot spigot() diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad0f25cc0d 100644 +index c017ce2ca1bc535795c958a2e509af2adf88efa9..6c0debe3f3b693ed90dd2a39f481cccd8e4f7634 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java @@ -1,5 +1,6 @@ @@ -1833,17 +1833,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad import com.google.common.base.Preconditions; import com.google.common.util.concurrent.ThreadFactoryBuilder; import java.util.ArrayList; -@@ -196,7 +197,8 @@ public class CraftScheduler implements BukkitScheduler { - } - - public BukkitTask scheduleInternalTask(Runnable run, int delay, String taskName) { -- final CraftTask task = new CraftTask(run, nextId(), taskName); -+ final CraftTask task = new CraftTask(run, nextId(), "Internal - " + (taskName != null ? taskName : "Unknown")); -+ task.internal = true; - return handle(task, delay); - } - -@@ -277,7 +279,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -271,7 +272,7 @@ public class CraftScheduler implements BukkitScheduler { } return false; } @@ -1852,7 +1842,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad this.handle(task, 0L); for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { -@@ -312,7 +314,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -306,7 +307,7 @@ public class CraftScheduler implements BukkitScheduler { } } } @@ -1861,7 +1851,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad this.handle(task, 0L); for (CraftTask taskPending = this.head.getNext(); taskPending != null; taskPending = taskPending.getNext()) { if (taskPending == task) { -@@ -419,9 +421,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -413,9 +414,7 @@ public class CraftScheduler implements BukkitScheduler { if (task.isSync()) { this.currentTask = task; try { @@ -1869,9 +1859,9 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad task.run(); - task.timings.stopTiming(); // Spigot } catch (final Throwable throwable) { - // Paper start - String msg = String.format( -@@ -455,8 +455,10 @@ public class CraftScheduler implements BukkitScheduler { + task.getOwner().getLogger().log( + Level.WARNING, +@@ -442,8 +441,10 @@ public class CraftScheduler implements BukkitScheduler { this.runners.remove(task.getTaskId()); } } @@ -1882,7 +1872,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad this.debugHead = this.debugHead.getNextHead(currentTick); } -@@ -493,6 +495,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -480,6 +481,7 @@ public class CraftScheduler implements BukkitScheduler { } private void parsePending() { @@ -1890,7 +1880,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad CraftTask head = this.head; CraftTask task = head.getNext(); CraftTask lastTask = head; -@@ -511,6 +514,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -498,6 +500,7 @@ public class CraftScheduler implements BukkitScheduler { task.setNext(null); } this.head = lastTask; @@ -1899,7 +1889,7 @@ index 0f7c3a44acf3c59ae43605e573f9da7f7c594647..a3ccc2da0927cc49e5fcfbd863e648ad private boolean isReady(final int currentTick) { diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java -index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e57708dcb 100644 +index e4d1eb4a0ce2c9874922585f6bb0d9ead433fde1..ba369f3dcfdf498e971dc4405d39657a9b6e97cc 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftTask.java @@ -1,12 +1,15 @@ @@ -1936,16 +1926,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e CraftTask() { this(null, null, CraftTask.NO_REPEATING, CraftTask.NO_REPEATING); } -@@ -52,7 +55,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot - this.id = id; - this.period = CraftTask.NO_REPEATING; - this.taskName = taskName; -- this.timings = null; // Will be changed in later patch -+ this.timings = MinecraftTimings.getInternalTaskName(taskName); - } - // Paper end - -@@ -73,7 +76,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -58,7 +61,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot } this.id = id; this.period = period; @@ -1954,7 +1935,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e } @Override -@@ -93,11 +96,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -78,11 +81,13 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot @Override public void run() { @@ -1968,7 +1949,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e } long getCreatedAt() { -@@ -128,7 +133,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -113,7 +118,7 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot this.next = next; } @@ -1977,7 +1958,7 @@ index d56abf283f38548faa790c57045033f7ade6f958..ea26d9464644b5217879b8c21b4da28e return (this.rTask != null) ? this.rTask.getClass() : ((this.cTask != null) ? this.cTask.getClass() : null); } -@@ -152,9 +157,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot +@@ -137,9 +142,4 @@ public class CraftTask implements BukkitTask, Runnable { // Spigot return true; } @@ -2004,12 +1985,12 @@ index f97eccb6a17c7876e1e002d798eb67bbe80571a0..76effc345d362047e64d064eb64a5222 + } // Paper } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 10b5fcf6575255000e52166eb73b60f6a3f88e84..a356d4d19e4b7a3d08c80a137609d1ed9db7c1b1 100644 +index 7fdc5f5b8ce2401ac480dd5691d99b2d297c6168..3a0c10d2d3dfbd04be421225f639cbd31aa93e70 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -213,6 +213,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -196,6 +196,12 @@ public final class CraftMagicNumbers implements UnsafeValues { + return CraftNamespacedKey.toMinecraft(mat.getKey()); } - // Paper end // ======================================================================== + // Paper start + @Override @@ -2020,7 +2001,7 @@ index 10b5fcf6575255000e52166eb73b60f6a3f88e84..a356d4d19e4b7a3d08c80a137609d1ed public static byte toLegacyData(BlockState data) { return CraftLegacy.toLegacyData(data); -@@ -453,6 +459,12 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -436,6 +442,12 @@ public final class CraftMagicNumbers implements UnsafeValues { public DamageSource.Builder createDamageSourceBuilder(DamageType damageType) { return new CraftDamageSourceBuilder(damageType); } diff --git a/patches/server/0030-Allow-nerfed-mobs-to-jump.patch b/patches/server/0030-Allow-nerfed-mobs-to-jump.patch index 1c95173e39..a43842f5bc 100644 --- a/patches/server/0030-Allow-nerfed-mobs-to-jump.patch +++ b/patches/server/0030-Allow-nerfed-mobs-to-jump.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Allow nerfed mobs to jump diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index fcc8b66702f761c443fb647a8ab6e1ab49e5acfe..bf905bc1c4918412e3c324a62d2915b57c40d2cc 100644 +index 930b5002aa6eaa1137314f7b38fad99778b6edaa..0593d828c911c94c9833bf12b9c294e5dac1f4e8 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -124,6 +124,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -16,7 +16,7 @@ index fcc8b66702f761c443fb647a8ab6e1ab49e5acfe..bf905bc1c4918412e3c324a62d2915b5 public GoalSelector targetSelector; @Nullable private LivingEntity target; -@@ -890,7 +891,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -888,7 +889,15 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override protected final void serverAiStep() { ++this.noActionTime; diff --git a/patches/server/0031-Add-configurable-entity-despawn-distances.patch b/patches/server/0031-Add-configurable-entity-despawn-distances.patch index 348a1c4e40..fa5b7ed6a7 100644 --- a/patches/server/0031-Add-configurable-entity-despawn-distances.patch +++ b/patches/server/0031-Add-configurable-entity-despawn-distances.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add configurable entity despawn distances diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index bf905bc1c4918412e3c324a62d2915b57c40d2cc..51b33ea29af0f4010dfb8a1a7503cb7ca463209e 100644 +index 0593d828c911c94c9833bf12b9c294e5dac1f4e8..5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -866,14 +866,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -864,14 +864,14 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (entityhuman != null) { double d0 = entityhuman.distanceToSqr((Entity) this); diff --git a/patches/server/0033-Expose-server-build-information.patch b/patches/server/0033-Expose-server-build-information.patch index 3808d4a101..50963a453e 100644 --- a/patches/server/0033-Expose-server-build-information.patch +++ b/patches/server/0033-Expose-server-build-information.patch @@ -638,10 +638,10 @@ index 1c8049bbc08be77673d375205bd42a346ff951b8..e37a7aceae6c69083ecf81af4f750c01 net.minecraft.server.Main.main(options); } catch (Throwable t) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index a356d4d19e4b7a3d08c80a137609d1ed9db7c1b1..e85faddc157869824e30426a7ca2c577552aea9c 100644 +index 3a0c10d2d3dfbd04be421225f639cbd31aa93e70..7af1d4685dcf1e73c5972cb25ded219e713b1f0a 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -464,6 +464,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -447,6 +447,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getTimingsServerName() { return io.papermc.paper.configuration.GlobalConfiguration.get().timings.serverName; } diff --git a/patches/server/0034-Player-affects-spawning-API.patch b/patches/server/0034-Player-affects-spawning-API.patch index 10b2ecdde8..cf0d8b3c60 100644 --- a/patches/server/0034-Player-affects-spawning-API.patch +++ b/patches/server/0034-Player-affects-spawning-API.patch @@ -21,10 +21,10 @@ index 3126e8cab3c40e3af47f4c8925e1c6a9523309ba..3207166061bf9c4d7bf3f38e5a9f7aff public static Predicate withinDistance(double x, double y, double z, double max) { double d4 = max * max; diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 51b33ea29af0f4010dfb8a1a7503cb7ca463209e..e81a25462239dbb3993f31ff927bd809aef0a124 100644 +index 5fd0e3d27f3c86f1ff767b45dfa6138c30f13e3e..a753fd0434f611d8c77270012e383e3210f1194b 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -862,7 +862,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -860,7 +860,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (this.level().getDifficulty() == Difficulty.PEACEFUL && this.shouldDespawnInPeaceful()) { this.discard(EntityRemoveEvent.Cause.DESPAWN); // CraftBukkit - add Bukkit remove cause } else if (!this.isPersistenceRequired() && !this.requiresCustomPersistence()) { @@ -135,7 +135,7 @@ index f38f62e777d88a783e1e3b7e1a48da921cc67cf4..77ae7882a08441d9a80b50492be5e484 for (Player player : this.players()) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index eb633256f353ddaee5098d11f0e5f50d7e5a26cd..4cc6b3162cea049134f194ed84a7552830cb85af 100644 +index 68b9b4aba7dba31e4526165e6efb8c40f9e841bc..1b2ead250233d9f228bfe8e79f988026506895f9 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -2425,6 +2425,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0062-Add-exception-reporting-event.patch b/patches/server/0062-Add-exception-reporting-event.patch index 83206d2117..3efe1b1f98 100644 --- a/patches/server/0062-Add-exception-reporting-event.patch +++ b/patches/server/0062-Add-exception-reporting-event.patch @@ -91,7 +91,7 @@ index 8183c26b4a5ad169a53702b8c45fd05cda934e80..36dec6cd78a0990ba3c09a4a748c259e } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 68436413645e0e33f22cdee0ea101ca01b343d75..4f5ff6849e0ea7a4f2491e0dbede7699554239dc 100644 +index b4293991dddc9039c26106ac8c047e5aeec35a56..32b42d25631aecdd31db4954a8bbf38bcda98d6b 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -733,6 +733,7 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -171,19 +171,32 @@ index 15f273aa592828719de6e092d79a407dc8652dfe..b24e8255ab18eb5b2e4968aa62aa3d72 try { filechannel.close(); diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index a3ccc2da0927cc49e5fcfbd863e648ad0f25cc0d..dc7872afbdd06eb976bee6aee56a40b44084c24a 100644 +index 6c0debe3f3b693ed90dd2a39f481cccd8e4f7634..cf9f04e005940f5dd7baf50435f3703fa7c2d4f0 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -436,6 +436,8 @@ public class CraftScheduler implements BukkitScheduler { - msg, +@@ -416,20 +416,25 @@ public class CraftScheduler implements BukkitScheduler { + try { + task.run(); + } catch (final Throwable throwable) { ++ // Paper start ++ final String logMessage = String.format( ++ "Task #%s for %s generated an exception", ++ task.getTaskId(), ++ task.getOwner().getDescription().getFullName()); + task.getOwner().getLogger().log( + Level.WARNING, +- String.format( +- "Task #%s for %s generated an exception", +- task.getTaskId(), +- task.getOwner().getDescription().getFullName()), ++ logMessage, throwable); - } + org.bukkit.Bukkit.getServer().getPluginManager().callEvent( -+ new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerSchedulerException(msg, throwable, task))); - // Paper end ++ new com.destroystokyo.paper.event.server.ServerExceptionEvent(new com.destroystokyo.paper.exception.ServerSchedulerException(logMessage, throwable, task))); ++ // Paper end } finally { this.currentTask = null; -@@ -443,7 +445,7 @@ public class CraftScheduler implements BukkitScheduler { + } this.parsePending(); } else { this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); diff --git a/patches/server/0127-Remove-CraftScheduler-Async-Task-Debugger.patch b/patches/server/0127-Remove-CraftScheduler-Async-Task-Debugger.patch index 721f748db6..eff18e42d8 100644 --- a/patches/server/0127-Remove-CraftScheduler-Async-Task-Debugger.patch +++ b/patches/server/0127-Remove-CraftScheduler-Async-Task-Debugger.patch @@ -9,10 +9,10 @@ One report of a suspected memory leak with the system. This adds additional overhead to asynchronous task dispatching diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267effe1df5205 100644 +index cf9f04e005940f5dd7baf50435f3703fa7c2d4f0..f1145585eed18be0aa5c795a50589103fdc9cc2f 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -444,7 +444,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -433,7 +433,7 @@ public class CraftScheduler implements BukkitScheduler { } this.parsePending(); } else { @@ -21,7 +21,7 @@ index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267eff this.executor.execute(new com.destroystokyo.paper.ServerSchedulerReportingWrapper(task)); // Paper // We don't need to parse pending // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) -@@ -461,7 +461,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -450,7 +450,7 @@ public class CraftScheduler implements BukkitScheduler { this.pending.addAll(temp); temp.clear(); MinecraftTimings.bukkitSchedulerFinishTimer.stopTiming(); // Paper @@ -30,7 +30,7 @@ index dc7872afbdd06eb976bee6aee56a40b44084c24a..af3997e47aff9c43dc5019f1b0267eff } private void addTask(final CraftTask task) { -@@ -525,10 +525,15 @@ public class CraftScheduler implements BukkitScheduler { +@@ -514,10 +514,15 @@ public class CraftScheduler implements BukkitScheduler { @Override public String toString() { diff --git a/patches/server/0132-Item-canEntityPickup.patch b/patches/server/0132-Item-canEntityPickup.patch index 1bb47aa9ca..42c74b33f3 100644 --- a/patches/server/0132-Item-canEntityPickup.patch +++ b/patches/server/0132-Item-canEntityPickup.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Item#canEntityPickup diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index e81a25462239dbb3993f31ff927bd809aef0a124..25fd665f3b02edfcc9fc7092b93296a7c6e43338 100644 +index a753fd0434f611d8c77270012e383e3210f1194b..55aecada617bd84676928a7818f1511b2d85e7bf 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -675,6 +675,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -673,6 +673,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab ItemEntity entityitem = (ItemEntity) iterator.next(); if (!entityitem.isRemoved() && !entityitem.getItem().isEmpty() && !entityitem.hasPickUpDelay() && this.wantsToPickUp(entityitem.getItem())) { diff --git a/patches/server/0136-Basic-PlayerProfile-API.patch b/patches/server/0136-Basic-PlayerProfile-API.patch index a1a079b155..c6ad6df561 100644 --- a/patches/server/0136-Basic-PlayerProfile-API.patch +++ b/patches/server/0136-Basic-PlayerProfile-API.patch @@ -558,37 +558,6 @@ index 0000000000000000000000000000000000000000..7ac27392a8647ef7d0dc78efe78703e9 + + @NotNull GameProfile buildGameProfile(); +} -diff --git a/src/main/java/io/papermc/paper/util/MCUtil.java b/src/main/java/io/papermc/paper/util/MCUtil.java -index c6c723d9378c593c8608d5940f63c98dff097cd0..02d6c98b7a2212b13ffd9859ebfdc0a8357ebe65 100644 ---- a/src/main/java/io/papermc/paper/util/MCUtil.java -+++ b/src/main/java/io/papermc/paper/util/MCUtil.java -@@ -1,5 +1,7 @@ - package io.papermc.paper.util; - -+import com.destroystokyo.paper.profile.CraftPlayerProfile; -+import com.destroystokyo.paper.profile.PlayerProfile; - import com.google.common.collect.ImmutableList; - import com.google.common.util.concurrent.ThreadFactoryBuilder; - import io.papermc.paper.math.BlockPosition; -@@ -18,6 +20,7 @@ import net.minecraft.world.level.ClipContext; - import net.minecraft.world.level.Level; - import net.minecraft.world.phys.Vec3; - 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; -@@ -363,6 +366,10 @@ public final class MCUtil { - return run.get(); - } - -+ public static PlayerProfile toBukkit(GameProfile profile) { -+ return CraftPlayerProfile.asBukkitMirror(profile); -+ } -+ - /** - * 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 6afede80c10503a261d0f735c351d943597be9ff..993296f9c2457809bd6b844c309895f417eb42a5 100644 --- a/src/main/java/net/minecraft/server/Main.java diff --git a/patches/server/0145-ProfileWhitelistVerifyEvent.patch b/patches/server/0145-ProfileWhitelistVerifyEvent.patch index fc614a6bf3..69af001b9f 100644 --- a/patches/server/0145-ProfileWhitelistVerifyEvent.patch +++ b/patches/server/0145-ProfileWhitelistVerifyEvent.patch @@ -5,7 +5,7 @@ Subject: [PATCH] ProfileWhitelistVerifyEvent diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d5f17d7e3b56ca87ec9070b69265ce098de61f69..fec45c058695e68a907684880c87ccf11827565d 100644 +index d5f17d7e3b56ca87ec9070b69265ce098de61f69..768a5c6ebc4466aae4108a79e1564b2bfc93463a 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -624,9 +624,9 @@ public abstract class PlayerList { @@ -21,7 +21,7 @@ index d5f17d7e3b56ca87ec9070b69265ce098de61f69..fec45c058695e68a907684880c87ccf1 } else if (this.getIpBans().isBanned(socketaddress) && !this.getIpBans().get(socketaddress).hasExpired()) { IpBanListEntry ipbanentry = this.ipBans.get(socketaddress); -@@ -993,7 +993,23 @@ public abstract class PlayerList { +@@ -993,7 +993,24 @@ public abstract class PlayerList { } public boolean isWhiteListed(GameProfile profile) { @@ -33,7 +33,8 @@ index d5f17d7e3b56ca87ec9070b69265ce098de61f69..fec45c058695e68a907684880c87ccf1 + boolean isOp = this.ops.contains(gameprofile); + boolean isWhitelisted = !this.doWhiteList || isOp || this.whitelist.contains(gameprofile); + final com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent event; -+ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(io.papermc.paper.util.MCUtil.toBukkit(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); ++ ++ event = new com.destroystokyo.paper.event.profile.ProfileWhitelistVerifyEvent(com.destroystokyo.paper.profile.CraftPlayerProfile.asBukkitMirror(gameprofile), this.doWhiteList, isWhitelisted, isOp, org.spigotmc.SpigotConfig.whitelistMessage); + event.callEvent(); + if (!event.isWhitelisted()) { + if (loginEvent != null) { diff --git a/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch b/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch index f39816c85d..62fccd9459 100644 --- a/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch +++ b/patches/server/0174-Implement-extended-PaperServerListPingEvent.patch @@ -208,10 +208,10 @@ index f08700abb005f487aca95c0457c09cefa9a81be2..532f09089b8d6798999cf3f83e852df7 } diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index ba621fdc82896245f6ce448e084847edc4d3fe08..d063d356388810fb6f0dddfbc8b5885b3e6442aa 100644 +index d9e73e37b54e2f6e13313977c76cb4212c240992..b97ff4a9b69699577bf8cde0869b70353101ef46 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -289,7 +289,7 @@ public class SpigotConfig +@@ -285,7 +285,7 @@ public class SpigotConfig public static int playerSample; private static void playerSample() { diff --git a/patches/server/0178-Improved-Async-Task-Scheduler.patch b/patches/server/0178-Improved-Async-Task-Scheduler.patch index 3ce3a754e3..a1211ae89e 100644 --- a/patches/server/0178-Improved-Async-Task-Scheduler.patch +++ b/patches/server/0178-Improved-Async-Task-Scheduler.patch @@ -159,10 +159,10 @@ index 0000000000000000000000000000000000000000..3c1992e212a6d6f1db4d5b807b38d719 + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30bfe61bd0 100644 +index f1145585eed18be0aa5c795a50589103fdc9cc2f..02835e4f0a0b262af27acff0939c981cae728db4 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -77,7 +77,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -76,7 +76,7 @@ public class CraftScheduler implements BukkitScheduler { /** * Main thread logic only */ @@ -171,7 +171,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 new Comparator() { @Override public int compare(final CraftTask o1, final CraftTask o2) { -@@ -94,12 +94,13 @@ public class CraftScheduler implements BukkitScheduler { +@@ -93,12 +93,13 @@ public class CraftScheduler implements BukkitScheduler { /** * These are tasks that are currently active. It's provided for 'viewing' the current state. */ @@ -187,7 +187,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 private final Executor executor = Executors.newCachedThreadPool(new ThreadFactoryBuilder().setNameFormat("Craft Scheduler Thread - %d").build()); private CraftAsyncDebugger debugHead = new CraftAsyncDebugger(-1, null, null) { @Override -@@ -108,12 +109,31 @@ public class CraftScheduler implements BukkitScheduler { +@@ -107,12 +108,31 @@ public class CraftScheduler implements BukkitScheduler { } }; private CraftAsyncDebugger debugTail = this.debugHead; @@ -219,7 +219,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 @Override public int scheduleSyncDelayedTask(final Plugin plugin, final Runnable task) { return this.scheduleSyncDelayedTask(plugin, task, 0L); -@@ -236,7 +256,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -229,7 +249,7 @@ public class CraftScheduler implements BukkitScheduler { } else if (period < CraftTask.NO_REPEATING) { period = CraftTask.NO_REPEATING; } @@ -228,7 +228,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 } @Override -@@ -252,6 +272,11 @@ public class CraftScheduler implements BukkitScheduler { +@@ -245,6 +265,11 @@ public class CraftScheduler implements BukkitScheduler { if (taskId <= 0) { return; } @@ -240,7 +240,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 CraftTask task = this.runners.get(taskId); if (task != null) { task.cancel0(); -@@ -294,6 +319,11 @@ public class CraftScheduler implements BukkitScheduler { +@@ -287,6 +312,11 @@ public class CraftScheduler implements BukkitScheduler { @Override public void cancelTasks(final Plugin plugin) { Preconditions.checkArgument(plugin != null, "Cannot cancel tasks of null plugin"); @@ -252,7 +252,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 final CraftTask task = new CraftTask( new Runnable() { @Override -@@ -333,6 +363,13 @@ public class CraftScheduler implements BukkitScheduler { +@@ -326,6 +356,13 @@ public class CraftScheduler implements BukkitScheduler { @Override public boolean isCurrentlyRunning(final int taskId) { @@ -266,7 +266,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 final CraftTask task = this.runners.get(taskId); if (task == null) { return false; -@@ -351,6 +388,11 @@ public class CraftScheduler implements BukkitScheduler { +@@ -344,6 +381,11 @@ public class CraftScheduler implements BukkitScheduler { if (taskId <= 0) { return false; } @@ -278,7 +278,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 for (CraftTask task = this.head.getNext(); task != null; task = task.getNext()) { if (task.getTaskId() == taskId) { return task.getPeriod() >= CraftTask.NO_REPEATING; // The task will run -@@ -362,6 +404,12 @@ public class CraftScheduler implements BukkitScheduler { +@@ -355,6 +397,12 @@ public class CraftScheduler implements BukkitScheduler { @Override public List getActiveWorkers() { @@ -291,7 +291,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 final ArrayList workers = new ArrayList(); for (final CraftTask taskObj : this.runners.values()) { // Iterator will be a best-effort (may fail to grab very new values) if called from an async thread -@@ -399,6 +447,11 @@ public class CraftScheduler implements BukkitScheduler { +@@ -392,6 +440,11 @@ public class CraftScheduler implements BukkitScheduler { pending.add(task); } } @@ -303,7 +303,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 return pending; } -@@ -406,6 +459,11 @@ public class CraftScheduler implements BukkitScheduler { +@@ -399,6 +452,11 @@ public class CraftScheduler implements BukkitScheduler { * This method is designed to never block or wait for locks; an immediate execution of all current tasks. */ public void mainThreadHeartbeat(final int currentTick) { @@ -315,7 +315,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 this.currentTick = currentTick; final List temp = this.temp; this.parsePending(); -@@ -445,7 +503,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -434,7 +492,7 @@ public class CraftScheduler implements BukkitScheduler { this.parsePending(); } else { // this.debugTail = this.debugTail.setNext(new CraftAsyncDebugger(currentTick + CraftScheduler.RECENT_TICKS, task.getOwner(), task.getTaskClass())); // Paper @@ -324,7 +324,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 // We don't need to parse pending // (async tasks must live with race-conditions if they attempt to cancel between these few lines of code) } -@@ -464,7 +522,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -453,7 +511,7 @@ public class CraftScheduler implements BukkitScheduler { //this.debugHead = this.debugHead.getNextHead(currentTick); // Paper } @@ -333,7 +333,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 final AtomicReference tail = this.tail; CraftTask tailTask = tail.get(); while (!tail.compareAndSet(tailTask, task)) { -@@ -473,7 +531,13 @@ public class CraftScheduler implements BukkitScheduler { +@@ -462,7 +520,13 @@ public class CraftScheduler implements BukkitScheduler { tailTask.setNext(task); } @@ -348,7 +348,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 task.setNextRun(this.currentTick + delay); this.addTask(task); return task; -@@ -496,8 +560,8 @@ public class CraftScheduler implements BukkitScheduler { +@@ -485,8 +549,8 @@ public class CraftScheduler implements BukkitScheduler { return id; } @@ -359,7 +359,7 @@ index af3997e47aff9c43dc5019f1b0267effe1df5205..c6ce8ed5fa73ee6221332083b3376b30 CraftTask head = this.head; CraftTask task = head.getNext(); CraftTask lastTask = head; -@@ -516,7 +580,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -505,7 +569,7 @@ public class CraftScheduler implements BukkitScheduler { task.setNext(null); } this.head = lastTask; diff --git a/patches/server/0202-Add-entity-knockback-events.patch b/patches/server/0202-Add-entity-knockback-events.patch index 192bee4264..2fa28dc910 100644 --- a/patches/server/0202-Add-entity-knockback-events.patch +++ b/patches/server/0202-Add-entity-knockback-events.patch @@ -93,10 +93,10 @@ index cccc60602360f25f0aeddbd16dad2bb63a1728a8..bf1b8ee85551ff1989369268edf80127 } } diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 25fd665f3b02edfcc9fc7092b93296a7c6e43338..b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e 100644 +index 55aecada617bd84676928a7818f1511b2d85e7bf..f56d431207323a80b7f566ac6e30eebf232ee695 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1693,7 +1693,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1691,7 +1691,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab if (f1 > 0.0F && target instanceof LivingEntity) { LivingEntity entityliving = (LivingEntity) target; diff --git a/patches/server/0227-Add-Early-Warning-Feature-to-WatchDog.patch b/patches/server/0227-Add-Early-Warning-Feature-to-WatchDog.patch index 003c77c3b0..6165e2a51e 100644 --- a/patches/server/0227-Add-Early-Warning-Feature-to-WatchDog.patch +++ b/patches/server/0227-Add-Early-Warning-Feature-to-WatchDog.patch @@ -53,10 +53,10 @@ index 745970d9f07ed7ca98a653bfff1b861dc4aaa177..274d7d7f36ce2eb38d2f630ca48b6aa4 @Override diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index a31953bd4dd9408f83c2ee9816d051a4a842cf6d..df3eb02bc2b5b8fc20496823055c6adf4512b4f9 100644 +index b97ff4a9b69699577bf8cde0869b70353101ef46..85f3433860abd91a89961907940a807a8b190a46 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -229,7 +229,7 @@ public class SpigotConfig +@@ -225,7 +225,7 @@ public class SpigotConfig SpigotConfig.restartScript = SpigotConfig.getString( "settings.restart-script", SpigotConfig.restartScript ); SpigotConfig.restartMessage = SpigotConfig.transform( SpigotConfig.getString( "messages.restart", "Server is restarting" ) ); SpigotConfig.commands.put( "restart", new RestartCommand( "restart" ) ); diff --git a/patches/server/0243-Improve-death-events.patch b/patches/server/0243-Improve-death-events.patch index 2be94f88f3..ccf6f18a9d 100644 --- a/patches/server/0243-Improve-death-events.patch +++ b/patches/server/0243-Improve-death-events.patch @@ -229,10 +229,10 @@ index f7a77b31dc196823510f96bd3b2344058e20feac..279fa00fd9043e1995f22c79f47d0b41 public int getExpReward(@Nullable Entity entity) { // CraftBukkit Level world = this.level(); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1d8e1118a 100644 +index f56d431207323a80b7f566ac6e30eebf232ee695..c2b10c3dba9d4d08e48f8e8836142b85f16b14cb 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1121,6 +1121,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1119,6 +1119,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } @@ -245,7 +245,7 @@ index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1 @Override protected void dropCustomDeathLoot(ServerLevel world, DamageSource source, boolean causedByPlayer) { super.dropCustomDeathLoot(world, source, causedByPlayer); -@@ -1129,6 +1135,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1127,6 +1133,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab for (int j = 0; j < i; ++j) { EquipmentSlot enumitemslot = aenumitemslot[j]; @@ -253,7 +253,7 @@ index b7c216b79684a4dbb93899fd2d3bc5a9e1b04f2e..4b0e269f3580c1c6dac1e5f2dd3cdac1 ItemStack itemstack = this.getItemBySlot(enumitemslot); float f = this.getEquipmentDropChance(enumitemslot); -@@ -1153,7 +1160,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1151,7 +1158,13 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab } this.spawnAtLocation(itemstack); diff --git a/patches/server/0245-Mob-Pathfinding-API.patch b/patches/server/0245-Mob-Pathfinding-API.patch index 7cf9f7d7fa..427d08a157 100644 --- a/patches/server/0245-Mob-Pathfinding-API.patch +++ b/patches/server/0245-Mob-Pathfinding-API.patch @@ -12,7 +12,7 @@ public net.minecraft.world.level.pathfinder.Path nodes diff --git a/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java new file mode 100644 -index 0000000000000000000000000000000000000000..3dbe4cf29a7984a1976a60bdeeb3ede02316a3cb +index 0000000000000000000000000000000000000000..946cbc955683e81933e0f3c0db5f8cc4ec437a76 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/entity/PaperPathfinder.java @@ -0,0 +1,148 @@ @@ -40,7 +40,7 @@ index 0000000000000000000000000000000000000000..3dbe4cf29a7984a1976a60bdeeb3ede0 + + @Override + public Mob getEntity() { -+ return entity.getBukkitMob(); ++ return (Mob) entity.getBukkitEntity(); + } + + public void setHandle(net.minecraft.world.entity.Mob entity) { diff --git a/patches/server/0280-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch b/patches/server/0280-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch index 02a8030115..9eceb9ab5a 100644 --- a/patches/server/0280-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch +++ b/patches/server/0280-Call-WhitelistToggleEvent-when-whitelist-is-toggled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Call WhitelistToggleEvent when whitelist is toggled diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 9e8938627bfd1c45a2546e221f819e20c483a9e2..00c43d7b846e97e2cc2105c93be5ce918fafd775 100644 +index cdd1d8222ad1796abd0858b9ed0e2ddc9be83c93..2f1d075b8dbcf173c51f3e6396ccbc61b64f75df 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1126,6 +1126,7 @@ public abstract class PlayerList { +@@ -1127,6 +1127,7 @@ public abstract class PlayerList { } public void setUsingWhiteList(boolean whitelistEnabled) { diff --git a/patches/server/0315-Add-debug-for-sync-chunk-loads.patch b/patches/server/0315-Add-debug-for-sync-chunk-loads.patch index e995b41d89..bf5532d58e 100644 --- a/patches/server/0315-Add-debug-for-sync-chunk-loads.patch +++ b/patches/server/0315-Add-debug-for-sync-chunk-loads.patch @@ -14,10 +14,10 @@ chunks, however it must be enabled by setting the startup flag diff --git a/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java new file mode 100644 -index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c739f09089 +index 0000000000000000000000000000000000000000..605a4a83d0a098a9977da00c710e798396dc5256 --- /dev/null +++ b/src/main/java/com/destroystokyo/paper/io/SyncLoadFinder.java -@@ -0,0 +1,175 @@ +@@ -0,0 +1,177 @@ +package com.destroystokyo.paper.io; + +import com.google.gson.JsonArray; @@ -31,6 +31,7 @@ index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c7 +import java.util.List; +import java.util.Map; +import java.util.WeakHashMap; ++import net.minecraft.world.level.ChunkPos; +import net.minecraft.world.level.Level; + +public class SyncLoadFinder { @@ -69,7 +70,7 @@ index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c7 + + ++valueInMap.times; + -+ valueInMap.coordinateTimes.compute(io.papermc.paper.util.MCUtil.getCoordinateKey(chunkX, chunkZ), (Long keyInMap1, Integer valueInMap1) -> { ++ valueInMap.coordinateTimes.compute(ChunkPos.asLong(chunkX, chunkZ), (Long keyInMap1, Integer valueInMap1) -> { + return valueInMap1 == null ? Integer.valueOf(1) : Integer.valueOf(valueInMap1.intValue() + 1); + }); + @@ -122,7 +123,8 @@ index 0000000000000000000000000000000000000000..404a8fd128043527d23f22ee26f7c8c7 + for (Long2IntMap.Entry coordinate : pair.getSecond().coordinateTimes.long2IntEntrySet()) { + final long key = coordinate.getLongKey(); + final int times = coordinate.getIntValue(); -+ coordinates.add("(" + io.papermc.paper.util.MCUtil.getCoordinateX(key) + "," + io.papermc.paper.util.MCUtil.getCoordinateZ(key) + "): " + times); ++ final ChunkPos chunkPos = new ChunkPos(key); ++ coordinates.add("(" + chunkPos.x + "," + chunkPos.z + "): " + times); + } + + stacktrace.add("coordinates", coordinates); diff --git a/patches/server/0329-Add-Raw-Byte-ItemStack-Serialization.patch b/patches/server/0329-Add-Raw-Byte-ItemStack-Serialization.patch index 800948f497..32b8216be7 100644 --- a/patches/server/0329-Add-Raw-Byte-ItemStack-Serialization.patch +++ b/patches/server/0329-Add-Raw-Byte-ItemStack-Serialization.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add Raw Byte ItemStack Serialization Serializes using NBT which is safer for server data migrations than bukkits format. diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e85faddc157869824e30426a7ca2c577552aea9c..03a72e19e060cdb0dd8fcf52742da27dcfcd1356 100644 +index 7af1d4685dcf1e73c5972cb25ded219e713b1f0a..c1511a45a11df8a08f1d19d7fbd2a478e1a6f44f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -469,6 +469,53 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -452,6 +452,53 @@ public final class CraftMagicNumbers implements UnsafeValues { public com.destroystokyo.paper.util.VersionFetcher getVersionFetcher() { return new com.destroystokyo.paper.PaperVersionFetcher(); } diff --git a/patches/server/0343-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch b/patches/server/0343-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch index 8ac2ea013d..3e893aae8c 100644 --- a/patches/server/0343-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch +++ b/patches/server/0343-Don-t-crash-if-player-is-attempted-to-be-removed-fro.patch @@ -7,10 +7,10 @@ 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/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index 27065ffc5473c518acee3a3096b83fac61eb7860..cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2 100644 +index 3d46412b307f08968bb9b96c0649e0405813462e..56aa26bb8d0bfbd3c799163fa620259e6455c89b 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -272,8 +272,8 @@ public abstract class DistanceManager { +@@ -270,8 +270,8 @@ public abstract class DistanceManager { ObjectSet objectset = (ObjectSet) this.playersPerChunk.get(i); if (objectset == null) return; // CraftBukkit - SPIGOT-6208 diff --git a/patches/server/0366-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch b/patches/server/0366-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch index 4175cae3b0..f3c9792760 100644 --- a/patches/server/0366-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch +++ b/patches/server/0366-Fix-CraftScheduler-runTaskTimerAsynchronously-Plugin.patch @@ -7,10 +7,10 @@ Subject: [PATCH] Fix CraftScheduler#runTaskTimerAsynchronously(Plugin, diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index c6ce8ed5fa73ee6221332083b3376b30bfe61bd0..71a147df3bcbd5bb82934da3e6e14326746cf2e3 100644 +index 02835e4f0a0b262af27acff0939c981cae728db4..d7c2d8993a172e343669228cf24a58d8992a1c10 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -198,7 +198,7 @@ public class CraftScheduler implements BukkitScheduler { +@@ -197,7 +197,7 @@ public class CraftScheduler implements BukkitScheduler { @Override public void runTaskTimerAsynchronously(Plugin plugin, Consumer task, long delay, long period) throws IllegalArgumentException { diff --git a/patches/server/0405-PortalCreateEvent-needs-to-know-its-entity.patch b/patches/server/0405-PortalCreateEvent-needs-to-know-its-entity.patch index 97b795bec5..2a196acb45 100644 --- a/patches/server/0405-PortalCreateEvent-needs-to-know-its-entity.patch +++ b/patches/server/0405-PortalCreateEvent-needs-to-know-its-entity.patch @@ -60,7 +60,7 @@ index ceaa2a7048afc4955d3695af5291e83a79d83c5d..5dad1aa26a8908cba6a08398a4bad27f } diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index d02f7a547dbe8943f82c07103b1fff203e4533c2..335f43e49d31acecfec8b6da9be9afe88cd95ca9 100644 +index 34f03184f018d00be7c5884f29f98a9ebe461475..6fe078fdf619c4df664f1dce6a0f5d202c21b35e 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -154,6 +154,12 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -76,7 +76,7 @@ index d02f7a547dbe8943f82c07103b1fff203e4533c2..335f43e49d31acecfec8b6da9be9afe8 protected void onPlace(BlockState state, Level world, BlockPos pos, BlockState oldState, boolean notify) { org.spigotmc.AsyncCatcher.catchOp("block onPlace"); // Spigot } -@@ -1086,6 +1092,12 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1080,6 +1086,12 @@ public abstract class BlockBehaviour implements FeatureElement { this.getBlock().updateIndirectNeighbourShapes(this.asState(), world, pos, flags, maxUpdateDepth); } diff --git a/patches/server/0414-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch b/patches/server/0414-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch index 31a4396f92..57bf603a28 100644 --- a/patches/server/0414-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch +++ b/patches/server/0414-Expose-the-Entity-Counter-to-allow-plugins-to-use-va.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Expose the Entity Counter to allow plugins to use valid and diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 335962dfe50d8d691a2a1fc6224950641e2b5a2b..203aacc9e116c1335bde1cff4d59674bfa7a622a 100644 +index 08dd2b77df5162a3b4b6941663efaa1eb0e42746..f7cfce209dde71e61009f3678c667062475cf1d4 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -4509,4 +4509,10 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -21,10 +21,10 @@ index 335962dfe50d8d691a2a1fc6224950641e2b5a2b..203aacc9e116c1335bde1cff4d59674b + // Paper end - Expose entity id counter } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 03a72e19e060cdb0dd8fcf52742da27dcfcd1356..94ec28a4f9d12873dff6700a12fb66e29820d3d9 100644 +index c1511a45a11df8a08f1d19d7fbd2a478e1a6f44f..5e20397ea379ed0df274ab73e5f8500977e08322 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -516,6 +516,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -499,6 +499,11 @@ public final class CraftMagicNumbers implements UnsafeValues { Preconditions.checkArgument(dataVersion <= getDataVersion(), "Newer version! Server downgrades are not supported!"); return compound; } diff --git a/patches/server/0430-Fix-client-lag-on-advancement-loading.patch b/patches/server/0430-Fix-client-lag-on-advancement-loading.patch index ded2b5101b..5e91f4115d 100644 --- a/patches/server/0430-Fix-client-lag-on-advancement-loading.patch +++ b/patches/server/0430-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/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 94ec28a4f9d12873dff6700a12fb66e29820d3d9..7427a81a779b82f96d34a3de228c9d59ee77fea7 100644 +index 5e20397ea379ed0df274ab73e5f8500977e08322..cf666e427d95b5fd9ce4db44e1b22e5e61ba7983 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -333,7 +333,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -316,7 +316,13 @@ public final class CraftMagicNumbers implements UnsafeValues { Bukkit.getLogger().log(Level.SEVERE, "Error saving advancement " + key, ex); } diff --git a/patches/server/0485-Expand-EntityUnleashEvent.patch b/patches/server/0485-Expand-EntityUnleashEvent.patch index 84ddc32ec9..9d1492dda4 100644 --- a/patches/server/0485-Expand-EntityUnleashEvent.patch +++ b/patches/server/0485-Expand-EntityUnleashEvent.patch @@ -78,10 +78,10 @@ index 30d7dd9646ba9d6a9396dc140a61eb2cac07dfc6..674713a611e709542990f748027bdc5b default void closeRangeLeashBehaviour(Entity entity) {} diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 4b0e269f3580c1c6dac1e5f2dd3cdac1d8e1118a..3988782c51b9d517ec003185c7b64605249206e2 100644 +index c2b10c3dba9d4d08e48f8e8836142b85f16b14cb..37a8e426ca65587863bd22d2b7f32fae854c322e 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1619,8 +1619,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1617,8 +1617,11 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab boolean flag1 = super.startRiding(entity, force); if (flag1 && this.isLeashed()) { diff --git a/patches/server/0492-Add-getMainThreadExecutor-to-BukkitScheduler.patch b/patches/server/0492-Add-getMainThreadExecutor-to-BukkitScheduler.patch index 57d54a0434..6ae0c8d11b 100644 --- a/patches/server/0492-Add-getMainThreadExecutor-to-BukkitScheduler.patch +++ b/patches/server/0492-Add-getMainThreadExecutor-to-BukkitScheduler.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add getMainThreadExecutor to BukkitScheduler diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -index 71a147df3bcbd5bb82934da3e6e14326746cf2e3..e85b9bb3f9c225d289a4959921970b9963881199 100644 +index d7c2d8993a172e343669228cf24a58d8992a1c10..2f4d6b56301195f8d39ed50dffe842464065bfe1 100644 --- a/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java +++ b/src/main/java/org/bukkit/craftbukkit/scheduler/CraftScheduler.java -@@ -653,4 +653,15 @@ public class CraftScheduler implements BukkitScheduler { +@@ -642,4 +642,15 @@ public class CraftScheduler implements BukkitScheduler { public BukkitTask runTaskTimerAsynchronously(Plugin plugin, BukkitRunnable task, long delay, long period) throws IllegalArgumentException { throw new UnsupportedOperationException("Use BukkitRunnable#runTaskTimerAsynchronously(Plugin, long, long)"); } diff --git a/patches/server/0504-Expand-world-key-API.patch b/patches/server/0504-Expand-world-key-API.patch index 2413e56a97..1d3ab483bc 100644 --- a/patches/server/0504-Expand-world-key-API.patch +++ b/patches/server/0504-Expand-world-key-API.patch @@ -67,10 +67,10 @@ index a29f4992f7927d0f241962f972dd13ce77094d97..f83eb7fd5c9b368ba0bf9e07a568d69c // Check if a World already exists with the UID. if (this.getWorld(world.getUID()) != null) { diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 7427a81a779b82f96d34a3de228c9d59ee77fea7..7e538a5e742914aa496d76ffe5b450397367cf40 100644 +index cf666e427d95b5fd9ce4db44e1b22e5e61ba7983..a58fb15e6e7054ee99560790bab0757231337ed6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -527,6 +527,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -510,6 +510,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public int nextEntityId() { return net.minecraft.world.entity.Entity.nextEntityId(); } diff --git a/patches/server/0509-Expose-protocol-version.patch b/patches/server/0509-Expose-protocol-version.patch index 37634ea475..689a2cb377 100644 --- a/patches/server/0509-Expose-protocol-version.patch +++ b/patches/server/0509-Expose-protocol-version.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Expose protocol version diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 7e538a5e742914aa496d76ffe5b450397367cf40..86584a2308006a5b217841a97461707ce610d32f 100644 +index a58fb15e6e7054ee99560790bab0757231337ed6..3f2222bfed1b852cd68b509d16d18cda9ed30237 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -532,6 +532,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -515,6 +515,11 @@ public final class CraftMagicNumbers implements UnsafeValues { public String getMainLevelName() { return ((net.minecraft.server.dedicated.DedicatedServer) net.minecraft.server.MinecraftServer.getServer()).getProperties().levelName; } diff --git a/patches/server/0536-ItemStack-repair-check-API.patch b/patches/server/0536-ItemStack-repair-check-API.patch index 9621b72ce2..6fdea3b32b 100644 --- a/patches/server/0536-ItemStack-repair-check-API.patch +++ b/patches/server/0536-ItemStack-repair-check-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack repair check API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 86584a2308006a5b217841a97461707ce610d32f..86308d3633e02a85ea2727805990451af53033c8 100644 +index 3f2222bfed1b852cd68b509d16d18cda9ed30237..ee87e3d1233a9dc776d26ef535034a2c38eed958 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -537,6 +537,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -520,6 +520,14 @@ public final class CraftMagicNumbers implements UnsafeValues { public int getProtocolVersion() { return net.minecraft.SharedConstants.getCurrentVersion().getProtocolVersion(); } diff --git a/patches/server/0543-Improve-item-default-attribute-API.patch b/patches/server/0543-Improve-item-default-attribute-API.patch index 5a9d7ca280..22c2ed26df 100644 --- a/patches/server/0543-Improve-item-default-attribute-API.patch +++ b/patches/server/0543-Improve-item-default-attribute-API.patch @@ -65,10 +65,10 @@ index 66d773cadb74f9176e6cf68a565568034f52ec63..a1f2b9d40d374e8cdbaf916b25fa74b6 return defaultAttributes.build(); } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 86308d3633e02a85ea2727805990451af53033c8..53cb6d7c2a734e46322b746f00c2bd0f09488126 100644 +index ee87e3d1233a9dc776d26ef535034a2c38eed958..e7696331e51211a4e1de9b43e7e763047d805ca0 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -396,7 +396,11 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -379,7 +379,11 @@ public final class CraftMagicNumbers implements UnsafeValues { @Override public Multimap getDefaultAttributeModifiers(Material material, EquipmentSlot slot) { diff --git a/patches/server/0547-Add-PlayerKickEvent-causes.patch b/patches/server/0547-Add-PlayerKickEvent-causes.patch index d5a0964872..261ceab74d 100644 --- a/patches/server/0547-Add-PlayerKickEvent-causes.patch +++ b/patches/server/0547-Add-PlayerKickEvent-causes.patch @@ -428,7 +428,7 @@ index ada5016ee354e799a8241a0706ea04e236efd1eb..70b215dfbe53bd475192ca1d021032c8 } diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 7ef760cb1c88f557947e9b88409a2935666f86f0..0474b88416e0d016da38909196d32fe992b37d00 100644 +index 0cbd4e6bc9b3695fd2ff0b943a69b8fd393e0f36..46f46685081c3c164bd4ba306dfb1220a4e13e52 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -675,7 +675,7 @@ public abstract class PlayerList { @@ -440,7 +440,7 @@ index 7ef760cb1c88f557947e9b88409a2935666f86f0..0474b88416e0d016da38909196d32fe9 } // Instead of kicking then returning, we need to store the kick reason -@@ -1272,7 +1272,7 @@ public abstract class PlayerList { +@@ -1273,7 +1273,7 @@ public abstract class PlayerList { // Paper end // CraftBukkit start - disconnect safely for (ServerPlayer player : this.players) { @@ -480,7 +480,7 @@ index f472dea0bd4f834c0c8f0aa59ae7cdae082b14af..2fa51c3a70f43cd23b8f494fc643d66c } } diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java -index 6aa9a31b2bba086265c0e83c4ea9181540a0a5f6..8f78f4879dfc46d2214243b927e0cff0257b7692 100644 +index 3f603688b9ad895edc2bfc07093c42bc17a35b19..6bc3209b6039ed3d33131e1c6bc56a47916be3ee 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java @@ -635,7 +635,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { diff --git a/patches/server/0588-Get-entity-default-attributes.patch b/patches/server/0588-Get-entity-default-attributes.patch index 89cfa6b22f..cd73335b9e 100644 --- a/patches/server/0588-Get-entity-default-attributes.patch +++ b/patches/server/0588-Get-entity-default-attributes.patch @@ -81,10 +81,10 @@ index 0000000000000000000000000000000000000000..ec9ebd2d539333293c51b7edfa18f18b + } +} diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 53cb6d7c2a734e46322b746f00c2bd0f09488126..1e78b966da6a3fa9410ebe52ae94db9b87659c72 100644 +index e7696331e51211a4e1de9b43e7e763047d805ca0..64aa0228fb81e975755bf24d1a58306d5875f9c6 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -549,6 +549,18 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -532,6 +532,18 @@ public final class CraftMagicNumbers implements UnsafeValues { } return CraftMagicNumbers.getItem(itemToBeRepaired.getType()).isValidRepairItem(CraftItemStack.asNMSCopy(itemToBeRepaired), CraftItemStack.asNMSCopy(repairMaterial)); } diff --git a/patches/server/0597-Add-Raw-Byte-Entity-Serialization.patch b/patches/server/0597-Add-Raw-Byte-Entity-Serialization.patch index 8f31d07f88..fb7238e9f5 100644 --- a/patches/server/0597-Add-Raw-Byte-Entity-Serialization.patch +++ b/patches/server/0597-Add-Raw-Byte-Entity-Serialization.patch @@ -7,7 +7,7 @@ Subject: [PATCH] Add Raw Byte Entity Serialization public net.minecraft.world.entity.Entity setLevel(Lnet/minecraft/world/level/Level;)V diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 28c20c14fa36470a96fad88787fc01c77592d19f..13e1b47873f0a4a974bb0763679fee6e37932b5c 100644 +index 0ab29f96a50ae490117cf83053bc3803870f794b..67c0dd9677dae97104830b816e5e0ca24e7db946 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -2145,6 +2145,15 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -50,10 +50,10 @@ index 7310f53747e68b918f132ee0f0a142e36537902e..6f9286e65f7ac730b808ddf9b52c344f @Override public boolean isInvisible() { // Paper - moved up from LivingEntity diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 1e78b966da6a3fa9410ebe52ae94db9b87659c72..21461817aa27b5b7df8af186712a54b3c80ee576 100644 +index 64aa0228fb81e975755bf24d1a58306d5875f9c6..7b111a801703dc846be82fad7b225dc1de36c7fd 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -499,7 +499,33 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -482,7 +482,33 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } diff --git a/patches/server/0621-Don-t-log-debug-logging-being-disabled.patch b/patches/server/0621-Don-t-log-debug-logging-being-disabled.patch index 9fdce5f481..8e733b1cea 100644 --- a/patches/server/0621-Don-t-log-debug-logging-being-disabled.patch +++ b/patches/server/0621-Don-t-log-debug-logging-being-disabled.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Don't log debug logging being disabled diff --git a/src/main/java/org/spigotmc/SpigotConfig.java b/src/main/java/org/spigotmc/SpigotConfig.java -index df3eb02bc2b5b8fc20496823055c6adf4512b4f9..0507182aa6d47da9693363f6b0fadd40d06d66b4 100644 +index 85f3433860abd91a89961907940a807a8b190a46..4dbb109d0526afee99b9190fc256585121aac9b5 100644 --- a/src/main/java/org/spigotmc/SpigotConfig.java +++ b/src/main/java/org/spigotmc/SpigotConfig.java -@@ -385,7 +385,7 @@ public class SpigotConfig +@@ -381,7 +381,7 @@ public class SpigotConfig Bukkit.getLogger().info( "Debug logging is enabled" ); } else { diff --git a/patches/server/0644-Configurable-max-block-light-for-monster-spawning.patch b/patches/server/0644-Configurable-max-block-light-for-monster-spawning.patch index 421d176050..d0fb0003dc 100644 --- a/patches/server/0644-Configurable-max-block-light-for-monster-spawning.patch +++ b/patches/server/0644-Configurable-max-block-light-for-monster-spawning.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Configurable max block light for monster spawning diff --git a/src/main/java/net/minecraft/world/entity/monster/Monster.java b/src/main/java/net/minecraft/world/entity/monster/Monster.java -index 4701bf9ee203f2f15b0b68e84bbfa2c489b66631..759839e912c54598b257ad738481364940f88a18 100644 +index f73604d762efbac400d40f536ec1782fca584efa..e7bfce0534c7ef3a1480a1082ae8514caf78778b 100644 --- a/src/main/java/net/minecraft/world/entity/monster/Monster.java +++ b/src/main/java/net/minecraft/world/entity/monster/Monster.java -@@ -92,7 +92,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { +@@ -91,7 +91,7 @@ public abstract class Monster extends PathfinderMob implements Enemy { return false; } else { DimensionType dimensionType = world.dimensionType(); diff --git a/patches/server/0694-Use-username-instead-of-display-name-in-PlayerList-g.patch b/patches/server/0694-Use-username-instead-of-display-name-in-PlayerList-g.patch index 59639c77c4..d98876142b 100644 --- a/patches/server/0694-Use-username-instead-of-display-name-in-PlayerList-g.patch +++ b/patches/server/0694-Use-username-instead-of-display-name-in-PlayerList-g.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Use username instead of display name in diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index d21d9a66ab7197ea4fa324a9af64a1457d8e602b..d430e6c08bae0a630e71c11c9eae26bef85bde36 100644 +index 2916328a5b94783e68688756b5ad7685f180e27f..b0a1f6cf2cc96a2ddc8232f929c134501d99411e 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1388,7 +1388,7 @@ public abstract class PlayerList { +@@ -1389,7 +1389,7 @@ public abstract class PlayerList { // CraftBukkit start public ServerStatsCounter getPlayerStats(ServerPlayer entityhuman) { ServerStatsCounter serverstatisticmanager = entityhuman.getStats(); diff --git a/patches/server/0736-Add-NamespacedKey-biome-methods.patch b/patches/server/0736-Add-NamespacedKey-biome-methods.patch index 0a5e2f5d8a..9177992114 100644 --- a/patches/server/0736-Add-NamespacedKey-biome-methods.patch +++ b/patches/server/0736-Add-NamespacedKey-biome-methods.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Add NamespacedKey biome methods Co-authored-by: Thonk <30448663+ExcessiveAmountsOfZombies@users.noreply.github.com> diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 21461817aa27b5b7df8af186712a54b3c80ee576..2aa7aad2b4b7f2e7c81ccac28a1e6151055b0ba3 100644 +index 7b111a801703dc846be82fad7b225dc1de36c7fd..ba82266c6f3e9e8f325b799171e8346a32033126 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -589,6 +589,21 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -572,6 +572,21 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end diff --git a/patches/server/0782-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch b/patches/server/0782-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch index 3a64891f6a..d563036457 100644 --- a/patches/server/0782-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch +++ b/patches/server/0782-Improve-inlining-for-some-hot-BlockBehavior-and-Flui.patch @@ -6,10 +6,10 @@ Subject: [PATCH] Improve inlining for some hot BlockBehavior and FluidState diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 335f43e49d31acecfec8b6da9be9afe88cd95ca9..d261649aa1b7b351f325f9b752bb792f952f7b25 100644 +index 6fe078fdf619c4df664f1dce6a0f5d202c21b35e..9d6cc0b8dbc451dfff1ddd8e7be32d11434cdb69 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -912,15 +912,15 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -906,15 +906,15 @@ public abstract class BlockBehaviour implements FeatureElement { return this.shapeExceedsCube; // Paper - moved into shape cache init } @@ -28,7 +28,7 @@ index 335f43e49d31acecfec8b6da9be9afe88cd95ca9..d261649aa1b7b351f325f9b752bb792f return this.isAir; } -@@ -1004,7 +1004,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -998,7 +998,7 @@ public abstract class BlockBehaviour implements FeatureElement { } } @@ -37,7 +37,7 @@ index 335f43e49d31acecfec8b6da9be9afe88cd95ca9..d261649aa1b7b351f325f9b752bb792f return this.canOcclude; } -@@ -1220,11 +1220,11 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1214,11 +1214,11 @@ public abstract class BlockBehaviour implements FeatureElement { return this.getBlock().builtInRegistryHolder().is(key); } diff --git a/patches/server/0809-Fix-SpawnEggMeta-get-setSpawnedType.patch b/patches/server/0809-Fix-SpawnEggMeta-get-setSpawnedType.patch index f3afed07e4..254a94df3a 100644 --- a/patches/server/0809-Fix-SpawnEggMeta-get-setSpawnedType.patch +++ b/patches/server/0809-Fix-SpawnEggMeta-get-setSpawnedType.patch @@ -5,7 +5,7 @@ Subject: [PATCH] Fix SpawnEggMeta#get/setSpawnedType diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java -index ea9937ad27817112f71e8a0a816865961ce19a61..2c6ee95edea9dc959d8d31d689dc27fea4080467 100644 +index ea9937ad27817112f71e8a0a816865961ce19a61..6c2c3b514be0dab47f3e44f65bdc6a3574e59b7c 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftMetaSpawnEgg.java @@ -94,6 +94,30 @@ public class CraftMetaSpawnEgg extends CraftMetaItem implements SpawnEggMeta { @@ -17,8 +17,8 @@ index ea9937ad27817112f71e8a0a816865961ce19a61..2c6ee95edea9dc959d8d31d689dc27fe + public EntityType getCustomSpawnedType() { + return java.util.Optional.ofNullable(this.entityTag) + .map(tag -> tag.getString(ENTITY_ID.NBT)) -+ .flatMap(net.minecraft.world.entity.EntityType::byString) -+ .map(org.bukkit.craftbukkit.util.CraftMagicNumbers::getEntityType) ++ .map(net.minecraft.resources.ResourceLocation::tryParse) ++ .map(key -> key.getNamespace().equals("minecraft") ? EntityType.fromName(key.getPath()) : null) + .orElse(null); + } + diff --git a/patches/server/0851-API-for-updating-recipes-on-clients.patch b/patches/server/0851-API-for-updating-recipes-on-clients.patch index cf7dbe2f29..373578055d 100644 --- a/patches/server/0851-API-for-updating-recipes-on-clients.patch +++ b/patches/server/0851-API-for-updating-recipes-on-clients.patch @@ -5,10 +5,10 @@ Subject: [PATCH] API for updating recipes on clients diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index de96d7df65713f2fa7b8f2dd068856bb5fa45a45..be6bf7afa3cea4ed48f363e89ccd079062edc8d9 100644 +index f9dcbf7d51680e8dfdda1350e0632dec675f3d44..1b83d8f723410c405746faa59783e6ba7a66fd56 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java -@@ -1484,6 +1484,13 @@ public abstract class PlayerList { +@@ -1485,6 +1485,13 @@ public abstract class PlayerList { } public void reloadResources() { @@ -22,7 +22,7 @@ index de96d7df65713f2fa7b8f2dd068856bb5fa45a45..be6bf7afa3cea4ed48f363e89ccd0790 // CraftBukkit start /*Iterator iterator = this.advancements.values().iterator(); -@@ -1499,7 +1506,15 @@ public abstract class PlayerList { +@@ -1500,7 +1507,15 @@ public abstract class PlayerList { } // CraftBukkit end diff --git a/patches/server/0859-Fix-custom-statistic-criteria-creation.patch b/patches/server/0859-Fix-custom-statistic-criteria-creation.patch index 23faf0bb9f..7f72c6244e 100644 --- a/patches/server/0859-Fix-custom-statistic-criteria-creation.patch +++ b/patches/server/0859-Fix-custom-statistic-criteria-creation.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix custom statistic criteria creation diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 2aa7aad2b4b7f2e7c81ccac28a1e6151055b0ba3..e74f4a16d3e1e7cf716b93057c8b42e8ed0f3503 100644 +index ba82266c6f3e9e8f325b799171e8346a32033126..9b98070aa4998071b0821605f1f9bc1622716938 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -604,6 +604,14 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -587,6 +587,14 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - namespaced key biome methods diff --git a/patches/server/0887-Fix-silent-equipment-change-for-mobs.patch b/patches/server/0887-Fix-silent-equipment-change-for-mobs.patch index edc3ea39f0..f3cdc6b20c 100644 --- a/patches/server/0887-Fix-silent-equipment-change-for-mobs.patch +++ b/patches/server/0887-Fix-silent-equipment-change-for-mobs.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix silent equipment change for mobs diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 3988782c51b9d517ec003185c7b64605249206e2..56873752ae1ae0d2a36cb171d2de6884e15c01a5 100644 +index 37a8e426ca65587863bd22d2b7f32fae854c322e..1a2efd8b77d65606994f13980ddbe018f90d0c35 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -1104,19 +1104,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -1102,19 +1102,26 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @Override public void setItemSlot(EquipmentSlot slot, ItemStack stack) { diff --git a/patches/server/0897-Fix-UnsafeValues-loadAdvancement.patch b/patches/server/0897-Fix-UnsafeValues-loadAdvancement.patch index ff17036140..57202766df 100644 --- a/patches/server/0897-Fix-UnsafeValues-loadAdvancement.patch +++ b/patches/server/0897-Fix-UnsafeValues-loadAdvancement.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Fix UnsafeValues#loadAdvancement diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index e74f4a16d3e1e7cf716b93057c8b42e8ed0f3503..278ef7b7cd2cf95dcf38fb4cadfd2acfcc9c4dc5 100644 +index 9b98070aa4998071b0821605f1f9bc1622716938..c4d1cf7399a20c2067c51c81b5107a4841a35337 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -318,9 +318,30 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -301,9 +301,30 @@ public final class CraftMagicNumbers implements UnsafeValues { ResourceLocation minecraftkey = CraftNamespacedKey.toMinecraft(key); JsonElement jsonelement = ServerAdvancementManager.GSON.fromJson(advancement, JsonElement.class); diff --git a/patches/server/0924-Validate-ResourceLocation-in-NBT-reading.patch b/patches/server/0924-Validate-ResourceLocation-in-NBT-reading.patch index 5531d9ffc8..c8a97d12db 100644 --- a/patches/server/0924-Validate-ResourceLocation-in-NBT-reading.patch +++ b/patches/server/0924-Validate-ResourceLocation-in-NBT-reading.patch @@ -84,10 +84,10 @@ index ff16c7196b146388c526e3100e561be771ca8a91..cbf076c5fa69d32ad3c8ea759cd9d405 if (nbt.contains("Brain", 10)) { diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 56873752ae1ae0d2a36cb171d2de6884e15c01a5..5bac748649f43d74b13e7c0b4d355e67654ad59e 100644 +index 1a2efd8b77d65606994f13980ddbe018f90d0c35..8b6eed30f84dc98878deaa805e7446ae4b168400 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java -@@ -605,7 +605,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab +@@ -603,7 +603,7 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab this.leashData = this.readLeashData(nbt); this.setLeftHanded(nbt.getBoolean("LeftHanded")); if (nbt.contains("DeathLootTable", 8)) { diff --git a/patches/server/0925-Properly-handle-experience-dropping-on-block-break.patch b/patches/server/0925-Properly-handle-experience-dropping-on-block-break.patch index 63f20a9c63..21b63430dd 100644 --- a/patches/server/0925-Properly-handle-experience-dropping-on-block-break.patch +++ b/patches/server/0925-Properly-handle-experience-dropping-on-block-break.patch @@ -7,7 +7,7 @@ This causes spawnAfterBreak to spawn xp by default, removing the need to manuall For classes that use custom xp amounts, they can drop the resources with disabling diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 8337f2f1d650fc7efb830a7034e3676dc0695ee4..2f1acea765d1b6726863cdc89707ca6148548493 100644 +index 3f87e60c0d43703a8450b5920dac59a970809397..471fd54edf6aa962d997878ee638974f7f594fa8 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -617,7 +617,8 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -68,10 +68,10 @@ index c083dc8b2a69c3747b250d13f1a28ad22b5e6119..bf52c36f31992a01a7403d8c85151327 } diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index d261649aa1b7b351f325f9b752bb792f952f7b25..936b56c116de63b38a416d5bab4223a88d0469d0 100644 +index 9d6cc0b8dbc451dfff1ddd8e7be32d11434cdb69..87289d8ab94705999c67457a28538e7a5576acc3 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -@@ -1124,6 +1124,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -1118,6 +1118,7 @@ public abstract class BlockBehaviour implements FeatureElement { public void spawnAfterBreak(ServerLevel world, BlockPos pos, ItemStack tool, boolean dropExperience) { this.getBlock().spawnAfterBreak(this.asState(), world, pos, tool, dropExperience); diff --git a/patches/server/0931-Add-api-for-spawn-egg-texture-colors.patch b/patches/server/0931-Add-api-for-spawn-egg-texture-colors.patch index 0652b1399e..2789cead1a 100644 --- a/patches/server/0931-Add-api-for-spawn-egg-texture-colors.patch +++ b/patches/server/0931-Add-api-for-spawn-egg-texture-colors.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Add api for spawn egg texture colors diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index 278ef7b7cd2cf95dcf38fb4cadfd2acfcc9c4dc5..be009fe105a4fff86d592ebc8df75650aff74a29 100644 +index c4d1cf7399a20c2067c51c81b5107a4841a35337..f3bc116dc9838e88a2aa9f0dfe283dbfac5b27a9 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -648,6 +648,15 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -631,6 +631,15 @@ public final class CraftMagicNumbers implements UnsafeValues { return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT); } diff --git a/patches/server/0932-Add-Lifecycle-Event-system.patch b/patches/server/0932-Add-Lifecycle-Event-system.patch index 5dfc457965..91509f34e2 100644 --- a/patches/server/0932-Add-Lifecycle-Event-system.patch +++ b/patches/server/0932-Add-Lifecycle-Event-system.patch @@ -734,27 +734,11 @@ index 7ea2676397025bdbe20f88ec122bd6d545dcf959..61c19b1005dc387d671fd72331a8774c org.spigotmc.WatchdogThread.hasStarted = false; // Paper - Disable watchdog early timeout on reload this.reloadCount++; this.configuration = YamlConfiguration.loadConfiguration(this.getConfigFile()); -diff --git a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -index d96399e9bf1a58db5a4a22e58abb99e7660e0694..66bdac50130f523f9dc4379b103b7a469f9ca36b 100644 ---- a/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -+++ b/src/main/java/org/bukkit/craftbukkit/scheduler/MinecraftInternalPlugin.java -@@ -143,4 +143,11 @@ public class MinecraftInternalPlugin extends PluginBase { - public List onTabComplete(CommandSender sender, Command command, String alias, String[] args) { - throw new UnsupportedOperationException("Not supported."); - } -+ -+ // Paper start - lifecycle events -+ @Override -+ public @NotNull io.papermc.paper.plugin.lifecycle.event.LifecycleEventManager getLifecycleManager() { -+ throw new UnsupportedOperationException("Not supported."); -+ } -+ // Paper end - lifecycle events - } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index be009fe105a4fff86d592ebc8df75650aff74a29..d329da33f9bfea5e30e42cd30974b7d3b775f446 100644 +index f3bc116dc9838e88a2aa9f0dfe283dbfac5b27a9..054058180b938101926f6613715f4266618fed94 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -657,6 +657,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -640,6 +640,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - spawn egg color visibility diff --git a/patches/server/0933-ItemStack-Tooltip-API.patch b/patches/server/0933-ItemStack-Tooltip-API.patch index 16bb22ce78..7425f354d8 100644 --- a/patches/server/0933-ItemStack-Tooltip-API.patch +++ b/patches/server/0933-ItemStack-Tooltip-API.patch @@ -5,10 +5,10 @@ Subject: [PATCH] ItemStack Tooltip API diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index d329da33f9bfea5e30e42cd30974b7d3b775f446..fa60f4e05e3303a7fe4faab0098c1fb439a24354 100644 +index 054058180b938101926f6613715f4266618fed94..9fbe938e7c1efdc256aa5303651a7f14e972e559 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -633,6 +633,21 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -616,6 +616,21 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - fix custom stats criteria creation diff --git a/patches/server/0955-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch b/patches/server/0955-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch index 586f341b5f..3fdb9f8fe4 100644 --- a/patches/server/0955-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch +++ b/patches/server/0955-Protect-Bedrock-and-End-Portal-Frames-from-being-des.patch @@ -13,7 +13,7 @@ A config is provided if you rather let players use these exploits, and let them destroy the worlds End Portals and get on top of the nether easy. diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java -index 69914a048987c21ee2ed2c489aab269862fda8f2..bff83fe413c7baef4ba56a3270ea4463a58c792f 100644 +index 0add20466890db9d2af7c595806d5e767b7ee117..32651ed15e5961a8b27fc0dc8fb54ef05b6064fe 100644 --- a/src/main/java/net/minecraft/world/level/Explosion.java +++ b/src/main/java/net/minecraft/world/level/Explosion.java @@ -193,6 +193,7 @@ public class Explosion { @@ -25,7 +25,7 @@ index 69914a048987c21ee2ed2c489aab269862fda8f2..bff83fe413c7baef4ba56a3270ea4463 if (!this.level.isInWorldBounds(blockposition)) { diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 81bdb6e64e04641f741c2c3350236685b097ec7a..c6c9400fa155831ab11d0f059971d0123617e622 100644 +index b7bf7b3b91046c81467aeb483087e12b6d9191bf..a2877f3eb206ab9ccb93e3606f1c9b3401def5d6 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -447,6 +447,10 @@ public abstract class Level implements LevelAccessor, AutoCloseable { @@ -107,7 +107,7 @@ index e6bfbe2588e0c2a1be14e38d654e889d392ad4db..e0c62227b279a5fe0f3868fbf9ce8c78 world.playSound((Player) null, pos, SoundEvents.PISTON_CONTRACT, SoundSource.BLOCKS, 0.5F, world.random.nextFloat() * 0.15F + 0.6F); diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 936b56c116de63b38a416d5bab4223a88d0469d0..6c4a339be29bb9c07b741a1ca12de2217c8687ba 100644 +index 87289d8ab94705999c67457a28538e7a5576acc3..fe7dc02ea55c2bcd39d12bfd4d315f0b8c7014c3 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -173,7 +173,7 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -128,7 +128,7 @@ index 936b56c116de63b38a416d5bab4223a88d0469d0..6c4a339be29bb9c07b741a1ca12de221 } protected boolean canBeReplaced(BlockState state, Fluid fluid) { -@@ -888,6 +888,12 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -882,6 +882,12 @@ public abstract class BlockBehaviour implements FeatureElement { return this.legacySolid; } @@ -141,7 +141,7 @@ index 936b56c116de63b38a416d5bab4223a88d0469d0..6c4a339be29bb9c07b741a1ca12de221 public boolean isValidSpawn(BlockGetter world, BlockPos pos, EntityType type) { return this.getBlock().properties.isValidSpawn.test(this.asState(), world, pos, type); } -@@ -991,7 +997,7 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -985,7 +991,7 @@ public abstract class BlockBehaviour implements FeatureElement { } public PushReaction getPistonPushReaction() { diff --git a/patches/server/0988-Moonrise-optimisation-patches.patch b/patches/server/0988-Moonrise-optimisation-patches.patch index b2d30b1448..d247d377e2 100644 --- a/patches/server/0988-Moonrise-optimisation-patches.patch +++ b/patches/server/0988-Moonrise-optimisation-patches.patch @@ -22689,7 +22689,7 @@ index 0761d5bc5f2813bb4a9f664ac7a05b9744d0a778..7d2896918ff5fed37e5de5a22c37b0c7 } diff --git a/src/main/java/net/minecraft/server/level/ChunkHolder.java b/src/main/java/net/minecraft/server/level/ChunkHolder.java -index 2f253f33b866ff74e959c41d9501264cf226f45e..932de172f1fd4c1b31cf8958f3d2d412c9be0af9 100644 +index 9a009a688c02e990723917766c51e1c0e71e338d..4db96543e2072e47040bb25a9d97ea6a69c4a43d 100644 --- a/src/main/java/net/minecraft/server/level/ChunkHolder.java +++ b/src/main/java/net/minecraft/server/level/ChunkHolder.java @@ -32,46 +32,125 @@ import net.minecraft.world.level.lighting.LevelLightEngine; @@ -23167,25 +23167,6 @@ index 2f253f33b866ff74e959c41d9501264cf226f45e..932de172f1fd4c1b31cf8958f3d2d412 } @FunctionalInterface -@@ -471,15 +398,15 @@ public class ChunkHolder extends GenerationChunkHolder { - - // Paper start - public final boolean isEntityTickingReady() { -- return this.isEntityTickingReady; -+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system - } - - public final boolean isTickingReady() { -- return this.isTickingReady; -+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system - } - - public final boolean isFullChunkReady() { -- return this.isFullChunkReady; -+ throw new UnsupportedOperationException(); // Paper - rewrite chunk system - } - // Paper end - } diff --git a/src/main/java/net/minecraft/server/level/ChunkLevel.java b/src/main/java/net/minecraft/server/level/ChunkLevel.java index d9ad32acdf46a43a649334a3b736aeb7b3af21d1..fae17a075d7efaf24d916877dd5968eb9652bb66 100644 --- a/src/main/java/net/minecraft/server/level/ChunkLevel.java @@ -23204,7 +23185,7 @@ index d9ad32acdf46a43a649334a3b736aeb7b3af21d1..fae17a075d7efaf24d916877dd5968eb public static final int RADIUS_AROUND_FULL_CHUNK = FULL_CHUNK_STEP.accumulatedDependencies().getRadius(); public static final int MAX_LEVEL = 33 + RADIUS_AROUND_FULL_CHUNK; diff --git a/src/main/java/net/minecraft/server/level/ChunkMap.java b/src/main/java/net/minecraft/server/level/ChunkMap.java -index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0bec5f285e 100644 +index ee597f2393c88473a72da941169e0f99c13da6ea..f6c090513f9dcc75e04e8e5b347c27f8d4d713cc 100644 --- a/src/main/java/net/minecraft/server/level/ChunkMap.java +++ b/src/main/java/net/minecraft/server/level/ChunkMap.java @@ -122,10 +122,7 @@ public class ChunkMap extends ChunkStorage implements ChunkHolder.PlayerProvider @@ -24206,7 +24187,7 @@ index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0b + public class ChunkDistanceManager extends DistanceManager implements ca.spottedleaf.moonrise.patches.chunk_system.level.chunk.ChunkSystemDistanceManager { // Paper - public // Paper - rewrite chunk system protected ChunkDistanceManager(final Executor workerExecutor, final Executor mainThreadExecutor) { - super(workerExecutor, mainThreadExecutor, ChunkMap.this); // Paper + super(workerExecutor, mainThreadExecutor); } + // Paper start - rewrite chunk system @@ -24318,10 +24299,10 @@ index 7f287127faf1d3a6b4b0f77800964b327ca9123f..edb36dee707433d4f9419aef6ac6cc0b this.serverEntity = new ServerEntity(ChunkMap.this.level, entity, j, flag, this::broadcast, this.seenBy); // CraftBukkit this.entity = entity; diff --git a/src/main/java/net/minecraft/server/level/DistanceManager.java b/src/main/java/net/minecraft/server/level/DistanceManager.java -index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0baefaf9f19 100644 +index 56aa26bb8d0bfbd3c799163fa620259e6455c89b..2d2596f04f5addac38037a14a02c6e0622d0c485 100644 --- a/src/main/java/net/minecraft/server/level/DistanceManager.java +++ b/src/main/java/net/minecraft/server/level/DistanceManager.java -@@ -36,66 +36,60 @@ import net.minecraft.world.level.ChunkPos; +@@ -36,64 +36,58 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.chunk.LevelChunk; import org.slf4j.Logger; @@ -24349,39 +24330,8 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba private long ticketTickCounter; - public int simulationDistance = 10; + // Paper - rewrite chunk system - private final ChunkMap chunkMap; // Paper -+ // Paper start - rewrite chunk system -+ public ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager getChunkHolderManager() { -+ return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.moonrise$getChunkMap().level).moonrise$getChunkTaskScheduler().chunkHolderManager; -+ } -+ // Paper end - rewrite chunk system -+ // Paper start - chunk tick iteration optimisation -+ private final ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap spawnChunkTracker = new ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap<>(); -+ -+ @Override -+ public final void moonrise$addPlayer(final ServerPlayer player, final SectionPos pos) { -+ this.spawnChunkTracker.add(player, pos.x(), pos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE); -+ } -+ -+ @Override -+ public final void moonrise$removePlayer(final ServerPlayer player, final SectionPos pos) { -+ this.spawnChunkTracker.remove(player); -+ } -+ -+ @Override -+ public final void moonrise$updatePlayer(final ServerPlayer player, -+ final SectionPos oldPos, final SectionPos newPos, -+ final boolean oldIgnore, final boolean newIgnore) { -+ if (newIgnore) { -+ this.spawnChunkTracker.remove(player); -+ } else { -+ this.spawnChunkTracker.addOrUpdate(player, newPos.x(), newPos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE); -+ } -+ } -+ // Paper end - chunk tick iteration optimisation -+ - protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor, ChunkMap chunkMap) { + protected DistanceManager(Executor workerExecutor, Executor mainThreadExecutor) { Objects.requireNonNull(mainThreadExecutor); ProcessorHandle mailbox = ProcessorHandle.of("player ticket throttler", mainThreadExecutor::execute); ChunkTaskPriorityQueueSorter chunktaskqueuesorter = new ChunkTaskPriorityQueueSorter(ImmutableList.of(mailbox), workerExecutor, 4); @@ -24391,10 +24341,9 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba - this.ticketThrottlerReleaser = chunktaskqueuesorter.getReleaseProcessor(mailbox); - this.mainThreadExecutor = mainThreadExecutor; + // Paper - rewrite chunk system - this.chunkMap = chunkMap; // Paper } - protected void purgeStaleTickets() { +- protected void purgeStaleTickets() { - ++this.ticketTickCounter; - ObjectIterator>>> objectiterator = this.tickets.long2ObjectEntrySet().fastIterator(); - @@ -24405,27 +24354,54 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba - - while (iterator.hasNext()) { - Ticket ticket = (Ticket) iterator.next(); -- ++ // Paper start - rewrite chunk system ++ public ca.spottedleaf.moonrise.patches.chunk_system.scheduling.ChunkHolderManager getChunkHolderManager() { ++ return ((ca.spottedleaf.moonrise.patches.chunk_system.level.ChunkSystemServerLevel)this.moonrise$getChunkMap().level).moonrise$getChunkTaskScheduler().chunkHolderManager; ++ } ++ // Paper end - rewrite chunk system ++ // Paper start - chunk tick iteration optimisation ++ private final ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap spawnChunkTracker = new ca.spottedleaf.moonrise.common.misc.PositionCountingAreaMap<>(); + - if (ticket.timedOut(this.ticketTickCounter)) { - iterator.remove(); - flag = true; - this.tickingTicketsTracker.removeTicket(entry.getLongKey(), ticket); - } - } -- ++ @Override ++ public final void moonrise$addPlayer(final ServerPlayer player, final SectionPos pos) { ++ this.spawnChunkTracker.add(player, pos.x(), pos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE); ++ } + - if (flag) { - this.ticketTracker.update(entry.getLongKey(), DistanceManager.getTicketLevelAt((SortedArraySet) entry.getValue()), false); - } -- ++ @Override ++ public final void moonrise$removePlayer(final ServerPlayer player, final SectionPos pos) { ++ this.spawnChunkTracker.remove(player); ++ } + - if (((SortedArraySet) entry.getValue()).isEmpty()) { - objectiterator.remove(); - } -- } ++ @Override ++ public final void moonrise$updatePlayer(final ServerPlayer player, ++ final SectionPos oldPos, final SectionPos newPos, ++ final boolean oldIgnore, final boolean newIgnore) { ++ if (newIgnore) { ++ this.spawnChunkTracker.remove(player); ++ } else { ++ this.spawnChunkTracker.addOrUpdate(player, newPos.x(), newPos.z(), ca.spottedleaf.moonrise.patches.chunk_tick_iteration.ChunkTickConstants.PLAYER_SPAWN_TRACK_RANGE); + } ++ } ++ // Paper end - chunk tick iteration optimisation ++ ++ protected void purgeStaleTickets() { + this.getChunkHolderManager().tick(); // Paper - rewrite chunk system } -@@ -112,86 +106,15 @@ public abstract class DistanceManager { +@@ -110,86 +104,15 @@ public abstract class DistanceManager { protected abstract ChunkHolder updateChunkScheduling(long pos, int level, @Nullable ChunkHolder holder, int k); public boolean runAllUpdates(ChunkMap chunkLoadingManager) { @@ -24515,7 +24491,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba } public void addTicket(TicketType type, ChunkPos pos, int level, T argument) { -@@ -210,13 +133,7 @@ public abstract class DistanceManager { +@@ -208,13 +131,7 @@ public abstract class DistanceManager { } public boolean addRegionTicketAtDistance(TicketType tickettype, ChunkPos chunkcoordintpair, int i, T t0) { @@ -24530,7 +24506,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba } public void removeRegionTicket(TicketType type, ChunkPos pos, int radius, T argument) { -@@ -225,32 +142,21 @@ public abstract class DistanceManager { +@@ -223,32 +140,21 @@ public abstract class DistanceManager { } public boolean removeRegionTicketAtDistance(TicketType tickettype, ChunkPos chunkcoordintpair, int i, T t0) { @@ -24569,7 +24545,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba } -@@ -261,9 +167,8 @@ public abstract class DistanceManager { +@@ -259,9 +165,8 @@ public abstract class DistanceManager { ((ObjectSet) this.playersPerChunk.computeIfAbsent(i, (j) -> { return new ObjectOpenHashSet(); })).add(player); @@ -24581,7 +24557,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba } public void removePlayer(SectionPos pos, ServerPlayer player) { -@@ -275,151 +180,81 @@ public abstract class DistanceManager { +@@ -273,151 +178,81 @@ public abstract class DistanceManager { if (objectset != null) objectset.remove(player); // Paper - some state corruption happens here, don't crash, clean up gracefully if (objectset == null || objectset.isEmpty()) { // Paper this.playersPerChunk.remove(i); @@ -24756,7 +24732,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba private class ChunkTicketTracker extends ChunkTracker { private static final int MAX_LEVEL = ChunkLevel.MAX_LEVEL + 1; -@@ -465,7 +300,7 @@ public abstract class DistanceManager { +@@ -463,7 +298,7 @@ public abstract class DistanceManager { public int runDistanceUpdates(int distance) { return this.runUpdates(distance); } @@ -24765,7 +24741,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba private class FixedPlayerDistanceChunkTracker extends ChunkTracker { -@@ -545,6 +380,7 @@ public abstract class DistanceManager { +@@ -543,6 +378,7 @@ public abstract class DistanceManager { } } @@ -24773,7 +24749,7 @@ index cbabbfbb9967ddf9a56f3be24a88e0fcd4415aa2..6d0e396e148557e401939860cd7af0ba private class PlayerTicketTracker extends DistanceManager.FixedPlayerDistanceChunkTracker { private int viewDistance = 0; -@@ -639,5 +475,5 @@ public abstract class DistanceManager { +@@ -637,5 +473,5 @@ public abstract class DistanceManager { private boolean haveTicketFor(int distance) { return distance <= this.viewDistance; } @@ -28951,7 +28927,7 @@ index d775ab8b0d37797f29e650842191d40691fb7afc..a7108b2be0746aa1f0e574d8c6f5ffad public void animateTick(BlockState state, Level world, BlockPos pos, RandomSource random) {} diff --git a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java -index 6c4a339be29bb9c07b741a1ca12de2217c8687ba..0f289d8f9bda2fb2ca2cd2dfd667a975529b3e4c 100644 +index fe7dc02ea55c2bcd39d12bfd4d315f0b8c7014c3..ded6d148110fe3fbb6272ce44582a28472dd49a6 100644 --- a/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java +++ b/src/main/java/net/minecraft/world/level/block/state/BlockBehaviour.java @@ -762,7 +762,7 @@ public abstract class BlockBehaviour implements FeatureElement { @@ -29040,7 +29016,7 @@ index 6c4a339be29bb9c07b741a1ca12de2217c8687ba..0f289d8f9bda2fb2ca2cd2dfd667a975 protected BlockStateBase(Block block, Reference2ObjectArrayMap, Comparable> propertyMap, MapCodec codec) { super(block, propertyMap, codec); this.fluidState = Fluids.EMPTY.defaultFluidState(); -@@ -864,6 +934,43 @@ public abstract class BlockBehaviour implements FeatureElement { +@@ -858,6 +928,43 @@ public abstract class BlockBehaviour implements FeatureElement { this.shapeExceedsCube = this.cache == null || this.cache.largeCollisionShape; // Paper - moved from actual method to here this.legacySolid = this.calculateSolid(); diff --git a/patches/server/0989-Rewrite-dataconverter-system.patch b/patches/server/0989-Rewrite-dataconverter-system.patch index ea19e60350..fcdd549d37 100644 --- a/patches/server/0989-Rewrite-dataconverter-system.patch +++ b/patches/server/0989-Rewrite-dataconverter-system.patch @@ -29388,10 +29388,10 @@ index 1d287dd7379e56f7fd4b425880b850cd843f5789..8ab7ca373a885fbe658013c9c6a2e38d return nbttagcompound; }); diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index fa60f4e05e3303a7fe4faab0098c1fb439a24354..ca1c0955be0d0f78972f39c4bd4afffd46c2fb45 100644 +index 9fbe938e7c1efdc256aa5303651a7f14e972e559..ff60dc1eae8d3c13006b5f19e5bb64c8309fd3d3 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -516,7 +516,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -499,7 +499,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); final int dataVersion = compound.getInt("DataVersion"); @@ -29400,7 +29400,7 @@ index fa60f4e05e3303a7fe4faab0098c1fb439a24354..ca1c0955be0d0f78972f39c4bd4afffd return CraftItemStack.asCraftMirror(net.minecraft.world.item.ItemStack.parse(MinecraftServer.getServer().registryAccess(), compound).orElseThrow()); } -@@ -537,7 +537,7 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -520,7 +520,7 @@ public final class CraftMagicNumbers implements UnsafeValues { net.minecraft.nbt.CompoundTag compound = deserializeNbtFromBytes(data); int dataVersion = compound.getInt("DataVersion"); diff --git a/patches/server/0997-Entity-Activation-Range-2.0.patch b/patches/server/0997-Entity-Activation-Range-2.0.patch index 59596a9c67..4710fe8474 100644 --- a/patches/server/0997-Entity-Activation-Range-2.0.patch +++ b/patches/server/0997-Entity-Activation-Range-2.0.patch @@ -111,7 +111,7 @@ index 978208f74b6f1d3f859165e951d41013a5f00256..1196eb573317ad01b6df0ae2d38aa17a } else { passenger.stopRiding(); diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java -index 4f4b7e738fe604808d837a38d23bf437bc1d5329..abc217e9166bce12590f37aa0e21d6202596e786 100644 +index 9f07343401a03735234b0298b92663b5b94608a8..b3e0c8c63eda497fc868f5691b585d5092eb169d 100644 --- a/src/main/java/net/minecraft/world/entity/Entity.java +++ b/src/main/java/net/minecraft/world/entity/Entity.java @@ -419,6 +419,8 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess @@ -147,7 +147,7 @@ index 4f4b7e738fe604808d837a38d23bf437bc1d5329..abc217e9166bce12590f37aa0e21d620 movement = this.maybeBackOffFromEdge(movement, movementType); Vec3 vec3d1 = this.collide(movement); diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java -index 5bac748649f43d74b13e7c0b4d355e67654ad59e..7b93c6a04cca2ac31d137f06ef83bb08559b10bf 100644 +index 8b6eed30f84dc98878deaa805e7446ae4b168400..bd7c6ce15698aed70376c109ba36f52d6794a2f8 100644 --- a/src/main/java/net/minecraft/world/entity/Mob.java +++ b/src/main/java/net/minecraft/world/entity/Mob.java @@ -232,6 +232,19 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Leashab @@ -171,17 +171,18 @@ index 5bac748649f43d74b13e7c0b4d355e67654ad59e..7b93c6a04cca2ac31d137f06ef83bb08 Entity entity = this.getControlledVehicle(); diff --git a/src/main/java/net/minecraft/world/entity/PathfinderMob.java b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -index bd8d56aa5a3557e7a2aa1dd066b27c2054d1eef8..9c995085357eff3c3b6c9c23129c2be6ea51e371 100644 +index 812aecb88641c09fb5030d145620b95aff19c9cb..ec9e76c548393235dcc6658c29e72e07e5d3510b 100644 --- a/src/main/java/net/minecraft/world/entity/PathfinderMob.java +++ b/src/main/java/net/minecraft/world/entity/PathfinderMob.java -@@ -23,6 +23,7 @@ public abstract class PathfinderMob extends Mob { +@@ -22,6 +22,8 @@ public abstract class PathfinderMob extends Mob { + super(type, world); } - public org.bukkit.craftbukkit.entity.CraftCreature getBukkitCreature() { return (org.bukkit.craftbukkit.entity.CraftCreature) super.getBukkitEntity(); } // Paper -+ public BlockPos movingTarget = null; public BlockPos getMovingTarget() { return movingTarget; } // Paper - ++ public BlockPos movingTarget; public BlockPos getMovingTarget() { return movingTarget; } // Paper ++ public float getWalkTargetValue(BlockPos pos) { return this.getWalkTargetValue(pos, this.level()); + } diff --git a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java b/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java index 89b8a304fe9fae4b57640afbab04b6764ce9aab8..074ef807258139f818e30494126585262c2f33c0 100644 --- a/src/main/java/net/minecraft/world/entity/ai/goal/GoalSelector.java @@ -340,7 +341,7 @@ index 0b7f52021441d633c37543e8ae485e81c292b747..d7f8464bf3eed0e42a5fc7f14a5b243d + } diff --git a/src/main/java/net/minecraft/world/level/Level.java b/src/main/java/net/minecraft/world/level/Level.java -index 77b7c252d27f527d9b51e8419abe7af1d4b51d29..ecf2f478932c9ccc5a7ac47c8f17bd44217c703b 100644 +index 574175449af5b767f28e95ff8708ed37fedf4c7d..ce9350ed3c5c5fbbd9b2ade9ae2880e03305c787 100644 --- a/src/main/java/net/minecraft/world/level/Level.java +++ b/src/main/java/net/minecraft/world/level/Level.java @@ -157,6 +157,12 @@ public abstract class Level implements LevelAccessor, AutoCloseable, ca.spottedl diff --git a/patches/server/1021-Registry-Modification-API.patch b/patches/server/1021-Registry-Modification-API.patch index 9abcc139da..805a844462 100644 --- a/patches/server/1021-Registry-Modification-API.patch +++ b/patches/server/1021-Registry-Modification-API.patch @@ -9,7 +9,7 @@ public net.minecraft.resources.RegistryOps lookupProvider public net.minecraft.resources.RegistryOps$HolderLookupAdapter diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java -index a5a985369199dc4528c69c52fd6819e1419a7feb..d64b8eecaf4de2aa2780b6c21335516405bbd401 100644 +index ead718efde812846fefec3e86d896fef7deb3d97..722e3786f5b36f9b9ccff4028a58c3893c7960d6 100644 --- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java +++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java @@ -2,6 +2,7 @@ package io.papermc.paper.registry; @@ -1347,10 +1347,10 @@ index fc9aec589414bf8d3f672183928235b5b51d1a02..0f3c46b8bb93fc42160300c9988d04be + // Paper end - RegistrySet API } diff --git a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -index ca1c0955be0d0f78972f39c4bd4afffd46c2fb45..0984843ff443ba40406839d06f83304902ee4f43 100644 +index ff60dc1eae8d3c13006b5f19e5bb64c8309fd3d3..1627e141a68b5df65dbc1526d72fbe24edc2189f 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -679,6 +679,21 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -662,6 +662,21 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - lifecycle event API diff --git a/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch b/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch index a45cc672d3..62c428ea3e 100644 --- a/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch +++ b/patches/server/1024-Proxy-ItemStack-to-CraftItemStack.patch @@ -205,10 +205,10 @@ index 9c004e7cb46841d874ab997bf2e3b63ae763aec7..d7c8f26b21276d9ff1d5c7c9738cc112 + // 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 0984843ff443ba40406839d06f83304902ee4f43..3137391cadef7c67019561e65fedd0664e689eae 100644 +index 1627e141a68b5df65dbc1526d72fbe24edc2189f..28b3ad04e1f4b38ce21084864a59a2cd81b3992c 100644 --- a/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java +++ b/src/main/java/org/bukkit/craftbukkit/util/CraftMagicNumbers.java -@@ -694,6 +694,13 @@ public final class CraftMagicNumbers implements UnsafeValues { +@@ -677,6 +677,13 @@ public final class CraftMagicNumbers implements UnsafeValues { } // Paper end - hack to get tags for non server-backed registries diff --git a/patches/server/1039-Incremental-chunk-and-player-saving.patch b/patches/server/1039-Incremental-chunk-and-player-saving.patch index 63427bcc39..2c9c19531b 100644 --- a/patches/server/1039-Incremental-chunk-and-player-saving.patch +++ b/patches/server/1039-Incremental-chunk-and-player-saving.patch @@ -108,7 +108,7 @@ index dddd4fcdcd08e0221693071894818c7d3bae531b..5980b70e2d7273239245237189b2debc private static final int NEUTRAL_MOB_DEATH_NOTIFICATION_RADII_Y = 10; private static final int FLY_STAT_RECORDING_SPEED = 25; diff --git a/src/main/java/net/minecraft/server/players/PlayerList.java b/src/main/java/net/minecraft/server/players/PlayerList.java -index 5f20606cc2c79ad9a4c4d4d6c9e6a2a31a88b282..dfcaff15a145bf29e8a538d853bb04aec8c36179 100644 +index c38c688417f769a6022dd40d6652b00e14c4df94..43eeb8ce4bc350c2b524ade11ca25d8d4d21bea5 100644 --- a/src/main/java/net/minecraft/server/players/PlayerList.java +++ b/src/main/java/net/minecraft/server/players/PlayerList.java @@ -569,6 +569,7 @@ public abstract class PlayerList { @@ -119,7 +119,7 @@ index 5f20606cc2c79ad9a4c4d4d6c9e6a2a31a88b282..dfcaff15a145bf29e8a538d853bb04ae this.playerIo.save(player); ServerStatsCounter serverstatisticmanager = (ServerStatsCounter) player.getStats(); // CraftBukkit -@@ -1182,10 +1183,22 @@ public abstract class PlayerList { +@@ -1183,10 +1184,22 @@ public abstract class PlayerList { } public void saveAll() {