Java 类net.minecraft.entity.IEntityLivingData 实例源码

项目:Infernum    文件:EntityPigZombieMage.java   
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {
    livingdata = super.onInitialSpawn(difficulty, livingdata);
    float f = difficulty.getClampedAdditionalDifficulty();
    this.setCanPickUpLoot(false);
    this.setEquipmentBasedOnDifficulty(difficulty);
    this.setEnchantmentBasedOnDifficulty(difficulty);
    this.setCombatTask();

    this.getEntityAttribute(SharedMonsterAttributes.KNOCKBACK_RESISTANCE).applyModifier(
            new AttributeModifier("Random spawn bonus", this.rand.nextDouble() * 0.05000000074505806D, 0));
    double d0 = this.rand.nextDouble() * 1.5D * (double) f;

    if (d0 > 1.0D) {
        this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE)
                .applyModifier(new AttributeModifier("Random zombie-spawn bonus", d0, 2));
    }

    return livingdata;
}
项目:Infernum    文件:EntityPigMage.java   
@Override
public void onStruckByLightning(EntityLightningBolt lightningBolt) {
    if (!this.world.isRemote && !this.isDead) {
        EntityPigZombieMage entitymage = new EntityPigZombieMage(this.world);
        entitymage.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitymage.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entitymage)),
                (IEntityLivingData) null);
        entitymage.setNoAI(this.isAIDisabled());

        if (this.hasCustomName()) {
            entitymage.setCustomNameTag(this.getCustomNameTag());
            entitymage.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.world.spawnEntity(entitymage);
        this.setDead();
    }
}
项目:DecompiledMinecraft    文件:StructureOceanMonumentPieces.java   
protected boolean func_175817_a(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
    int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
    int j = this.getYWithOffset(p_175817_4_);
    int k = this.getZWithOffset(p_175817_3_, p_175817_5_);

    if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
    {
        EntityGuardian entityguardian = new EntityGuardian(worldIn);
        entityguardian.setElder(true);
        entityguardian.heal(entityguardian.getMaxHealth());
        entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
        entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null);
        worldIn.spawnEntityInWorld(entityguardian);
        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:StructureVillagePieces.java   
protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
    if (this.villagersSpawned < p_74893_6_)
    {
        for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
        {
            int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
            int k = this.getYWithOffset(p_74893_4_);
            int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);

            if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
            {
                break;
            }

            ++this.villagersSpawned;
            EntityVillager entityvillager = new EntityVillager(worldIn);
            entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
            entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
            entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
            worldIn.spawnEntityInWorld(entityvillager);
        }
    }
}
项目:DecompiledMinecraft    文件:EntityRabbit.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);
    int i = this.rand.nextInt(6);
    boolean flag = false;

    if (livingdata instanceof EntityRabbit.RabbitTypeData)
    {
        i = ((EntityRabbit.RabbitTypeData)livingdata).typeData;
        flag = true;
    }
    else
    {
        livingdata = new EntityRabbit.RabbitTypeData(i);
    }

    this.setRabbitType(i);

    if (flag)
    {
        this.setGrowingAge(-24000);
    }

    return livingdata;
}
项目:CustomWorldGen    文件:EntityVillager.java   
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.worldObj);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
项目:DecompiledMinecraft    文件:EntityVillager.java   
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.worldObj);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
项目:DecompiledMinecraft    文件:EntityOcelot.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.rand.nextInt(7) == 0)
    {
        for (int i = 0; i < 2; ++i)
        {
            EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
            entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
            entityocelot.setGrowingAge(-24000);
            this.worldObj.spawnEntityInWorld(entityocelot);
        }
    }

    return livingdata;
}
项目:CustomWorldGen    文件:StructureOceanMonumentPieces.java   
protected boolean spawnElder(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
    int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
    int j = this.getYWithOffset(p_175817_4_);
    int k = this.getZWithOffset(p_175817_3_, p_175817_5_);

    if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
    {
        EntityGuardian entityguardian = new EntityGuardian(worldIn);
        entityguardian.setElder(true);
        entityguardian.heal(entityguardian.getMaxHealth());
        entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
        entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null);
        worldIn.spawnEntityInWorld(entityguardian);
        return true;
    }
    else
    {
        return false;
    }
}
项目:DecompiledMinecraft    文件:EntityRabbit.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);
    int i = this.rand.nextInt(6);
    boolean flag = false;

    if (livingdata instanceof EntityRabbit.RabbitTypeData)
    {
        i = ((EntityRabbit.RabbitTypeData)livingdata).typeData;
        flag = true;
    }
    else
    {
        livingdata = new EntityRabbit.RabbitTypeData(i);
    }

    this.setRabbitType(i);

    if (flag)
    {
        this.setGrowingAge(-24000);
    }

    return livingdata;
}
项目:DecompiledMinecraft    文件:EntityVillager.java   
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.worldObj);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
项目:DecompiledMinecraft    文件:EntityOcelot.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.rand.nextInt(7) == 0)
    {
        for (int i = 0; i < 2; ++i)
        {
            EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
            entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
            entityocelot.setGrowingAge(-24000);
            this.worldObj.spawnEntityInWorld(entityocelot);
        }
    }

    return livingdata;
}
项目:DecompiledMinecraft    文件:EntityZombie.java   
/**
 * Convert this zombie into a villager.
 */
