mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-05 18:27:17 +01:00
SPIGOT-7261: Add AsyncStructureSpawnEvent
By: Lauriichan <laura.endress@syntaxphoenix.com>
This commit is contained in:
parent
ed2f6b4efc
commit
c8aa873369
2 changed files with 26 additions and 0 deletions
|
@ -0,0 +1,11 @@
|
|||
--- a/net/minecraft/world/level/StructureManager.java
|
||||
+++ b/net/minecraft/world/level/StructureManager.java
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
public class StructureManager {
|
||||
|
||||
- private final GeneratorAccess level;
|
||||
+ public final GeneratorAccess level; // PAIL private -> public
|
||||
private final WorldOptions worldOptions;
|
||||
private final StructureCheck structureCheck;
|
||||
|
|
@ -61,3 +61,18 @@
|
|||
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
|
||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||
int i = chunkcoordintpair.getMinBlockX();
|
||||
@@ -576,6 +603,14 @@
|
||||
StructureStart structurestart = structure.generate(iregistrycustom, this, this.biomeSource, randomstate, structuretemplatemanager, i, chunkcoordintpair, j, ichunkaccess, predicate);
|
||||
|
||||
if (structurestart.isValid()) {
|
||||
+ // CraftBukkit start
|
||||
+ StructureBoundingBox box = structurestart.getBoundingBox();
|
||||
+ org.bukkit.event.world.AsyncStructureSpawnEvent event = new org.bukkit.event.world.AsyncStructureSpawnEvent(structuremanager.level.getMinecraftWorld().getWorld(), org.bukkit.craftbukkit.generator.strucutre.CraftStructure.minecraftToBukkit(structure, iregistrycustom), new org.bukkit.util.BoundingBox(box.minX(), box.minY(), box.minZ(), box.maxX(), box.maxY(), box.maxZ()), chunkcoordintpair.x, chunkcoordintpair.z);
|
||||
+ org.bukkit.Bukkit.getPluginManager().callEvent(event);
|
||||
+ if (event.isCancelled()) {
|
||||
+ return true;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
structuremanager.setStartForStructure(sectionposition, structure, structurestart, ichunkaccess);
|
||||
return true;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue