mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-20 15:39:37 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@9f004614 Update a whole lot of deprecated annotations PaperMC/Paper@72f13f8b [ci/skip] Mention API Checks for CONTRIBUTING.md (#12315) PaperMC/Paper@7cc6cb50 Check for trailing input in ItemFactory#createItemStack (#12312) PaperMC/Paper@f49d18df Add get/set customName to Skull block (#12302) PaperMC/Paper@894631f0 Make advancement ordering predictable (#12292) PaperMC/Paper@2aad131e Add config option for command spam whitelist PaperMC/Paper@bb3b7e69 Fix annotation mistakes PaperMC/Paper@058455e4 InventoryView QOL open method (#12282) PaperMC/Paper@f2258582 Fix firework entity not being removed when FireworkExplodeEvent is cancelled (#12268) PaperMC/Paper@7819df10 Add getHeight method to ChunkData (#12311) PaperMC/Paper@37b9ca1f Add flush parameter to World#save (#12330) PaperMC/Paper@515e12ca Check if BUNDLE_CONTENTS is present in InventoryClickEvent (#12321) PaperMC/Paper@5a6ab97b Add config to remove player as vehicle restriction in /ride (#12327) PaperMC/Paper@c467df95 Add ItemStack#copyDataFrom (#12224) Gale Changes: Dreeam-qwq/Gale@d5143ee0 Updated Upstream (Paper) Dreeam-qwq/Gale@63c396e7 Updated Upstream (Paper) Dreeam-qwq/Gale@5c2147b4 Updated Upstream (Paper) Dreeam-qwq/Gale@804ecea0 Rebuild patches
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 bc95f529bc7e443a9ec4e8a4a255a32a6c27f355..64ea97cce246d5eab8f45de64bbf92245c3f9330 100644
|
|
--- a/src/main/java/org/bukkit/World.java
|
|
+++ b/src/main/java/org/bukkit/World.java
|
|
@@ -4077,6 +4077,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.
|