protected void convertToVillager()
{
    EntityVillager entityvillager = new EntityVillager(this.worldObj);
    entityvillager.copyLocationAndAnglesFrom(this);
    entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
    entityvillager.setLookingForHome();

    if (this.isChild())
    {
        entityvillager.setGrowingAge(-24000);
    }

    this.worldObj.removeEntity(this);
    entityvillager.setNoAI(this.isAIDisabled());

    if (this.hasCustomName())
    {
        entityvillager.setCustomNameTag(this.getCustomNameTag());
        entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
    }

    this.worldObj.spawnEntityInWorld(entityvillager);
    entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
}
项目:BaseClient    文件:StructureOceanMonumentPieces.java   
protected boolean func_175817_a(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
    int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
    int j = this.getYWithOffset(p_175817_4_);
    int k = this.getZWithOffset(p_175817_3_, p_175817_5_);

    if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
    {
        EntityGuardian entityguardian = new EntityGuardian(worldIn);
        entityguardian.setElder(true);
        entityguardian.heal(entityguardian.getMaxHealth());
        entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
        entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null);
        worldIn.spawnEntityInWorld(entityguardian);
        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureVillagePieces.java   
protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
    if (this.villagersSpawned < p_74893_6_)
    {
        for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
        {
            int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
            int k = this.getYWithOffset(p_74893_4_);
            int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);

            if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
            {
                break;
            }

            ++this.villagersSpawned;
            EntityVillager entityvillager = new EntityVillager(worldIn);
            entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
            entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
            entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
            worldIn.spawnEntityInWorld(entityvillager);
        }
    }
}
项目:Backmemed    文件:EntityVillager.java   
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.world.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.world);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.world.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.world.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
项目:CustomWorldGen    文件:EntityAISkeletonRiders.java   
private EntitySkeleton createSkeleton(DifficultyInstance p_188514_1_, EntityHorse p_188514_2_)
{
    EntitySkeleton entityskeleton = new EntitySkeleton(p_188514_2_.worldObj);
    entityskeleton.onInitialSpawn(p_188514_1_, (IEntityLivingData)null);
    entityskeleton.setPosition(p_188514_2_.posX, p_188514_2_.posY, p_188514_2_.posZ);
    entityskeleton.hurtResistantTime = 60;
    entityskeleton.enablePersistence();

    if (entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD) == null)
    {
        entityskeleton.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(Items.IRON_HELMET));
    }

    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getHeldItemMainhand(), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    EnchantmentHelper.addRandomEnchantment(entityskeleton.getRNG(), entityskeleton.getItemStackFromSlot(EntityEquipmentSlot.HEAD), (int)(5.0F + p_188514_1_.getClampedAdditionalDifficulty() * (float)entityskeleton.getRNG().nextInt(18)), false);
    entityskeleton.worldObj.spawnEntityInWorld(entityskeleton);
    return entityskeleton;
}
项目:BaseClient    文件:EntityVillager.java   
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.worldObj);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
项目:BaseClient    文件:EntityZombie.java   
/**
 * Convert this zombie into a villager.
 */
