Skip to content

Commit

Permalink
Do not create raids in positions not owned
Browse files Browse the repository at this point in the history
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 PaperMC#264
  • Loading branch information
Spottedleaf committed Aug 31, 2024
1 parent 99ba4bd commit 88e0907
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions patches/server/0003-Threaded-Regions.patch
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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) -> {
Expand Down

0 comments on commit 88e0907

Please sign in to comment.