mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-01 04:31:58 +01:00
bc127ea819
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: eec4aab0 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent 205213c6 SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron CraftBukkit Changes: b8c522d5 SPIGOT-6657: Add getPlayer to SheepDyeWoolEvent f04a77dc SPIGOT-6656: CauldronLevelChangeEvent is not fired correctly when dripstone fills the cauldron d1dbcebc SPIGOT-6653: Canceling snow bucket placement removes snow from bucket 4f34a67b #891: Fix scheduler task ID overflow and duplication issues Spigot Changes: d03d7f12 BUILDTOOLS-604: Rebuild patches
41 lines
2.5 KiB
Diff
41 lines
2.5 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: dfsek <dfsek@protonmail.com>
|
|
Date: Wed, 16 Sep 2020 01:12:29 -0700
|
|
Subject: [PATCH] Add StructureLocateEvent
|
|
|
|
|
|
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 57ee9023c265504e07647cd9dd8997600c84594f..4a40fa5f7c71481ef0b275955bbd81a737889781 100644
|
|
--- a/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
|
+++ b/src/main/java/net/minecraft/world/level/chunk/ChunkGenerator.java
|
|
@@ -2,6 +2,7 @@ package net.minecraft.world.level.chunk;
|
|
|
|
import com.google.common.collect.Lists;
|
|
import com.mojang.serialization.Codec;
|
|
+import io.papermc.paper.event.world.StructureLocateEvent; // Paper - Add import due to naming conflict.
|
|
import java.util.BitSet;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
@@ -185,6 +186,22 @@ public abstract class ChunkGenerator {
|
|
|
|
@Nullable
|
|
public BlockPos findNearestMapFeature(ServerLevel world, StructureFeature<?> feature, BlockPos center, int radius, boolean skipExistingChunks) {
|
|
+ // Paper start
|
|
+ org.bukkit.World world1 = world.getWorld();
|
|
+ org.bukkit.Location originLocation = new org.bukkit.Location(world1, center.getX(), center.getY(), center.getZ());
|
|
+ StructureLocateEvent event = new StructureLocateEvent(world1, originLocation, org.bukkit.StructureType.getStructureTypes().get(feature.getFeatureName()), radius, skipExistingChunks);
|
|
+ if(!event.callEvent()) return null;
|
|
+ // If event call set a final location, skip structure finding and just return set result.
|
|
+ if(event.getResult() != null) return new BlockPos(event.getResult().getBlockX(), event.getResult().getBlockY(), event.getResult().getBlockZ());
|
|
+ // Get origin location (re)defined by event call.
|
|
+ center = new BlockPos(event.getOrigin().getBlockX(), event.getOrigin().getBlockY(), event.getOrigin().getBlockZ());
|
|
+ // Get world (re)defined by event call.
|
|
+ world = ((org.bukkit.craftbukkit.CraftWorld) event.getOrigin().getWorld()).getHandle();
|
|
+ // Get radius and whether to find unexplored structures (re)defined by event call.
|
|
+ radius = event.getRadius();
|
|
+ skipExistingChunks = event.shouldFindUnexplored();
|
|
+ feature = StructureFeature.STRUCTURES_REGISTRY.get(event.getType().getName());
|
|
+ // Paper end
|
|
if (!this.biomeSource.canGenerateStructure(feature)) {
|
|
return null;
|
|
} else if (feature == StructureFeature.STRONGHOLD) {
|