mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-07 16:12:02 +01:00
fallback to default locate logic if no API found
This commit is contained in:
parent
5a7519440e
commit
130e8c090b
@ -85,6 +85,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ final var paperRegistry = io.papermc.paper.registry.PaperRegistry.getRegistry(io.papermc.paper.registry.RegistryKey.CONFIGURED_STRUCTURE_REGISTRY);
|
+ final var paperRegistry = io.papermc.paper.registry.PaperRegistry.getRegistry(io.papermc.paper.registry.RegistryKey.CONFIGURED_STRUCTURE_REGISTRY);
|
||||||
+ final List<io.papermc.paper.world.structure.ConfiguredStructure> configuredStructures = new ArrayList<>();
|
+ final List<io.papermc.paper.world.structure.ConfiguredStructure> configuredStructures = new ArrayList<>();
|
||||||
+ paperRegistry.convertToApi(structures, configuredStructures::add, false); // gracefully handle missing api, use tests to check (or exclude)
|
+ paperRegistry.convertToApi(structures, configuredStructures::add, false); // gracefully handle missing api, use tests to check (or exclude)
|
||||||
|
+ if (!configuredStructures.isEmpty()) {
|
||||||
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, configuredStructures, radius, skipReferencedStructures);
|
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, configuredStructures, radius, skipReferencedStructures);
|
||||||
+ if (!event.callEvent()) {
|
+ if (!event.callEvent()) {
|
||||||
+ return null;
|
+ return null;
|
||||||
@ -96,6 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||||||
+ radius = event.getRadius();
|
+ radius = event.getRadius();
|
||||||
+ skipReferencedStructures = event.shouldFindUnexplored();
|
+ skipReferencedStructures = event.shouldFindUnexplored();
|
||||||
+ structures = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures());
|
+ structures = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures());
|
||||||
|
+ }
|
||||||
+ // Paper end
|
+ // Paper end
|
||||||
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
|
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
|
||||||
Iterator iterator = structures.iterator();
|
Iterator iterator = structures.iterator();
|
||||||
|
Loading…
Reference in New Issue
Block a user