geforkt von Mirrors/Paper
SPIGOT-7261: Add AsyncStructureSpawnEvent
By: Lauriichan <laura.endress@syntaxphoenix.com>
Dieser Commit ist enthalten in:
Ursprung
ed2f6b4efc
Commit
c8aa873369
@ -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) {
|
private static StructureBoundingBox getWritableArea(IChunkAccess ichunkaccess) {
|
||||||
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
ChunkCoordIntPair chunkcoordintpair = ichunkaccess.getPos();
|
||||||
int i = chunkcoordintpair.getMinBlockX();
|
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 {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren