Do not create raids in positions not owned

If a player moves away before the raid is created, then we would
possibly trigger the raid cross-region.

Considering Vanilla doesn't trigger the raid cross-dimension, this
doesn't seem like an important behavior to break.

Fixes https://github.com/PaperMC/Folia/issues/264
This commit is contained in:
Spottedleaf 2024-08-30 20:02:54 -07:00
parent 99ba4bd7be
commit 88e0907cad

View File

@ -16269,7 +16269,7 @@ index bbf21ea433f9e3963aac0ede597ed8d3c8e50ed8..bcf7a7d8137b62cd65ac3c6ff517025f
if (raid1 != null && Raids.canJoinRaid(this, raid1)) {
diff --git a/src/main/java/net/minecraft/world/entity/raid/Raids.java b/src/main/java/net/minecraft/world/entity/raid/Raids.java
index 8c60f71270d909c10e6617eb64b8fdb42deb73e9..f4f9670e7aa81e3f60b34f0bc7313784573c74b8 100644
index 8c60f71270d909c10e6617eb64b8fdb42deb73e9..98b9f1c93824aa879395cd53057fdb4d3b8ae5d4 100644
--- a/src/main/java/net/minecraft/world/entity/raid/Raids.java
+++ b/src/main/java/net/minecraft/world/entity/raid/Raids.java
@@ -26,9 +26,9 @@ import net.minecraft.world.phys.Vec3;
@ -16347,7 +16347,7 @@ index 8c60f71270d909c10e6617eb64b8fdb42deb73e9..f4f9670e7aa81e3f60b34f0bc7313784
DimensionType dimensionmanager = player.level().dimensionType();
- if (!dimensionmanager.hasRaids()) {
+ if (!dimensionmanager.hasRaids() || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, player.chunkPosition().x, player.chunkPosition().z, 8)) { // Folia - region threading
+ if (!dimensionmanager.hasRaids() || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(player) || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, pos.getX() >> 4, pos.getZ() >> 4, 8) || !ca.spottedleaf.moonrise.common.util.TickThread.isTickThreadFor(this.level, player.chunkPosition().x, player.chunkPosition().z, 8)) { // Folia - region threading
return null;
} else {
List<PoiRecord> list = this.level.getPoiManager().getInRange((holder) -> {