public Entity spawnEntity(Entity par1Entity) { if (par1Entity instanceof EntityLivingBase && par1Entity.worldObj != null) { if (par1Entity instanceof EntitySkeleton) { ((EntitySkeleton) par1Entity).setSkeletonType(skeletonType); if (skeletonType == 1) { par1Entity.setCurrentItemOrArmor(0, new ItemStack(Items.stone_sword)); ((EntitySkeleton) par1Entity).setEquipmentDropChance(0, 0f); } else { par1Entity.setCurrentItemOrArmor(0, new ItemStack(Items.bow)); } } else ((EntityLiving) par1Entity).onSpawnWithEgg(null); if (!requiresPlayer) { ((EntityLiving) par1Entity).func_110163_bv(); par1Entity .getEntityData() .setLong("SpawnedByDESpawner", getSpawnerWorld().getTotalWorldTime()); } this.getSpawnerWorld().spawnEntityInWorld(par1Entity); } return par1Entity; }
@SideOnly(Side.CLIENT) public Entity getEntityForRenderer() { if (this.renderedEntity == null) { Entity entity = EntityList.createEntityByName(this.getEntityNameToSpawn(), getSpawnerWorld()); entity = this.spawnEntity(entity); if (entity instanceof EntitySkeleton) ((EntitySkeleton) entity).setSkeletonType(skeletonType); this.renderedEntity = entity; } return this.renderedEntity; }
@Override public void doSpellCasterEffect(EntityPlayer caster) { caster.worldObj.playSoundAtEntity(caster, "mob.wither.idle", 1.0F, 1.0F); final EntitySkeleton witherSkeleton = new EntitySkeleton(caster.worldObj); witherSkeleton.setSkeletonType(1); witherSkeleton.setPosition(caster.posX, caster.posY, caster.posZ); caster.worldObj.spawnEntityInWorld(witherSkeleton); PacketDispatcher.sendPacketToAllPlayers( PacketHandler.createSummonGFXPacket( witherSkeleton.posX, witherSkeleton.posY, witherSkeleton.posZ)); }