Posted August 20, 201213 yr 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. http://www.millenaire.org/img/dynamicsig.png[/img]
August 20, 201213 yr https://github.com/cpw/FML/blob/master/common/cpw/mods/fml/common/network/EntitySpawnPacket.java#L123 I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 20, 201213 yr Author Thanks. So ISpawnHandler is basically deprecated? Any reason for keeping it around? Also, I see the new one uses ByteArrayDataOutput. Is it recommended to switch to using those for all network communication? http://www.millenaire.org/img/dynamicsig.png[/img]
August 20, 201213 yr 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
August 20, 201213 yr Author 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. http://www.millenaire.org/img/dynamicsig.png[/img]
August 21, 201213 yr Ah you'd just need to wrap it around by doing a simple DataOutputStream out = new DataOutputStream(byeArrayOutput); I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
August 21, 201213 yr Author I solved it by switching to using just DataInput and DataOutput in my utility methods. Works for both now. And switching the interface indeed solved my issues, my villagers are back to normal now. Getting there, slowly http://www.millenaire.org/img/dynamicsig.png[/img]
August 21, 201213 yr Author 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. http://www.millenaire.org/img/dynamicsig.png[/img]
August 21, 201213 yr 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
August 21, 201213 yr Author Spawn for each other? I can see the name of each entity concerned, they each produce write and read calls. I'll check the stack. http://www.millenaire.org/img/dynamicsig.png[/img]
August 22, 201213 yr Author 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. http://www.millenaire.org/img/dynamicsig.png[/img]
August 22, 201213 yr 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
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.