Hey, so I've managed to spawn my custom entity by letting my custom spawn packet implement
IPacket<ClientPlayNetHandler>
and processing the packet in the packet class as well by using some of the code from
ClientPlayNetHandler - handleSpawnObject(SSpawnObjectPacket packetIn)
I also return a new packet instance in my entity class in the createSpawnPacket() method.
i.e.
process method in my packet class
@Override
public void processPacket(ClientPlayNetHandler handler)
{
Entity entity = entityType.create(handler.getWorld());
entity.func_213312_b(this.x, this.y, this.z);
entity.rotationPitch = (float)(this.pitch * 360) / 256.0F;
entity.rotationYaw = (float)(this.yaw * 360) / 256.0F;
entity.setEntityId(this.entityId);
entity.setUniqueId(this.uuid);
handler.getWorld().addEntity(this.entityId, entity);
}
createSpawnPacket() in my entity class
@Override
public IPacket<?> createSpawnPacket()
{
return new MagicModEntitySpawnPacket(MagicModRegistry.TestEntityType, this.getEntityId(), this.entityUniqueID, this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
}