FakePlayerBackend spawn still broken — ActorBackend spawn() lacks ServerLevel parameter #15

Closed
opened 2026-05-13 13:57:15 +00:00 by Mark · 1 comment
Owner

FakePlayerBackend spawn still broken

Issue #6 was closed but the root cause was never fixed — the bug is still present in the current code.

Root Cause

ActorBackend interface declares:

ActorHandle spawn(HeroActor hero, BlockPos pos);

FakePlayerBackend has TWO overloads:

  1. spawn(HeroActor, BlockPos) — logs error and returns null (this implements the interface)
  2. spawn(HeroActor, BlockPos, ServerLevel) — actual implementation (NOT declared in interface)

HeroSpawner.trySpawnOne() (HeroSpawner.java:130) calls backend.spawn(hero, spawnPos) — the interface method. For FakePlayerBackend this always returns null.

Every spawn attempt fails silently with:

[FakePlayerBackend] spawn(HeroActor, BlockPos) requires a ServerLevel context. Use spawn(HeroActor, BlockPos, ServerLevel).

Impact

All FakePlayerBackend spawns fail. If the active backend is FakePlayerBackend (fallback mode), no heroes ever spawn.

Suggested Fix

Either:

  1. Change ActorBackend.spawn() interface signature to include ServerLevel, updating all implementations
  2. Or have HeroSpawner detect FakePlayerBackend and call the ServerLevel overload
  3. Or pass ServerLevel through a different mechanism

References

  • ActorBackend.java:18 — interface declaration
  • FakePlayerBackend.java:54-58 — broken overload
  • FakePlayerBackend.java:64 — real implementation
  • HeroSpawner.java:130 — call site in trySpawnOne
  • HeroSpawner.java:86 — call site in spawnNamedHero
## FakePlayerBackend spawn still broken Issue #6 was closed but the root cause was never fixed — the bug is still present in the current code. ### Root Cause `ActorBackend` interface declares: ```java ActorHandle spawn(HeroActor hero, BlockPos pos); ``` `FakePlayerBackend` has TWO overloads: 1. `spawn(HeroActor, BlockPos)` — logs error and returns null (this implements the interface) 2. `spawn(HeroActor, BlockPos, ServerLevel)` — actual implementation (NOT declared in interface) `HeroSpawner.trySpawnOne()` (HeroSpawner.java:130) calls `backend.spawn(hero, spawnPos)` — the interface method. For FakePlayerBackend this always returns null. Every spawn attempt fails silently with: ``` [FakePlayerBackend] spawn(HeroActor, BlockPos) requires a ServerLevel context. Use spawn(HeroActor, BlockPos, ServerLevel). ``` ### Impact All FakePlayerBackend spawns fail. If the active backend is FakePlayerBackend (fallback mode), no heroes ever spawn. ### Suggested Fix Either: 1. Change `ActorBackend.spawn()` interface signature to include `ServerLevel`, updating all implementations 2. Or have `HeroSpawner` detect FakePlayerBackend and call the ServerLevel overload 3. Or pass ServerLevel through a different mechanism ### References - `ActorBackend.java:18` — interface declaration - `FakePlayerBackend.java:54-58` — broken overload - `FakePlayerBackend.java:64` — real implementation - `HeroSpawner.java:130` — call site in trySpawnOne - `HeroSpawner.java:86` — call site in spawnNamedHero
Author
Owner

Fixed in commit. Closing.

Fixed in commit. Closing.
Mark closed this issue 2026-05-13 14:04:46 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mc-heroes-mod#15
No description provided.