当前位置: 首页>>代码示例>>Java>>正文


Java EntityAgeable.setLocationAndAngles方法代码示例

本文整理汇总了Java中net.minecraft.entity.EntityAgeable.setLocationAndAngles方法的典型用法代码示例。如果您正苦于以下问题:Java EntityAgeable.setLocationAndAngles方法的具体用法?Java EntityAgeable.setLocationAndAngles怎么用?Java EntityAgeable.setLocationAndAngles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.entity.EntityAgeable的用法示例。


在下文中一共展示了EntityAgeable.setLocationAndAngles方法的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: 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

示例9: 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

示例10: 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

示例11: 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

示例12: 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

示例13: 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

示例14: spawnBaby

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

    if (entityageable != null)
    {
        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.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);
        }

        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,代码行数:47,代码来源:EntityAIMate.java

示例15: interact

import net.minecraft.entity.EntityAgeable; //导入方法依赖的package包/类
@Override
public boolean interact(EntityPlayer player)
   {
	super.interact(player);
       ItemStack itemstack = player.inventory.getCurrentItem();

       if (itemstack != null && itemstack.getItem() == DerpyItems.spawnegg)
       {
           if (!this.worldObj.isRemote)
           {
               Class oclass = (Class) EntityList.stringToClassMapping.get(itemstack.getTagCompound().getString("entity"));

               if (oclass != null && oclass.isAssignableFrom(this.getClass()))
               {
                   EntityAgeable entityageable = this.createChild(this);

                   if (entityageable != null)
                   {
                       entityageable.setGrowingAge(-24000);
                       entityageable.setLocationAndAngles(this.posX, this.posY, this.posZ, 0.0F, 0.0F);
                       this.worldObj.spawnEntityInWorld(entityageable);

                       if (itemstack.hasDisplayName())
                       {
                           entityageable.setCustomNameTag(itemstack.getDisplayName());
                       }

                       if (!player.capabilities.isCreativeMode)
                       {
                           --itemstack.stackSize;

                           if (itemstack.stackSize <= 0)
                           {
                               player.inventory.setInventorySlotContents(player.inventory.currentItem, (ItemStack)null);
                           }
                       }
                   }
               }
           }

           return true;
       }
       else
       {
           return false;
       }
   }
 
开发者ID:Wuerfel21,项目名称:The-Derpy-Shiz-Mod,代码行数:48,代码来源:EntityPiggycorn.java


注:本文中的net.minecraft.entity.EntityAgeable.setLocationAndAngles方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。