13
0
geforkt von Mirrors/Paper

fallback to default locate logic if no API found

Dieser Commit ist enthalten in:
Jake Potrebic 2022-06-08 13:42:54 -07:00
Ursprung 5a7519440e
Commit 130e8c090b

Datei anzeigen

@ -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 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)
+ if (!configuredStructures.isEmpty()) {
+ final io.papermc.paper.event.world.StructuresLocateEvent event = new io.papermc.paper.event.world.StructuresLocateEvent(bukkitWorld, origin, configuredStructures, radius, skipReferencedStructures);
+ if (!event.callEvent()) {
+ return null;
@ -96,6 +97,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ radius = event.getRadius();
+ skipReferencedStructures = event.shouldFindUnexplored();
+ structures = HolderSet.direct(paperRegistry::getMinecraftHolder, event.getConfiguredStructures());
+ }
+ // Paper end
Map<StructurePlacement, Set<Holder<Structure>>> map = new Object2ObjectArrayMap();
Iterator iterator = structures.iterator();