Posted June 30, 201411 yr I can spawn a cow, but it seems only on the client side. The cow disappears after a moment, which is my clue that it is only happening on client side. I figured the best approach was to send a message to the server, and then spawn the cow within that context. I was able to send the message successfully, and verified that the "side" is "SERVER", but when I attempt to spawn the cow, it again appears to spawn on the client instead. Apologies in advance. Long time programmer, but this minecraft modding has me back to the "hello world" stage apparently. Here's the code (in my message handler class) that receives the message from client side: @Override public IMessage onMessage(MoshMessage message, MessageContext ctx) { // this works as expected, indicating (I think) that I have received a message from client-side. System.out.println("I got a message [" + message.msg + "] from " + ctx.getServerHandler().playerEntity.getDisplayName()); // this says "SERVER" as expected System.out.println("side: " + ctx.side.toString()); // this works as expected, time is set to 0 ctx.getServerHandler().playerEntity.worldObj.setWorldTime(0); // This DOESN'T work as expected. The cow is spawned client-side and disappears soon after. // I want it to spawn on server-side. Entity e = new EntityCow(ctx.getServerHandler().playerEntity.worldObj); e.posX = ctx.getServerHandler().playerEntity.posX; e.posY = ctx.getServerHandler().playerEntity.posY; e.posZ = ctx.getServerHandler().playerEntity.posZ; ctx.getServerHandler().playerEntity.worldObj.spawnEntityInWorld(e); return null; } I'm probably overlooking a simple concept here so I would appreciate any guidance. Thanks, John
June 30, 201411 yr I've run into a problem similar to this before, and it's definitely not your fault. You need to set the entity's angles too. e.setLocationAndAngles(player.posX, player.posY, player.posZ, 0, 0); Kain
June 30, 201411 yr Author Did the trick. Thank you much! Odd that the pitch and yaw aren't set to 0 by default - oh well. Follow up, if I can trouble you a bit more: My end goal is to be able to spawn a player model (as an NPC) and assign arbitrary AI to it. EntityPlayerMP seems too heavy for this purpose, because it contains a lot of logic for an actual "player", and I just want the NPC version of it. Is this something I need to put together manually (model/texture -> class extended from EntityLivingBase)? If so, no worries, I'll figure it out. I was looking at extending from EntityVillager perhaps? But I want to use the player model, so maybe a custom binding - not sure still exploring. Thanks again, John
June 30, 201411 yr You can use ModelBiped for the model, as that's the standard player model. Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
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.