Jump to content

[1.10] Spawning an entity with ForgeData


Aarilight

Recommended Posts

My custom mob spawner (now rewritten to not extend vanilla mob spawners in any way) is spawning mobs.

However, the data I set to the mobs (via ForgeData), when they're spawned via the server, is not synced with the client. Here's the log I'm generating when mobs spawn:

[02:09:43] [Server thread/INFO] [STDOUT]: [com.kallgirl.souls.common.block.Summoner.SummonerLogic:updateSpawner:139]: set entity data
[02:09:43] [Server thread/INFO] [STDOUT]: [com.kallgirl.souls.common.NoMobSpawning:onMobJoinWorld:27]: successful spawn: Pig
[02:09:43] [Client thread/INFO] [STDOUT]: [com.kallgirl.souls.common.NoMobSpawning:onMobJoinWorld:30]: mob had no data: Pig

 

How can I ensure that the custom data I set on the entity, when spawning it, is also set on the client entity that is spawned?

 

By printing the stack trace I was able to find where the entity enters the client, but it seems like the code (NetHandlerPlayClient:961) doesn't have support for forge's ForgeData. Is this a bug, an oversight, or am I doing something wrong/missing a step?

Link to comment
Share on other sites

The ForgeData tag has never been automatically synced. If you want the data available on the client, you need to sync it yourself.

 

That said, you shouldn't need it on the client. Cancelling EntityJoinWorldEvent on the server will prevent the entity from being sent to the client at all.

  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.