mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-21 07:59:26 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@13c80a5e [ci/skip] Fix PlayerShearBlockEvent javadoc typos (#12101) PaperMC/Paper@db2aa180 [ci/skip] Fix incomplete example in javadocs for PreFlattenTagRegistrar (#12102) PaperMC/Paper@cf7c6c74 [ci/skip] Fix incomplete example in javadocs for PostFlattenTagRegistrar (#12103) PaperMC/Paper@072a8317 Add proper attached blocks API to AbstractArrow (#12099) PaperMC/Paper@1be2e5f3 Fix vanilla map decorations sending when not dirty (#12098) PaperMC/Paper@a06179a0 Update entity effect (#12104) PaperMC/Paper@e616498e Add Vault block API (#12068) PaperMC/Paper@0a04c3fe Fix some NPEs (#12105) PaperMC/Paper@06804850 Expand TrialSpawner API (#12025) PaperMC/Paper@46f4fdaa Add support for rotation argument handling (#12090) PaperMC/Paper@6cfa2f7f [ci/skip] Add missing nullability annotation to sendEquipmentChange method (#12112) PaperMC/Paper@9b9de827 Update Alternate Current patch to v1.9.1 (#12115) PaperMC/Paper@c62252e1 Add lore content guard (#12116) PaperMC/Paper@40416784 [ci/skip] Mention missing World#regenerateChunk implementation in jd (#12109) PaperMC/Paper@a6e82d90 [ci/skip] Clarify getChunkAtAsyncUrgently javadocs (#12125) PaperMC/Paper@cb25c0cf [ci/skip] Fix annotation fields used in NMS getBukkitEntity (#12120) PaperMC/Paper@00701267 [ci/skip] improvement example in javadoc for DatapackRegistrar (#12122) PaperMC/Paper@608f004a add method on ItemStack to edit pdc (#12022) PaperMC/Paper@7bee9971 Cleanup damage source a bit (#12106) PaperMC/Paper@b9023b5d Add EntityAttemptSmashAttackEvent (#12113) PaperMC/Paper@a3781ff3 Separate tick count to ensure vanilla parity (#12077) PaperMC/Paper@2a4a1154 Add EntityEquipmentChangedEvent (#12011) PaperMC/Paper@06f96dd6 Improvement in /plugins command (#12121) PaperMC/Paper@28d07dc5 use correct spigot plugin count PaperMC/Paper@60394c5b Fix PlayerReadyArrowEvent cancellation desync (#12111) PaperMC/Paper@b27e11cc Fix bad world to chunk coordinate example in javadocs (#12131) PaperMC/Paper@88cdd220 Fixup luck and random implementation in CB loot-tables (#11926) PaperMC/Paper@84609dc0 Don't auto-create any brig redirects (#11954) PaperMC/Paper@8eb8e44a Allow For Default Titles in InventoryView Builders (#12013) Gale Changes: Dreeam-qwq/Gale@a224af13 Updated Upstream (Paper) Dreeam-qwq/Gale@82f1e30e Updated Upstream (Paper) Dreeam-qwq/Gale@a41cd227 Updated Upstream (Paper) Dreeam-qwq/Gale@73519d55 Updated Upstream (Paper) Purpur Changes: PurpurMC/Purpur@9b046f36 Updated Upstream (Paper) PurpurMC/Purpur@22bd4186 Updated Upstream (Paper)
76 lines
4.2 KiB
Diff
76 lines
4.2 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com>
|
|
Date: Mon, 1 Nov 2077 00:00:00 +0800
|
|
Subject: [PATCH] Async structure locate api
|
|
|
|
This patch depends on Asynchronous locator patch.
|
|
|
|
Added some asynchronous structure locate methods in World,
|
|
requires async-locator to be enabled in Leaf config, or else it will fall back to sync methods.
|
|
|
|
diff --git a/src/main/java/org/bukkit/World.java b/src/main/java/org/bukkit/World.java
|
|
index 886b0eac9f3047c54cc788f05507893e31f7ad6d..f354527ada36431e95595ef60557e6b13360f75a 100644
|
|
--- a/src/main/java/org/bukkit/World.java
|
|
+++ b/src/main/java/org/bukkit/World.java
|
|
@@ -4072,6 +4072,60 @@ public interface World extends RegionAccessor, WorldInfo, PluginMessageRecipient
|
|
@Nullable
|
|
StructureSearchResult locateNearestStructure(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored);
|
|
|
|
+ // Leaf start - Async structure locate api
|
|
+ /**
|
|
+ * Find the closest nearby structure of a given {@link StructureType} asynchronously.
|
|
+ * <p>
|
|
+ * The {@code radius} is not a rigid square radius. Each structure may alter
|
|
+ * how many chunks to check for each iteration. Do not assume that only a
|
|
+ * radius x radius chunk area will be checked. For example,
|
|
+ * {@link StructureType#WOODLAND_MANSION} can potentially check up to 20,000
|
|
+ * blocks away (or more) regardless of the radius used.
|
|
+ * <p>
|
|
+ * This will <i>not</i> load or generate chunks.
|
|
+ * <p>
|
|
+ * The difference between searching for a {@link StructureType} and a
|
|
+ * {@link Structure} is, that a {@link StructureType} can refer to multiple
|
|
+ * {@link Structure Structures} while searching for a {@link Structure}
|
|
+ * while only search for the given {@link Structure}.
|
|
+ *
|
|
+ * @param origin where to start looking for a structure
|
|
+ * @param structureType the type of structure to find
|
|
+ * @param radius the radius, in chunks, around which to search
|
|
+ * @param findUnexplored true to only find unexplored structures
|
|
+ * @param afterComplete the action to perform once the search is complete.
|
|
+ * @see #locateNearestStructureAsync(Location, Structure, int, boolean, Consumer)
|
|
+ */
|
|
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
|
+ void locateNearestStructureAsync(@NotNull Location origin, @NotNull StructureType structureType, int radius, boolean findUnexplored, @NotNull Consumer<@Nullable StructureSearchResult> afterComplete);
|
|
+
|
|
+ /**
|
|
+ * Find the closest nearby structure of a given {@link Structure} asynchronously.
|
|
+ * <p>
|
|
+ * The {@code radius} is not a rigid square radius. Each structure may alter
|
|
+ * how many chunks to check for each iteration. Do not assume that only a
|
|
+ * radius x radius chunk area will be checked. For example,
|
|
+ * {@link Structure#MANSION} can potentially check up to 20,000 blocks away
|
|
+ * (or more) regardless of the radius used.
|
|
+ * <p>
|
|
+ * This will <i>not</i> load or generate chunks.
|
|
+ * <p>
|
|
+ * The difference between searching for a {@link StructureType} and a
|
|
+ * {@link Structure} is, that a {@link StructureType} can refer to multiple
|
|
+ * {@link Structure Structures} while searching for a {@link Structure}
|
|
+ * while only search for the given {@link Structure}.
|
|
+ *
|
|
+ * @param origin where to start looking for a structure
|
|
+ * @param structure the structure to find
|
|
+ * @param radius the radius, in chunks, around which to search
|
|
+ * @param findUnexplored true to only find unexplored structures
|
|
+ * @param afterComplete the action to perform on server thread once the search is complete.
|
|
+ * @see #locateNearestStructureAsync(Location, StructureType, int, boolean, Consumer)
|
|
+ */
|
|
+ @org.jetbrains.annotations.ApiStatus.Experimental
|
|
+ void locateNearestStructureAsync(@NotNull Location origin, @NotNull Structure structure, int radius, boolean findUnexplored, @NotNull Consumer<@Nullable StructureSearchResult> afterComplete);
|
|
+ // Leaf end - Async structure locate api
|
|
+
|
|
// Paper start
|
|
/**
|
|
* Locates the nearest biome based on an origin, biome type, and radius to search.
|