Files
Purpur/patches/server/0139-Add-StructureGenerateEvent.patch
2021-11-30 08:14:03 -05:00

40 lines
2.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Nahuel <nahueldolores@hotmail.com>
Date: Sat, 9 Jan 2021 15:36:59 +0100
Subject: [PATCH] Add StructureGenerateEvent
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.
Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com>
diff --git a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
index e4591c0b3c8547cc6f4e2a0891fc378ee4334d9e..11b0697f668f6c0965a74081c149585fdf49b209 100644
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
@@ -458,6 +458,14 @@ public abstract class ChunkGenerator implements BiomeManager.NoiseBiomeSource {
if (structurestart == null || !structurestart.isValid()) {
StructureStart<?> structurestart1 = StructureFeatures.STRONGHOLD.generate(registryManager, this, this.biomeSource, structureManager, worldSeed, chunkcoordintpair, ChunkGenerator.fetchReferences(structureAccessor, chunk, sectionposition, StructureFeature.STRONGHOLD), structuresettingsfeature, chunk, ChunkGenerator::validStrongholdBiome);
+ // Purpur start
+ if (new org.purpurmc.purpur.event.world.StructureGenerateEvent(
+ structureAccessor.getWorld().getWorld(),
+ org.bukkit.StructureType.getStructureTypes().get(structurestart1.getFeature().getFeatureName().toLowerCase()),
+ chunkcoordintpair.x,
+ chunkcoordintpair.z
+ ).callEvent())
+ // Purpur end
structureAccessor.setStartForFeature(sectionposition, StructureFeature.STRONGHOLD, structurestart1, chunk);
}
}