當前位置: 首頁>>代碼示例>>Java>>正文


Java EntityAgeable.setGrowingAge方法代碼示例

本文整理匯總了Java中net.minecraft.entity.EntityAgeable.setGrowingAge方法的典型用法代碼示例。如果您正苦於以下問題:Java EntityAgeable.setGrowingAge方法的具體用法?Java EntityAgeable.setGrowingAge怎麽用?Java EntityAgeable.setGrowingAge使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.entity.EntityAgeable的用法示例。


在下文中一共展示了EntityAgeable.setGrowingAge方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: spawnChild

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Attempts to spawn a child when the player interacts with an entity using a custom spawn egg
 * @param stack a stack containing an ItemCustomEgg item
 * @param player the player interacting with the entity
 * @param entity the entity that will spawn the child
 * @return true if a child was spawned and the EntityInteractEvent should be canceled
 */
private boolean spawnChild(World world, ItemStack stack, EntityPlayer player, EntityAgeable entity) {
	Class<? extends Entity> oclass = CustomEntityList.getClassFromID(stack.getItemDamage());
	if (oclass != null && oclass == entity.getClass()) {
		EntityAgeable child = entity.createChild(entity);
		if (child != null) {
			child.setGrowingAge(-24000);
			child.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, 0.0F, 0.0F);
			if (!world.isRemote) {
				world.spawnEntityInWorld(child);
			}
			if (stack.hasDisplayName()) {
				child.setCustomNameTag(stack.getDisplayName());
			}
			if (!player.capabilities.isCreativeMode) {
				--stack.stackSize;
				if (stack.stackSize <= 0) {
					player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
				}
			}
			return true;
		}
	}
	return false;
}
 
開發者ID:coolAlias,項目名稱:ZeldaSwordSkills,代碼行數:32,代碼來源:ItemCustomEgg.java

示例2: onChildEntityBred

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void onChildEntityBred(EntityAgeable entity) {
	// Drop additional experience.
	int agingSlowdown = getAgingSlowdown(entity);
	int experience = (agingSlowdown - 1) * 2 + RandomUtils.getInt(3);
	while (experience > 0) {
		int xp = EntityXPOrb.getXPSplit(experience);
		entity.worldObj.spawnEntityInWorld(new EntityXPOrb(entity.worldObj, entity.posX, entity.posY, entity.posZ, xp));
		experience -= xp;
	}
	// Spawn additional pigs.
	if (entity instanceof EntityPig) {
		int num = (RandomUtils.getBoolean(1.0 / 200) ? 3 : 1);
		for (int i = 0; i < num; i++) {
			EntityAgeable newEntity = entity.createChild(entity);
			newEntity.setGrowingAge(-23999);
			newEntity.setLocationAndAngles(entity.posX, entity.posY, entity.posZ, RandomUtils.getFloat(360), 0);
			entity.worldObj.spawnEntityInWorld(newEntity);
		}
	}
}
 
開發者ID:copygirl,項目名稱:copyVanillaTweaks,代碼行數:21,代碼來源:AnimalBreedingGrowthHandler.java

示例3: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Spawns a baby animal of the same type.
 */