protected void convertToVillager()
{
    EntityVillager entityvillager = new EntityVillager(this.worldObj);
    entityvillager.copyLocationAndAnglesFrom(this);
    entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
    entityvillager.setLookingForHome();

    if (this.isChild())
    {
        entityvillager.setGrowingAge(-24000);
    }

    this.worldObj.removeEntity(this);
    entityvillager.setNoAI(this.isAIDisabled());

    if (this.hasCustomName())
    {
        entityvillager.setCustomNameTag(this.getCustomNameTag());
        entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
    }

    this.worldObj.spawnEntityInWorld(entityvillager);
    entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
}
项目:CustomWorldGen    文件:EntityPolarBear.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    if (livingdata instanceof EntityPolarBear.GroupData)
    {
        if (((EntityPolarBear.GroupData)livingdata).madeParent)
        {
            this.setGrowingAge(-24000);
        }
    }
    else
    {
        EntityPolarBear.GroupData entitypolarbear$groupdata = new EntityPolarBear.GroupData();
        entitypolarbear$groupdata.madeParent = true;
        livingdata = entitypolarbear$groupdata;
    }

    return (IEntityLivingData)livingdata;
}
项目:BaseClient    文件:StructureOceanMonumentPieces.java   
protected boolean func_175817_a(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
    int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
    int j = this.getYWithOffset(p_175817_4_);
    int k = this.getZWithOffset(p_175817_3_, p_175817_5_);

    if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
    {
        EntityGuardian entityguardian = new EntityGuardian(worldIn);
        entityguardian.setElder(true);
        entityguardian.heal(entityguardian.getMaxHealth());
        entityguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
        entityguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityguardian)), (IEntityLivingData)null);
        worldIn.spawnEntityInWorld(entityguardian);
        return true;
    }
    else
    {
        return false;
    }
}
项目:BaseClient    文件:StructureVillagePieces.java   
protected void spawnVillagers(World worldIn, StructureBoundingBox p_74893_2_, int p_74893_3_, int p_74893_4_, int p_74893_5_, int p_74893_6_)
{
    if (this.villagersSpawned < p_74893_6_)
    {
        for (int i = this.villagersSpawned; i < p_74893_6_; ++i)
        {
            int j = this.getXWithOffset(p_74893_3_ + i, p_74893_5_);
            int k = this.getYWithOffset(p_74893_4_);
            int l = this.getZWithOffset(p_74893_3_ + i, p_74893_5_);

            if (!p_74893_2_.isVecInside(new BlockPos(j, k, l)))
            {
                break;
            }

            ++this.villagersSpawned;
            EntityVillager entityvillager = new EntityVillager(worldIn);
            entityvillager.setLocationAndAngles((double)j + 0.5D, (double)k, (double)l + 0.5D, 0.0F, 0.0F);
            entityvillager.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
            entityvillager.setProfession(this.func_180779_c(i, entityvillager.getProfession()));
            worldIn.spawnEntityInWorld(entityvillager);
        }
    }
}
项目:BaseClient    文件:EntityVillager.java   
/**
 * Called when a lightning bolt hits the entity.
 */
