Possible entity spawning problem within SpongeForge

Hi there,

I hesitated making a support topic about this until I was absolutely sure that I hadn’t been doing something wrong, but I have come now as I believe this may be a spongeforge issue that has persisted through 1.8.9 into 1.10.2.

I have been running a sponge server now with my own mod for about 6 months or so, and I noticed after a certain version, that forcing an entity to spawn appears to delete it from the world. I had thought that maybe this was maybe a plugin or an error on my part, but I have tested this with just my mod + spongeforge, and also with my mod alone in the test server that the Forge MDK sets up for you when building a workspace. I think I have narrowed down to being a problem with _World#spawnEntityInWorld(entity) within the vanilla code itself. But I am an amateur at programming in general and my knowledge of how the code is working together is minimal at best sometimes :frowning:

Anywho, on to the errors and such.

The error that I recieve when spawning an entity into the world:

[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: java.lang.Exception: Stack trace
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at java.lang.Thread.dumpStack(Unknown Source)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.entity.EntityTracker.handler$onAddEntityToTracker$zda000(EntityTracker.java:76)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.entity.EntityTracker.func_72785_a(EntityTracker.java)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraftforge.fml.common.registry.EntityRegistry.tryTrackingEntity(EntityRegistry.java:360)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.entity.EntityTracker.func_72786_a(EntityTracker.java:78)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.ServerWorldEventHandler.func_72703_a(ServerWorldEventHandler.java:33)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.World.func_72923_a(World.java:1142)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.WorldServer.func_72923_a(WorldServer.java:1118)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.WorldServer.onSpongeEntityAdded(WorldServer.java:1389)
[23:52:24] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.WorldServer.forceSpawnEntity(WorldServer.java:1435)
[23:52:25] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.WorldServer.forceSpawnEntity(WorldServer.java:1418)
[23:52:25] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at org.spongepowered.common.event.tracking.phase.TrackingPhase.spawnEntityOrCapture(TrackingPhase.java:284)
[23:52:25] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at org.spongepowered.common.event.tracking.phase.general.GeneralPhase.spawnEntityOrCapture(GeneralPhase.java:357)
[23:52:25] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at org.spongepowered.common.event.tracking.CauseTracker.spawnEntity(CauseTracker.java:558)
[23:52:25] [Netty Server IO #6/INFO] [STDERR]: [java.lang.Thread:dumpStack:-1]: at net.minecraft.world.WorldServer.func_72838_d(WorldServer.java:1160)

I am currently trying this with Forge 1.10.2 - and SpongeForge 1.10.2 - 5.1.0-BETA-2003, but I have also tried it with several earlier SpongeForge 1.10.2 versions, as well as the 1.8.9 versions.

I seemingly have this error with any version of SpongeForge past 1.8.9 - 4.2.0-BETA-1547 or so, and I have been perplexed on the true nature of this ever since.

Anyway, sorry for the long background story on my issue, and thank you for any help/insight you may be able to provide on this matter :slight_smile:


Seeeeeems I missed a change in the packet handling from 1.8.9 onward. So the issue is indeed mine. Sorry for creating this topic.

Yep looks like you found the issue. Networking is handled on a separate thread. (It’s been this way for a few years now BTW)
Here’s a nice post on it in more detail