First of all Thanks a lot to helping nooobie like me...
Minecraft 1.12.2
and forge Version 14.23.5.2768
And if you can guide me tell me hot to do so.
I made an custom spawn egg which has all data of entity like texture path and custom name of entity...
i am currently trying to spawn my custom entity using that custom egg but i don't know how to set all these attributes of custom entity individually?
@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand,EnumFacing facing, float hitX, float hitY, float hitZ) {
if(!worldIn.isRemote)
{
name = player.getHeldItem(hand).getTagCompound().getString("Name");
NPC npc = new NPC(worldIn, name);
npc.getEntityData().setString("Name", name);
npc.setPosition(pos.getX(), pos.getY() + 1, pos.getZ());
if(worldIn.spawnEntity(npc))
{
System.out.println(npc.getEntityData().getString("Name"));
return EnumActionResult.SUCCESS;
}
else
return EnumActionResult.FAIL;
}
return EnumActionResult.FAIL;
}
But this is printing name of that egg properly even i first setting it into entity and then accessing it...