private void spawnBaby()
{
    EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);

    if (entityageable != null)
    {
        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.spawnEntityInWorld(entityageable);
        Random random = this.theAnimal.getRNG();

        for (int i = 0; i < 7; ++i)
        {
            double d0 = random.nextGaussian() * 0.02D;
            double d1 = random.nextGaussian() * 0.02D;
            double d2 = random.nextGaussian() * 0.02D;
            this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(random.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, d0, d1, d2);
        }

        this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:30,代碼來源:EntityAIMate.java

示例4: procreate

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Creates a baby animal according to the animal type of the target at the actual position and spawns 'love'
 * particles.
 */
private void procreate(EntityAnimal par1EntityAnimal)
{
    EntityAgeable entityageable = this.createChild(par1EntityAnimal);

    if (entityageable != null)
    {
        this.setGrowingAge(6000);
        par1EntityAnimal.setGrowingAge(6000);
        this.inLove = 0;
        this.breeding = 0;
        this.entityToAttack = null;
        par1EntityAnimal.entityToAttack = null;
        par1EntityAnimal.breeding = 0;
        par1EntityAnimal.inLove = 0;
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

        for (int i = 0; i < 7; ++i)
        {
            double d0 = this.rand.nextGaussian() * 0.02D;
            double d1 = this.rand.nextGaussian() * 0.02D;
            double d2 = this.rand.nextGaussian() * 0.02D;
            this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
        }

        this.worldObj.spawnEntityInWorld(entityageable);
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:33,代碼來源:EntityAnimal.java

示例5: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Spawns a baby animal of the same type.
 */
private void spawnBaby()
{
    EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);

    if (entityageable != null)
    {
        EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();

        if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
        {
            entityplayer = this.targetMate.getPlayerInLove();
        }

        if (entityplayer != null)
        {
            entityplayer.triggerAchievement(StatList.animalsBredStat);

            if (this.theAnimal instanceof EntityCow)
            {
                entityplayer.triggerAchievement(AchievementList.breedCow);
            }
        }

        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.spawnEntityInWorld(entityageable);
        Random random = this.theAnimal.getRNG();

        for (int i = 0; i < 7; ++i)
        {
            double d0 = random.nextGaussian() * 0.02D;
            double d1 = random.nextGaussian() * 0.02D;
            double d2 = random.nextGaussian() * 0.02D;
            double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
            double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
        }

        if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
        {
            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:53,代碼來源:EntityAIMate.java

示例6: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Spawns a baby animal of the same type.
 */
private void spawnBaby()
{
    EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);

    if (entityageable != null)
    {
        EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();

        if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
        {
            entityplayer = this.targetMate.getPlayerInLove();
        }

        if (entityplayer != null)
        {
            entityplayer.addStat(StatList.ANIMALS_BRED);

            if (this.theAnimal instanceof EntityCow)
            {
                entityplayer.addStat(AchievementList.BREED_COW);
            }
        }

        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.spawnEntityInWorld(entityageable);
        Random random = this.theAnimal.getRNG();

        for (int i = 0; i < 7; ++i)
        {
            double d0 = random.nextGaussian() * 0.02D;
            double d1 = random.nextGaussian() * 0.02D;
            double d2 = random.nextGaussian() * 0.02D;
            double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
            double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
        }

        if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
        {
            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:53,代碼來源:EntityAIMate.java

示例7: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Spawns a baby animal of the same type.
 */
private void spawnBaby()
{
    EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);

    final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(theAnimal, targetMate, entityageable);
    final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
    entityageable = event.getChild();
    if (cancelled) {
        //Reset the "inLove" state for the animals
        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        return;
    }

    if (entityageable != null)
    {
        EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();

        if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
        {
            entityplayer = this.targetMate.getPlayerInLove();
        }

        if (entityplayer != null)
        {
            entityplayer.addStat(StatList.ANIMALS_BRED);

            if (this.theAnimal instanceof EntityCow)
            {
                entityplayer.addStat(AchievementList.BREED_COW);
            }
        }

        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.spawnEntityInWorld(entityageable);
        Random random = this.theAnimal.getRNG();

        for (int i = 0; i < 7; ++i)
        {
            double d0 = random.nextGaussian() * 0.02D;
            double d1 = random.nextGaussian() * 0.02D;
            double d2 = random.nextGaussian() * 0.02D;
            double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
            double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
        }

        if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
        {
            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:65,代碼來源:EntityAIMate.java

示例8: spawnBabyAt

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
public static void spawnBabyAt(World world, Vec3d pos, EntityAgeable entity)
{
    entity.setPosition(pos.xCoord,pos.yCoord,pos.zCoord);
    entity.setGrowingAge(-24000);
    world.spawnEntity(entity);
}
 
開發者ID:DaedalusGame,項目名稱:BetterWithAddons,代碼行數:7,代碼來源:AnimalCrossbreedHandler.java

示例9: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Spawns a baby animal of the same type.
 */
private void spawnBaby()
{
    EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);

    final net.minecraftforge.event.entity.living.BabyEntitySpawnEvent event = new net.minecraftforge.event.entity.living.BabyEntitySpawnEvent(theAnimal, targetMate, entityageable);
    final boolean cancelled = net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(event);
    entityageable = event.getChild();
    if (cancelled) {
        //Reset the "inLove" state for the animals
        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        return;
    }

    if (entityageable != null)
    {
        EntityPlayer entityplayer = this.theAnimal.getPlayerInLove();

        if (entityplayer == null && this.targetMate.getPlayerInLove() != null)
        {
            entityplayer = this.targetMate.getPlayerInLove();
        }

        if (entityplayer != null)
        {
            entityplayer.addStat(StatList.ANIMALS_BRED);


        }

        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.spawnEntityInWorld(entityageable);
        Random random = this.theAnimal.getRNG();

        for (int i = 0; i < 7; ++i)
        {
            double d0 = random.nextGaussian() * 0.02D;
            double d1 = random.nextGaussian() * 0.02D;
            double d2 = random.nextGaussian() * 0.02D;
            double d3 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            double d4 = 0.5D + random.nextDouble() * (double)this.theAnimal.height;
            double d5 = random.nextDouble() * (double)this.theAnimal.width * 2.0D - (double)this.theAnimal.width;
            this.theWorld.spawnParticle(EnumParticleTypes.HEART, this.theAnimal.posX + d3, this.theAnimal.posY + d4, this.theAnimal.posZ + d5, d0, d1, d2, new int[0]);
        }

        if (this.theWorld.getGameRules().getBoolean("doMobLoot"))
        {
            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
        }
    }
}
 
開發者ID:wascardev,項目名稱:equidcraft,代碼行數:62,代碼來源:EntityAIMateCustom.java

示例10: update

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
public void update()
{
    age++;
    if(entInstance != null)
    {
        entInstance.setPosition(0, -500D, 0);
        entInstance.setAir(300);
        entInstance.setHealth(1);
        if(entInstance instanceof EntityAgeable && entInstance.isChild())
        {
            EntityAgeable living = (EntityAgeable)entInstance;
            living.setGrowingAge(living.getGrowingAge() - 1);
        }
        if(walkTimeout > 0)
        {
            walkTimeout--;
            if(walkTimeout == 0 && GuiltTrip.config.ghostWalkAnim == 1)
            {
                isWalking = !isWalking;
                walkTimeout = 100 + (int)(isWalking ? 200 * rand.nextFloat() : 100 * rand.nextFloat());
            }
        }

        if(lookTimeout > 0)
        {
            lookTimeout--;
            if(lookTimeout == 0 && GuiltTrip.config.ghostLookAnim == 1)
            {
                targetYaw = 360F * rand.nextFloat();
                targetPitch = 90F * rand.nextFloat() - 45F;
                lookTimeout = 100 + (rand.nextInt(100));
            }
        }

        if(isWalking)
        {
            entInstance.limbSwingAmount += (1.0F - entInstance.limbSwingAmount) * 0.4F;
        }
        entInstance.rotationYaw = entInstance.rotationYawHead = EntityHelper.updateRotation(entInstance.rotationYawHead, targetYaw, 1.5F);
        entInstance.rotationPitch = EntityHelper.updateRotation(entInstance.rotationPitch, targetPitch, 1F);

        float f3 = MathHelper.wrapDegrees(entInstance.rotationYawHead - entInstance.renderYawOffset);

        if(f3 < -75.0F)
        {
            f3 = -75.0F;
        }

        if(f3 >= 75.0F)
        {
            f3 = 75.0F;
        }

        if(rand.nextFloat() < 0.01F)
        {
            entInstance.swingArm(EnumHand.MAIN_HAND);
        }

        entInstance.renderYawOffset = entInstance.rotationYawHead - f3;

        entInstance.ticksExisted++;
        entInstance.onUpdate(); //should i do this or not?
    }
}
 
開發者ID:iChun,項目名稱:GuiltTrip,代碼行數:65,代碼來源:KillInfo.java

示例11: procreate

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Called when the mob breeds.
 * @param mob
 */
private void procreate(EntityIatMob mob)
{
	EntityAgeable entityageable = this.createChild(mob);

	if (entityageable != null)
	{
		if (this.theBreeder == null && mob.getBreeder() != null)
		{
			this.theBreeder = mob.getBreeder();
		}

		if (this.theBreeder != null)
		{
			this.theBreeder.triggerAchievement(StatList.field_151186_x);


		}

		this.setGrowingAge(6000);
		mob.setGrowingAge(6000);
		this.inLove = 0;
		this.breeding = 0;
		this.entityToAttack = null;
		mob.entityToAttack = null;
		mob.breeding = 0;
		mob.inLove = 0;
		entityageable.setGrowingAge(-24000);
		entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

		for (int i = 0; i < 7; ++i)
		{
			double d0 = this.rand.nextGaussian() * 0.02D;
			double d1 = this.rand.nextGaussian() * 0.02D;
			double d2 = this.rand.nextGaussian() * 0.02D;
			this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
		}

		this.worldObj.spawnEntityInWorld(entityageable);
	}
}
 
開發者ID:Alex-the-666,項目名稱:It-s-About-Time-Minecraft-Mod,代碼行數:45,代碼來源:EntityIatMob.java

示例12: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Spawns a baby animal of the same type.
 */
private void spawnBaby()
{
    EntityAgeable var1 = this.theAnimal.createChild(this.targetMate);

    if (var1 != null)
    {
        EntityPlayer var2 = this.theAnimal.func_146083_cb();

        if (var2 == null && this.targetMate.func_146083_cb() != null)
        {
            var2 = this.targetMate.func_146083_cb();
        }

        if (var2 != null)
        {
            var2.triggerAchievement(StatList.field_151186_x);

            if (this.theAnimal instanceof EntityCow)
            {
                var2.triggerAchievement(AchievementList.field_150962_H);
            }
        }

        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        var1.setGrowingAge(-24000);
        var1.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.spawnEntityInWorld(var1);
        Random var3 = this.theAnimal.getRNG();

        for (int var4 = 0; var4 < 7; ++var4)
        {
            double var5 = var3.nextGaussian() * 0.02D;
            double var7 = var3.nextGaussian() * 0.02D;
            double var9 = var3.nextGaussian() * 0.02D;
            this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(var3.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(var3.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(var3.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, var5, var7, var9);
        }

        if (this.theWorld.getGameRules().getGameRuleBooleanValue("doMobLoot"))
        {
            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, var3.nextInt(7) + 1));
        }
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:50,代碼來源:EntityAIMate.java

示例13: procreate

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
/**
 * Creates a baby animal according to the animal type of the target at the actual position and spawns 'love'
 * particles.
 */
private void procreate(EntityAnimal par1EntityAnimal)
{
    EntityAgeable var2 = this.createChild(par1EntityAnimal);

    if (var2 != null)
    {
        if (this.field_146084_br == null && par1EntityAnimal.func_146083_cb() != null)
        {
            this.field_146084_br = par1EntityAnimal.func_146083_cb();
        }

        if (this.field_146084_br != null)
        {
            this.field_146084_br.triggerAchievement(StatList.field_151186_x);

            if (this instanceof EntityCow)
            {
                this.field_146084_br.triggerAchievement(AchievementList.field_150962_H);
            }
        }

        this.setGrowingAge(6000);
        par1EntityAnimal.setGrowingAge(6000);
        this.inLove = 0;
        this.breeding = 0;
        this.entityToAttack = null;
        par1EntityAnimal.entityToAttack = null;
        par1EntityAnimal.breeding = 0;
        par1EntityAnimal.inLove = 0;
        var2.setGrowingAge(-24000);
        var2.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

        for (int var3 = 0; var3 < 7; ++var3)
        {
            double var4 = this.rand.nextGaussian() * 0.02D;
            double var6 = this.rand.nextGaussian() * 0.02D;
            double var8 = this.rand.nextGaussian() * 0.02D;
            this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, var4, var6, var8);
        }

        this.worldObj.spawnEntityInWorld(var2);
    }
}
 
開發者ID:MinecraftModdedClients,項目名稱:Resilience-Client-Source,代碼行數:48,代碼來源:EntityAnimal.java

示例14: spawnBaby

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void spawnBaby()
{
    EntityAgeable entityageable = this.theAnimal.createChild(this.targetMate);

    if (entityageable != null)
    {
        // CraftBukkit start - set persistence for tame animals
        if (entityageable instanceof EntityTameable && ((EntityTameable) entityageable).isTamed())
        {
            ((EntityLiving)entityageable).persistenceRequired = true; // Cauldron - fix illegal access error. SS bug?
        }

        // CraftBukkit end
        EntityPlayer entityplayer = this.theAnimal.func_146083_cb();

        if (entityplayer == null && this.targetMate.func_146083_cb() != null)
        {
            entityplayer = this.targetMate.func_146083_cb();
        }

        if (entityplayer != null)
        {
            entityplayer.triggerAchievement(StatList.field_151186_x);

            if (this.theAnimal instanceof EntityCow)
            {
                entityplayer.triggerAchievement(AchievementList.field_150962_H);
            }
        }

        this.theAnimal.setGrowingAge(6000);
        this.targetMate.setGrowingAge(6000);
        this.theAnimal.resetInLove();
        this.targetMate.resetInLove();
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, 0.0F, 0.0F);
        this.theWorld.addEntity(entityageable, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.BREEDING); // CraftBukkit - added SpawnReason
        Random random = this.theAnimal.getRNG();

        for (int i = 0; i < 7; ++i)
        {
            double d0 = random.nextGaussian() * 0.02D;
            double d1 = random.nextGaussian() * 0.02D;
            double d2 = random.nextGaussian() * 0.02D;
            this.theWorld.spawnParticle("heart", this.theAnimal.posX + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, this.theAnimal.posY + 0.5D + (double)(random.nextFloat() * this.theAnimal.height), this.theAnimal.posZ + (double)(random.nextFloat() * this.theAnimal.width * 2.0F) - (double)this.theAnimal.width, d0, d1, d2);
        }

        if (this.theWorld.getGameRules().getGameRuleBooleanValue("doMobLoot"))
        {
            this.theWorld.spawnEntityInWorld(new EntityXPOrb(this.theWorld, this.theAnimal.posX, this.theAnimal.posY, this.theAnimal.posZ, random.nextInt(7) + 1));
        }
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:54,代碼來源:EntityAIMate.java

示例15: procreate

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
private void procreate(EntityAnimal p_70876_1_)
{
    EntityAgeable entityageable = this.createChild(p_70876_1_);

    if (entityageable != null)
    {
        if (this.field_146084_br == null && p_70876_1_.func_146083_cb() != null)
        {
            this.field_146084_br = p_70876_1_.func_146083_cb();
        }

        if (this.field_146084_br != null)
        {
            this.field_146084_br.triggerAchievement(StatList.field_151186_x);

            if (this instanceof EntityCow)
            {
                this.field_146084_br.triggerAchievement(AchievementList.field_150962_H);
            }
        }

        this.setGrowingAge(6000);
        p_70876_1_.setGrowingAge(6000);
        this.inLove = 0;
        this.breeding = 0;
        this.entityToAttack = null;
        p_70876_1_.entityToAttack = null;
        p_70876_1_.breeding = 0;
        p_70876_1_.inLove = 0;
        entityageable.setGrowingAge(-24000);
        entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, this.rotationPitch);

        for (int i = 0; i < 7; ++i)
        {
            double d0 = this.rand.nextGaussian() * 0.02D;
            double d1 = this.rand.nextGaussian() * 0.02D;
            double d2 = this.rand.nextGaussian() * 0.02D;
            this.worldObj.spawnParticle("heart", this.posX + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, this.posY + 0.5D + (double)(this.rand.nextFloat() * this.height), this.posZ + (double)(this.rand.nextFloat() * this.width * 2.0F) - (double)this.width, d0, d1, d2);
        }

        this.worldObj.spawnEntityInWorld(entityageable);
    }
}
 
開發者ID:xtrafrancyz,項目名稱:Cauldron,代碼行數:44,代碼來源:EntityAnimal.java


注:本文中的net.minecraft.entity.EntityAgeable.setGrowingAge方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。