From 4f8b98771fcefdf57d11e1faac7310526ee83377 Mon Sep 17 00:00:00 2001 From: "Blanche (angelroom01)" <174630752+blnchdev@users.noreply.github.com> Date: Thu, 12 Feb 2026 19:06:46 +0100 Subject: [PATCH] Fix crash on performWorldGenSpawning performWorldGenSpawning -> onFinalizeSpawn -> EntitySpitter.updateAttributes -> ComplexMob.breed This deadlocks the server thread! --- src/main/java/untamedwilds/entity/ComplexMob.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main/java/untamedwilds/entity/ComplexMob.java b/src/main/java/untamedwilds/entity/ComplexMob.java index 623639a4..94ee7e5a 100644 --- a/src/main/java/untamedwilds/entity/ComplexMob.java +++ b/src/main/java/untamedwilds/entity/ComplexMob.java @@ -217,6 +217,13 @@ public boolean wantsToBreed() { @SuppressWarnings("unchecked") // Don't use this outside ComplexMobs public void breed() { + // Just return early if we're not the main server thread + // AKA don't allow WorldGen ForkJoin-created entities to breed entities (since they were added off-thread) + // This might be due to wantsToBreed() returning true as long as naturalBreeding is not explicitly disabled + if (!(this.level instanceof ServerLevel serverLevel) || !serverLevel.getServer().isSameThread()) { + return; + } + int bound = 1 + (this.getOffspring() > 0 ? this.random.nextInt(this.getOffspring() + 1) : 0); for (int i = 0; i < bound; i++) { T child = (T) this.getBreedOffspring((ServerLevel) this.level, this);