Posted June 23, 201312 yr Hi, I just created a custom projectile which works fine on singleplayer and functions in multiplayer, however in multiplayer other nearby players cannot see this projectile (they can still get hit and hurt by it). Do I need to implement custom packets for each entity I implement, or should this be done automatically. creating the hook: (EntityHook extends throwable) EntityHook hook = new EntityHook(par2World, par3EntityPlayer); par2World.spawnEntityInWorld(hook); I have registered the renderer int he client proxy: RenderingRegistry.registerEntityRenderingHandler(EntityHook.class, new RenderHook()); And also I registered the entity: EntityRegistry.registerGlobalEntityID(EntityHook.class, "Hook", EntityRegistry.findGlobalUniqueEntityId()); So is there something I've missed? Would really appreciate some help.
June 23, 201312 yr Are you sure you are spawning the new projectile on the server? Check this by implementing the follow check: if(!par2World.isRemote){ EntityHook hook = new EntityHook(par2World, par3EntityPlayer); par2World.spawnEntityInWorld(hook); }
June 23, 201312 yr Author Thanks, just made the change. Implemented the check and now even the player shooting the projectile cannot see it. This seems to suggest that no clients are getting notified about the projectile by the server. Any ideas for how to correct this? Projectiles function mostly, although the pull mechanic is now not working. (Is minecraft movement handled clientside???)
June 23, 201312 yr I believe that movement is done through the server, then rendered through the client. Not sure if that was the question. I think you may need to use a packet to handle the spawning, anyways check if the entity is spawned correctly by adding this code to the update method: if(!this.worldObj.isRemote){ System.out.println("[server] Ticked on server."); } If you see this message in the console, then you for sure will know that the entity is spawned on the server side.
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.