public void onStruckByLightning(EntityLightningBolt lightningBolt)
{
    if (!this.worldObj.isRemote && !this.isDead)
    {
        EntityWitch entitywitch = new EntityWitch(this.worldObj);
        entitywitch.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);
        entitywitch.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entitywitch)), (IEntityLivingData)null);
        entitywitch.setNoAI(this.isAIDisabled());

        if (this.hasCustomName())
        {
            entitywitch.setCustomNameTag(this.getCustomNameTag());
            entitywitch.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entitywitch);
        this.setDead();
    }
}
项目:BaseClient    文件:EntityOcelot.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.rand.nextInt(7) == 0)
    {
        for (int i = 0; i < 2; ++i)
        {
            EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
            entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
            entityocelot.setGrowingAge(-24000);
            this.worldObj.spawnEntityInWorld(entityocelot);
        }
    }

    return livingdata;
}
项目:Backmemed    文件:EntityOcelot.java   
@Nullable

    /**
     * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
     * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
     */
    public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
    {
        livingdata = super.onInitialSpawn(difficulty, livingdata);

        if (this.getTameSkin() == 0 && this.world.rand.nextInt(7) == 0)
        {
            for (int i = 0; i < 2; ++i)
            {
                EntityOcelot entityocelot = new EntityOcelot(this.world);
                entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
                entityocelot.setGrowingAge(-24000);
                this.world.spawnEntityInWorld(entityocelot);
            }
        }

        return livingdata;
    }
项目:BaseClient    文件:EntityZombie.java   
/**
 * Convert this zombie into a villager.
 */
protected void convertToVillager()
{
    EntityVillager entityvillager = new EntityVillager(this.worldObj);
    entityvillager.copyLocationAndAnglesFrom(this);
    entityvillager.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityvillager)), (IEntityLivingData)null);
    entityvillager.setLookingForHome();

    if (this.isChild())
    {
        entityvillager.setGrowingAge(-24000);
    }

    this.worldObj.removeEntity(this);
    entityvillager.setNoAI(this.isAIDisabled());

    if (this.hasCustomName())
    {
        entityvillager.setCustomNameTag(this.getCustomNameTag());
        entityvillager.setAlwaysRenderNameTag(this.getAlwaysRenderNameTag());
    }

    this.worldObj.spawnEntityInWorld(entityvillager);
    entityvillager.addPotionEffect(new PotionEffect(Potion.confusion.id, 200, 0));
    this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1017, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
}
项目:Halloween    文件:EntityZombieHands.java   
/**
 * Overridden to call {@link EntityZombie#setChild(boolean)} to force all ZombieHands to be adults, and to create HuskHands in desert biomes
 */
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
    super.onInitialSpawn(difficulty, livingdata);
    this.setChild(false);

    // *** logic copied from 1.10 implementation of EntityZombie
    Biome biome = this.world.getBiome(new BlockPos(this));
    if (biome instanceof BiomeDesert && this.world.canSeeSky(new BlockPos(this)) && this.rand.nextInt(5) != 0)
    {
        this.setZombieType(ZombieType.HUSK);
    }
    // *** logic copied from 1.10 implementation of EntityZombie

    return livingdata;
}
项目:Backmemed    文件:StructureOceanMonumentPieces.java   
protected boolean spawnElder(World worldIn, StructureBoundingBox p_175817_2_, int p_175817_3_, int p_175817_4_, int p_175817_5_)
{
    int i = this.getXWithOffset(p_175817_3_, p_175817_5_);
    int j = this.getYWithOffset(p_175817_4_);
    int k = this.getZWithOffset(p_175817_3_, p_175817_5_);

    if (p_175817_2_.isVecInside(new BlockPos(i, j, k)))
    {
        EntityElderGuardian entityelderguardian = new EntityElderGuardian(worldIn);
        entityelderguardian.heal(entityelderguardian.getMaxHealth());
        entityelderguardian.setLocationAndAngles((double)i + 0.5D, (double)j, (double)k + 0.5D, 0.0F, 0.0F);
        entityelderguardian.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityelderguardian)), (IEntityLivingData)null);
        worldIn.spawnEntityInWorld(entityelderguardian);
        return true;
    }
    else
    {
        return false;
    }
}
项目:Backmemed    文件:EntityPolarBear.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    if (livingdata instanceof EntityPolarBear.GroupData)
    {
        if (((EntityPolarBear.GroupData)livingdata).madeParent)
        {
            this.setGrowingAge(-24000);
        }
    }
    else
    {
        EntityPolarBear.GroupData entitypolarbear$groupdata = new EntityPolarBear.GroupData();
        entitypolarbear$groupdata.madeParent = true;
        livingdata = entitypolarbear$groupdata;
    }

    return (IEntityLivingData)livingdata;
}
项目:Backmemed    文件:EntityLlama.java   
@Nullable

    /**
     * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
     * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
     */
    public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
    {
        livingdata = super.onInitialSpawn(difficulty, livingdata);
        this.func_190705_dT();
        int i;

        if (livingdata instanceof EntityLlama.GroupData)
        {
            i = ((EntityLlama.GroupData)livingdata).field_190886_a;
        }
        else
        {
            i = this.rand.nextInt(4);
            livingdata = new EntityLlama.GroupData(i);
        }

        this.func_190710_o(i);
        return livingdata;
    }
