Jump to content

ISpawnHandler not working in Forge4?


Kinniken

Recommended Posts

As the topic says I'm having issues with ISpawnHandler - it doesn't seem to be firing at all. Even a simple log in writeSpawnData() fails to show. Has anything changed for it in Forge4? Note that my entities do get created client-side, just without their custom data. My entities are registered using ModLoader.registerEntityID() followed by EntityRegistry.registerModEntity(). Am I missing something?

 

Thanks

 

K.

Link to comment
Share on other sites

Ah guess I forgot to delete that class when FML took over the spawning.

Anyways, ByteArrayDataOutput is just a DataOutputStream that happens to work on a ByteArray as its backend, either way, it's signature is defined, so you need to use it.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

No problem, I just assumed it still worked since it was there. Good to know my issue came from something simple like this.

 

For the stream the reason I asked is because I have a lot of utility methods I wrote to read/write my custom objets and that currently use DataOutputStream/DataInputStream and are used both via the spawner interfaces and to send packets. So I'm wondering whether I should switch everything to the new streams.

Link to comment
Share on other sites

I've noticed something odd while doing some debugging - writeVillagerStreamData seems to be firing constantly for every one of my entity loaded server-side. The equivalent readVillagerStreamdata fires whenever the player is close enough, otherwise it doesn't. Is this intended? I thought that data was only supposed to be sent once, when the entity is created client-side.

Link to comment
Share on other sites

I assume you're referring to spawning still, the data should be read only once when the entity is spawned, and written once when the server tells it to spawn..

Are you sure the villagers are not trying to spawn for each other?

Walk the stack see who its writing the data for.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Ok, the bug was my fault, faulty logging. In fact it seems to be working fine.

 

Just one thing - is there a way of knowing server-side whether an entity was created in a specific client? I use custom packets to update some properties of my villagers and I'd like to make sure I don't send them for villagers not loaded on a given client.

Link to comment
Share on other sites

Nothing off the top of my head, but take a look at the EntityTracker* classes, those should contain a list of players and the entities they are aware of, {or inverted} but that would be the place to start.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

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.