Properly use WorldGenRegion structure manager for swamp hut cat generation

Fixes a crash when attempting to retrieve the chunk data,
as Folia does not support off-region sync chunk loads.

Fixes https://github.com/PaperMC/Folia/issues/221
This commit is contained in:
Spottedleaf 2024-05-12 04:02:09 -07:00
parent 1f3ff5ee61
commit 509de1c265

View File

@ -18028,7 +18028,7 @@ index 0dfb8109fd8c022b079da00f6a0e3fc85b57bf7a..cdc431ab27b1837b852c8fb559d0324b
}
diff --git a/src/main/java/net/minecraft/world/entity/animal/Cat.java b/src/main/java/net/minecraft/world/entity/animal/Cat.java
index 07559b9629d4ecb40b511256f400a781e39820e0..6d24e4efeda9265a1b02c807dbed96b7db765424 100644
index 07559b9629d4ecb40b511256f400a781e39820e0..1cd5f0178c016736ebaf0f4449262da680cc2fab 100644
--- a/src/main/java/net/minecraft/world/entity/animal/Cat.java
+++ b/src/main/java/net/minecraft/world/entity/animal/Cat.java
@@ -367,7 +367,7 @@ public class Cat extends TamableAnimal implements VariantHolder<Holder<CatVarian
@ -18036,7 +18036,7 @@ index 07559b9629d4ecb40b511256f400a781e39820e0..6d24e4efeda9265a1b02c807dbed96b7
ServerLevel worldserver = world.getLevel();
- if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK, world).isValid()) { // Paper - Fix swamp hut cat generation deadlock
+ if (worldserver.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { // Paper - Fix swamp hut cat generation deadlock // Folia - region threading - properly fix this
+ if (world.structureManager().getStructureWithPieceAt(this.blockPosition(), StructureTags.CATS_SPAWN_AS_BLACK).isValid()) { // Paper - Fix swamp hut cat generation deadlock // Folia - region threading - properly fix this
this.setVariant((Holder) BuiltInRegistries.CAT_VARIANT.getHolderOrThrow(CatVariant.ALL_BLACK));
this.setPersistenceRequired();
}