项目:CustomWorldGen    文件:EntityOcelot.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.getTameSkin() == 0 && this.worldObj.rand.nextInt(7) == 0)
    {
        for (int i = 0; i < 2; ++i)
        {
            EntityOcelot entityocelot = new EntityOcelot(this.worldObj);
            entityocelot.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
            entityocelot.setGrowingAge(-24000);
            this.worldObj.spawnEntityInWorld(entityocelot);
        }
    }

    return livingdata;
}
项目:Bewitchment    文件:RitualConjurationWitch.java   
@Override
public void onFinish(EntityPlayer player, IRitualHandler tile, World world, BlockPos pos, NBTTagCompound data) {
    if (!world.isRemote) {
        EntityWitch witch = new EntityWitch(world);
        witch.setLocationAndAngles(pos.getX(), pos.getY(), pos.getZ(), (float) (Math.random() * 360), 0);
        witch.onInitialSpawn(world.getDifficultyForLocation(new BlockPos(witch)), (IEntityLivingData) null);
        world.spawnEntity(witch);
        if (Math.random() < 0.1)
            witch.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 6000, 2, false, false));
    }
}
项目:harshencastle    文件:EntitySoullessKnight.java   
@Override
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata) {
    setItemStackToSlot(this.isLeftHanded() ? EntityEquipmentSlot.OFFHAND : EntityEquipmentSlot.MAINHAND, new ItemStack(HarshenItems.PROPS, 1, 0));
    try {
        setItemStackToSlot(this.isLeftHanded() ? EntityEquipmentSlot.MAINHAND : EntityEquipmentSlot.OFFHAND, new ItemStack(JsonToNBT.getTagFromJson("{id:\"minecraft:shield\",Count:1b,tag:{BlockEntityTag:{Patterns:[{Pattern:\"ss\",Color:6},{Pattern:\"flo\",Color:1}],Base:8}},Damage:0s}")));
    } catch (NBTException e) {
        e.printStackTrace();
    }
       this.getEntityAttribute(SharedMonsterAttributes.FOLLOW_RANGE).applyModifier(new AttributeModifier("Random spawn bonus", this.rand.nextGaussian() * 0.05D, 1));
       this.setLeftHanded(false);
    return livingdata;
}
项目:DecompiledMinecraft    文件:EntityVillager.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);
    this.setProfession(this.worldObj.rand.nextInt(5));
    this.setAdditionalAItasks();
    return livingdata;
}
项目:Backmemed    文件:EntityVex.java   
@Nullable

    /**
     * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
     * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
     */
    public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
    {
        this.setEquipmentBasedOnDifficulty(difficulty);
        this.setEnchantmentBasedOnDifficulty(difficulty);
        return super.onInitialSpawn(difficulty, livingdata);
    }
