June 30, 201213 yr Shouldnt be, instanceof checks the full tree, not just the parent. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 30, 201213 yr Author Weird. Is there any other initialisation I need? What is the minimum code to get this working? http://www.millenaire.org/img/dynamicsig.png[/img]
June 30, 201213 yr NetworkMod: load() ModLoader.registerEntityID() MinecraftForge.registerEntity() Should work fine. I'd debug and see if you're receiving the ModsList packet from Forge with a proper ID, and what happens when you get the EntitySpawn packet. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
June 30, 201213 yr Author I've figured it out. It's because the type is written in the packet as a byte, and the number I had chosen was above 256. The packet is received properly now (and promptly crash the client because some needed data isn't there, so I couldn't check the mouvement update works fine). http://www.millenaire.org/img/dynamicsig.png[/img]
June 30, 201213 yr Author Yep, it's working fine, with ISpawnHandler to send the initial data and custom packets to keep it updated. Neat. There's still a lot of work to be done (I haven't touched GUIs for instance), but I feel the structure is taking shape. Now it's mostly down to coding lots and lots of custom packets. http://www.millenaire.org/img/dynamicsig.png[/img]
July 1, 201213 yr Author Is there a way to preserve a player profile when running a server in MCP? It's annoying to start again at spawn every time. http://www.millenaire.org/img/dynamicsig.png[/img]
July 1, 201213 yr Author I noticed that the inventory of chests only gets synched when the player open them, which causes problems for me since I have code dependent on that content being up-to-date client-side. Is there a simple way of triggering such a refresh? http://www.millenaire.org/img/dynamicsig.png[/img]
July 1, 201213 yr You would have to send the chests's tile entity. There is no simple way. Are you sure your code should be on the client side for this? And to preserve your profile, just add a name to the parameters in your run config. Also, please use edit, dont triple post -.- I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 1, 201213 yr Author Ok, I'll check that. I think I'll need it client side, my trading screen depends on having infos on all the resources the village has. However it will only be when the player has the trading GUI open, so it won't generate much packets. http://www.millenaire.org/img/dynamicsig.png[/img]
July 5, 201213 yr Author An other quick question: how do I get the user name of the client which disconnected in onDisconnect()? If it's not possible I guess I can loop through the users present on the server to find the missing one. http://www.millenaire.org/img/dynamicsig.png[/img]
July 5, 201213 yr You are supplied with the NetworkManager, you can use that to get the player's entity. Which in turn can give you there username. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 5, 201213 yr Author Are you sure? I can't find any method returning a player in NetworkManager. Otherwise, I'm having some strange issues, the server seems to be creating duplicate villager entities at a fairly high rate, especially when a player logins and thus an area becomes active again (I'm speaking of villagers previously instantiated by my code there, which just need to be loaded again). Anyone knows anything about this? Is it a known issue? http://www.millenaire.org/img/dynamicsig.png[/img]
July 5, 201213 yr Check the supers of the NetworkManager I KNOW you can get the player from the information you're given. Which is one of the reasons why i dont pass the player in. And duplicate villagers... Assuimg you're referring to your millinaire villagers. Thats your code, you're the one spawning them. Either way, it shouldn't create them if they are loaded from the disc. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 5, 201213 yr Otherwise, I'm having some strange issues, the server seems to be creating duplicate villager entities at a fairly high rate, especially when a player logins and thus an area becomes active again (I'm speaking of villagers previously instantiated by my code there, which just need to be loaded again). Anyone knows anything about this? Is it a known issue? Make sure villagers are only spawned by the server or SP, never a client, many IsRemote checks are useful.
July 6, 201213 yr Author Check the supers of the NetworkManager I KNOW you can get the player from the information you're given. Which is one of the reasons why i dont pass the player in. Well, that's really weird, I can't find it. And NetworkManager has no super. The one solution I can see is to maintain a map of NetworkManagers to user name, populated in onLogin() (since the login packet has the user name). That would work, assuming that the NetworkManager is constant throughout the connection. And duplicate villagers... Assuimg you're referring to your millinaire villagers. Thats your code, you're the one spawning them. That's the thing, the error doesn't happen when my code creates villagers, but when chunks containing already-spawned villagers are unloaded then reloaded. But I'll triple-check, it could be due to something malfunctioning on my end. http://www.millenaire.org/img/dynamicsig.png[/img]
July 6, 201213 yr You can get the player entity from NetServerHandler And you can get the NetHandler from the NetworkManager I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 6, 201213 yr Author Ah, right! However to do that I have to cast the NetHandler to NetServerHandler first, otherwise I can't see the getUsername() method. Maybe you could add the method to NetHandler as well, with null return on the client? Would be easier to see it's there. For my duplicated villagers, I think I've found out why: the server seems to load less chunks around the player than SP does. The result is that my code is looking for villagers that haven't been loaded from NBT yet and respawning them thinking they are missing - which makes Minecraft load the chunk in question and with it the "missing" villager. Looks like I need to reduce Millénaire's activity radius in MP. Anyone know what it is? What area around a player is guaranteed to be live? http://www.millenaire.org/img/dynamicsig.png[/img]
July 6, 201213 yr You should add that getUsername function yourself in your own sided proxy class. Anyways, there is no garentee that ANY radius around the player is to be loaded. On the server you can lower it to one chunk, or you can raise it to 1,000 chunks. Many times it's lowered. What you *should* do is have your village object store the location of the villagers and not create new ones if they are already created, but unloaded. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 7, 201213 yr Author You should add that getUsername function yourself in your own sided proxy class. That's what I did. I was mentioning having it in the parent class mostly for futur users. Once you know it's there making your own method trivial. Anyways, there is no garentee that ANY radius around the player is to be loaded. On the server you can lower it to one chunk, or you can raise it to 1,000 chunks. Many times it's lowered. What you *should* do is have your village object store the location of the villagers and not create new ones if they are already created, but unloaded. Actually what I did is add code that freezes the entire village if part of it is unloaded. Otherwise I was having other issues such as villagers loading chunks by travelling there or putting blocks in them, which would hit performance. Anyway, problem solved! http://www.millenaire.org/img/dynamicsig.png[/img]
July 7, 201213 yr Author Hmm, chunk unloading on the server is very agressive. You basically need to be in the village to have it be active. That's both good CPU-wise and means that villages won't progress much. Anyway, if there's anything to be done about it it can wait. Otherwise, next issue Whenever a village is generated (when a player explores new areas) large parts of it will be on chunks that have already been generated and sent to the client. Probably since I set my blocks with no notify Minecraft doesn't resend the changes, so the player ends up with a village made of invisible, server-side only blocks until he reconnects. Is there anyway I could have the server resend the chunks? Of course it means duplicate data sent but since this will only happen when a player explores a new area it's acceptable I feel. http://www.millenaire.org/img/dynamicsig.png[/img]
July 7, 201213 yr Marks the blocks as dirty {there is a function around there somewhere} or use notify. Either way if you do it in one go, all the changes will be gathered up and sent to the client in one chunk. I do Forge for free, however the servers to run it arn't free, so anything is appreciated. Consider supporting the team on Patreon
July 8, 201213 yr Author Thanks, that worked (the notify, not the dirty marking, for some reason). I'm almost ready for a private beta. A public one shouldn't be too far of. http://www.millenaire.org/img/dynamicsig.png[/img]
July 8, 201213 yr Hmm, chunk unloading on the server is very agressive. You basically need to be in the village to have it be active. That's both good CPU-wise and means that villages won't progress much. Anyway, if there's anything to be done about it it can wait. Otherwise, next issue Whenever a village is generated (when a player explores new areas) large parts of it will be on chunks that have already been generated and sent to the client. Probably since I set my blocks with no notify Minecraft doesn't resend the changes, so the player ends up with a village made of invisible, server-side only blocks until he reconnects. Is there anyway I could have the server resend the chunks? Of course it means duplicate data sent but since this will only happen when a player explores a new area it's acceptable I feel. Forge includes hooks to handle chunk unloading (and keeping them from being unloaded), if you want fine grained control over it near your villages.
July 9, 201213 yr Author Interesting, I'll check it out. Not for release 1, but it might be a good option to add later. Otherwise, anyone knows how I can set the "death message" people get when killed by one of my villagers? It's clearly sent by this line: return StatCollector.translateToLocalFormatted("death." + this.damageType, new Object[] {par1EntityPlayer.username}); Where "this.damageType" is of the form "entity.<entity name>.name". Not sure how to provide that value however. Also, is there a way to make it specific to a given entity instead of generic? If possible I'd rather have it show the villager's name instead of just "villager". http://www.millenaire.org/img/dynamicsig.png[/img]
July 9, 201213 yr That returns a fully translated string, you can do whatever you want with it. It grabs the message from 'death.entity.entityname.name' in the languages file and translates it, you could do whatever you want... 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.