Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been working a Minecraft sever mod and i want to be able to add a new entity to the server, but then make the server send the packets to the client, imitating another mob, for example..

Lets say say i have EntityPlayerNPC.class, what i want to do is have all of the packets that get sent to the client look like they are from that of another player which is on the player, therefore allowing me to add custom NPC's... Thinking about the theory i'm sure this can be done.

I've tried looking around for where the packets are being sent from and whatnot, can anyone think up a solution?


i tried adding a new constructor to the Packet20NamedEntitySpawn class like so:

public Packet20NamedEntitySpawn(String username, EntityLiving e){
       this.entityId = 0; = username;
       this.xPosition = MathHelper.floor_double(e.posX * 32.0D);
       this.yPosition = MathHelper.floor_double(e.posY * 32.0D);
       this.zPosition = MathHelper.floor_double(e.posZ * 32.0D);
       this.rotation = (byte)((int)(e.rotationYaw * 256.0F / 360.0F));
       this.pitch = (byte)((int)(e.rotationPitch * 256.0F / 360.0F));
       this.metadata = e.getDataWatcher();

unfortunatley, that didn't work :(

share|improve this question
What's with all the down votes, this is a well structured question. What's the point in a forum for asking questions, where you get penalized for asking questions? – Alan Tuning Nov 26 '12 at 16:28

Im not too familiar with minecraft coding, but Id say take a look at other mods that have done similar things, such as adding extra animals and that, or also look at the code for existing NPCs such as the Pigmen Villagers and such.

Is what your wanting to do is make an NPC clone of the player with all of their fields like username and such?

share|improve this answer
Basically, in Minecraft, if an entity does not have a matching id on the client side, then it will not render or display in any way. Now this causes a problem when i want to add a new mob on the server side, I've been brainstorming some solutions and one of them is a type of proxy, which intercepts the packets for my custom entity, and makes them into an entity of my choice. – Alan Tuning Nov 25 '12 at 20:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.