项目:DecompiledMinecraft    文件:EntitySlime.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    int i = this.rand.nextInt(3);

    if (i < 2 && this.rand.nextFloat() < 0.5F * difficulty.getClampedAdditionalDifficulty())
    {
        ++i;
    }

    int j = 1 << i;
    this.setSlimeSize(j);
    return super.onInitialSpawn(difficulty, livingdata);
}
项目:DecompiledMinecraft    文件:EntityPigZombie.java   
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    super.onInitialSpawn(difficulty, livingdata);
    this.setVillager(false);
    return livingdata;
}
项目:Backmemed    文件:AbstractSkeleton.java   
@Nullable

    /**
     * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
     * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
     */
    public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata)
    {
        livingdata = super.onInitialSpawn(difficulty, livingdata);
        this.setEquipmentBasedOnDifficulty(difficulty);
        this.setEnchantmentBasedOnDifficulty(difficulty);
        this.setCombatTask();
        this.setCanPickUpLoot(this.rand.nextFloat() < 0.55F * difficulty.getClampedAdditionalDifficulty());

        if (this.getItemStackFromSlot(EntityEquipmentSlot.HEAD).func_190926_b())
        {
            Calendar calendar = this.world.getCurrentDate();

            if (calendar.get(2) + 1 == 10 && calendar.get(5) == 31 && this.rand.nextFloat() < 0.25F)
            {
                this.setItemStackToSlot(EntityEquipmentSlot.HEAD, new ItemStack(this.rand.nextFloat() < 0.1F ? Blocks.LIT_PUMPKIN : Blocks.PUMPKIN));
                this.inventoryArmorDropChances[EntityEquipmentSlot.HEAD.getIndex()] = 0.0F;
            }
        }

        return livingdata;
    }
项目:DecompiledMinecraft    文件:EntityZombie.java   
/**
 * This method gets called when the entity kills another one.
 */
public void onKillEntity(EntityLivingBase entityLivingIn)
{
    super.onKillEntity(entityLivingIn);

    if ((this.worldObj.getDifficulty() == EnumDifficulty.NORMAL || this.worldObj.getDifficulty() == EnumDifficulty.HARD) && entityLivingIn instanceof EntityVillager)
    {
        if (this.worldObj.getDifficulty() != EnumDifficulty.HARD && this.rand.nextBoolean())
        {
            return;
        }

        EntityLiving entityliving = (EntityLiving)entityLivingIn;
        EntityZombie entityzombie = new EntityZombie(this.worldObj);
        entityzombie.copyLocationAndAnglesFrom(entityLivingIn);
        this.worldObj.removeEntity(entityLivingIn);
        entityzombie.onInitialSpawn(this.worldObj.getDifficultyForLocation(new BlockPos(entityzombie)), (IEntityLivingData)null);
        entityzombie.setVillager(true);

        if (entityLivingIn.isChild())
        {
            entityzombie.setChild(true);
        }

        entityzombie.setNoAI(entityliving.isAIDisabled());

        if (entityliving.hasCustomName())
        {
            entityzombie.setCustomNameTag(entityliving.getCustomNameTag());
            entityzombie.setAlwaysRenderNameTag(entityliving.getAlwaysRenderNameTag());
        }

        this.worldObj.spawnEntityInWorld(entityzombie);
        this.worldObj.playAuxSFXAtEntity((EntityPlayer)null, 1016, new BlockPos((int)this.posX, (int)this.posY, (int)this.posZ), 0);
    }
}
项目:DecompiledMinecraft    文件:ItemMonsterPlacer.java   
/**
 * Spawns the creature specified by the egg's type in the location specified by the last three parameters.
 * Parameters: world, entityID, x, y, z.
 */
public static Entity spawnCreature(World worldIn, int entityID, double x, double y, double z)
{
    if (!EntityList.entityEggs.containsKey(Integer.valueOf(entityID)))
    {
        return null;
    }
    else
    {
        Entity entity = null;

        for (int i = 0; i < 1; ++i)
        {
            entity = EntityList.createEntityByID(entityID, worldIn);

            if (entity instanceof EntityLivingBase)
            {
                EntityLiving entityliving = (EntityLiving)entity;
                entity.setLocationAndAngles(x, y, z, MathHelper.wrapAngleTo180_float(worldIn.rand.nextFloat() * 360.0F), 0.0F);
                entityliving.rotationYawHead = entityliving.rotationYaw;
                entityliving.renderYawOffset = entityliving.rotationYaw;
                entityliving.onInitialSpawn(worldIn.getDifficultyForLocation(new BlockPos(entityliving)), (IEntityLivingData)null);
                worldIn.spawnEntityInWorld(entity);
                entityliving.playLivingSound();
            }
        }

        return entity;
    }
}