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


Java EntityAnimal类代码示例

本文整理汇总了Java中net.minecraft.entity.passive.EntityAnimal的典型用法代码示例。如果您正苦于以下问题:Java EntityAnimal类的具体用法?Java EntityAnimal怎么用?Java EntityAnimal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EntityAnimal类属于net.minecraft.entity.passive包,在下文中一共展示了EntityAnimal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: affectChunk

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
@Override
public void affectChunk(World world) {
	
	Chunk chunk = world.getChunkFromChunkCoords(chunkPos.x, chunkPos.z);
	
	for (int i = 0; i < chunk.getEntityLists().length; i++) {
		if (chunk.getEntityLists()[i] != null) {
			for (EntityAnimal e : chunk.getEntityLists()[i].getByClass(EntityAnimal.class)) {
				if (world.rand.nextInt(3) == 0) {
					e.addTag(TAG);
				}
			}
		}
	}

}
 
开发者ID:the-realest-stu,项目名称:Etheric,代码行数:17,代码来源:InfertilityEvent.java

示例2: getNearbyMate

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    float f = 8.0F;
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expand((double)f, (double)f, (double)f));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:23,代码来源:EntityAIMate.java

示例3: checkValidity

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
private boolean checkValidity(final EntityLivingBase entity) {
    if (entity == this.mc.thePlayer) {
        return false;
    }
    if (!entity.isEntityAlive()) {
        return false;
    }
    if (this.mc.thePlayer.getDistanceToEntity(entity) > this.range) {
        return false;
    }
    if (!(entity instanceof EntityPlayer)) {
        return (this.monsters && entity instanceof EntityMob) || (this.animals && (entity instanceof EntityAnimal || entity instanceof EntitySquid)) || (this.bats && entity instanceof EntityBat);
    }
    if (this.players) {
        final EntityPlayer player = (EntityPlayer)entity;
        return (this.friend && FriendManager.isFriend(player.getName())) || (!FriendManager.isFriend(player.getName()) && (!this.noArmor || this.hasArmor(player)));
    }
    return false;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:20,代码来源:Aura.java

示例4: interactEntityEvent

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
@SubscribeEvent
public void interactEntityEvent(EntityInteractEvent event) {
	ItemStack stack = event.entityPlayer.getCurrentEquippedItem();
	if (stack == null)
		return;
	if (!(event.target instanceof EntityAnimal))
		return;

	EntityAnimal animal = (EntityAnimal) event.target;
	if (!animal.isChild()) {
		if (animal instanceof EntityPig) {
			if (stack.getItem() == ModItems.beetroot && EtFuturum.enableBeetroot)
				setAnimalInLove(animal, event.entityPlayer, stack);
		} else if (animal instanceof EntityChicken)
			if (stack.getItem() == ModItems.beetroot_seeds && EtFuturum.enableBeetroot)
				setAnimalInLove(animal, event.entityPlayer, stack);
	} else if (EtFuturum.enableBabyGrowthBoost && isFoodItem(animal, stack))
		feedBaby(animal, event.entityPlayer, stack);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:20,代码来源:ServerEventHandler.java

示例5: feedBaby

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
private void feedBaby(EntityAnimal animal, EntityPlayer player, ItemStack stack) {
	int currentAge = animal.getGrowingAge();
	int age = (int) (-currentAge * 0.1F);
	animal.setGrowingAge(currentAge + age);
	player.swingItem();

	Random itemRand = animal.worldObj.rand;
	for (int i = 0; i < 3; i++) {
		double d0 = itemRand.nextGaussian() * 0.02D;
		double d1 = itemRand.nextGaussian() * 0.02D;
		double d2 = itemRand.nextGaussian() * 0.02D;
		animal.worldObj.spawnParticle("happyVillager", animal.posX + itemRand.nextFloat() * 0.5, animal.posY + 0.5 + itemRand.nextFloat() * 0.5, animal.posZ + itemRand.nextFloat() * 0.5, d0, d1, d2);
	}

	if (!player.capabilities.isCreativeMode)
		if (--stack.stackSize <= 0)
			player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:19,代码来源:ServerEventHandler.java

示例6: getEntityColor

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
public Color getEntityColor() {
	if ((entity instanceof EntityAnimal)) {
		return Color.white;
	}
	if ((entity instanceof EntityMob)) {
		return Color.red;
	}
	if ((entity instanceof EntitySlime)) {
		return Color.green;
	}
	if ((entity instanceof EntityVillager)) {
		return new Color(245, 245, 220);
	}
	if ((entity instanceof EntityBat)) {
		return Color.BLACK;
	}
	if ((entity instanceof EntitySquid)) {
		return Color.PINK;
	}
	return Color.white;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:22,代码来源:IEntity.java

示例7: getNearbyMate

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.field_190857_e, this.theAnimal.getEntityBoundingBox().expandXyz(8.0D));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityAIMate.java

示例8: BabyEntitySpawnEvent

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
public BabyEntitySpawnEvent(EntityLiving parentA, EntityLiving parentB, @Nullable EntityAgeable proposedChild)
{
    //causedByPlayer calculated here to simplify the patch.
    EntityPlayer causedByPlayer = null;
    if (parentA instanceof EntityAnimal) {
        causedByPlayer = ((EntityAnimal)parentA).getPlayerInLove();
    }

    if (causedByPlayer == null && parentB instanceof EntityAnimal)
    {
        causedByPlayer = ((EntityAnimal)parentB).getPlayerInLove();
    }

    this.parentA = parentA;
    this.parentB = parentB;
    this.causedByPlayer = causedByPlayer;
    this.child = proposedChild;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:BabyEntitySpawnEvent.java

示例9: getNearbyMate

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
/**
 * Loops through nearby animals and finds another animal of the same type that can be mated with. Returns the first
 * valid mate found.
 */
private EntityAnimal getNearbyMate()
{
    List<EntityAnimal> list = this.theWorld.<EntityAnimal>getEntitiesWithinAABB(this.theAnimal.getClass(), this.theAnimal.getEntityBoundingBox().expandXyz(8.0D));
    double d0 = Double.MAX_VALUE;
    EntityAnimal entityanimal = null;

    for (EntityAnimal entityanimal1 : list)
    {
        if (this.theAnimal.canMateWith(entityanimal1) && this.theAnimal.getDistanceSqToEntity(entityanimal1) < d0)
        {
            entityanimal = entityanimal1;
            d0 = this.theAnimal.getDistanceSqToEntity(entityanimal1);
        }
    }

    return entityanimal;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:EntityAIMate.java

示例10: onEntityCollidedWithBlock

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
public void onEntityCollidedWithBlock(final World world, final int x, final int y, final int z, final Entity entity) {
    if (this.rand.nextInt(5) > 0) {
        return;
    }
    if (entity instanceof EntityAnimal) {
        final EntityAnimal animal = (EntityAnimal)entity;
        if (animal.getGrowingAge() < 0) {
            animal.addGrowth(this.rand.nextInt(40));
        }
        else if (animal.getGrowingAge() > 0) {
            int j = animal.getGrowingAge();
            j -= this.rand.nextInt(40);
            if (j < 0) {
                j = 0;
            }
            animal.setGrowingAge(j);
        }
        else if (!animal.isInLove()) {
            if (world.getEntitiesWithinAABB((Class)entity.getClass(), entity.boundingBox.expand(8.0, 8.0, 8.0)).size() > 32) {
                return;
            }
            animal.func_146082_f((EntityPlayer)null);
        }
    }
}
 
开发者ID:sameer,项目名称:ExtraUtilities,代码行数:26,代码来源:BlockPureLove.java

示例11: canMateWith

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
@Override
public boolean canMateWith(EntityAnimal par1EntityAnimal)
{
    if (par1EntityAnimal == this)
    {
        return false;
    }
    else if (!this.isTamed())
    {
        return false;
    }
    else if (!(par1EntityAnimal instanceof EntitySlimeling))
    {
        return false;
    }
    else
    {
        EntitySlimeling slimeling = (EntitySlimeling) par1EntityAnimal;
        return slimeling.isTamed() && !slimeling.isSitting() && this.isInLove() && slimeling.isInLove();
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:22,代码来源:EntitySlimeling.java

示例12: isEntityValidToAttack

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
public boolean isEntityValidToAttack(EntityMinionWarrior minion, EntityLivingBase entity)
{
	if(entity == minion || entity == minion.getRidingEntity() || !EntityAITarget.isSuitableTarget(minion, entity, false, false) || entity.getClass() == EntityCreeper.class) return false;
	
	if (entity instanceof EntityMob &&
			(getTargetBehavior() == EnumCombatBehaviors.TARGET_HOSTILE_MOBS || 
			getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
	{
		return true;
	}

	else if (entity instanceof EntityAnimal &&
			(getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_MOBS || 
			getTargetBehavior() == EnumCombatBehaviors.TARGET_PASSIVE_OR_HOSTILE_MOBS))
	{
		return true;
	}

	else
	{
		return false;
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:24,代码来源:MinionAICombat.java

示例13: tryBreeding

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
private boolean tryBreeding(List<EntityPair> targets) {
	Entity animalA;
	Entity animalB;
	EntityPair pair;
	if (!targets.isEmpty()) {
		pair = targets.remove(0);
		animalA = pair.getEntityA(getWorld());
		animalB = pair.getEntityB(getWorld());
		if (!(animalA instanceof EntityAnimal)
				|| !(animalB instanceof EntityAnimal)) {
			return false;
		}
		if (!hasBreedingItem((EntityAnimal) animalA))
			return false;
		((EntityAnimal) animalA).setInLove(null);// setInLove(EntityPlayer
														// breeder)
		((EntityAnimal) animalB).setInLove(null);// setInLove(EntityPlayer
														// breeder)
		return true;
	}
	return false;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:23,代码来源:WorksiteAnimalFarm.java

示例14: canMateWith

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
/**
 * Returns true if the mob is currently able to mate with the specified mob.
 */
public boolean canMateWith(EntityAnimal p_70878_1_)
{
    if (p_70878_1_ == this)
    {
        return false;
    }
    else if (!this.isTamed())
    {
        return false;
    }
    else if (!(p_70878_1_ instanceof EntityStymph))
    {
        return false;
    }
    else
    {
        EntityStymph entityocelot = (EntityStymph)p_70878_1_;
        return !entityocelot.isTamed() ? false : this.isInLove() && entityocelot.isInLove();
    }
}
 
开发者ID:GhostMonk3408,项目名称:MidgarCrusade,代码行数:24,代码来源:EntityStymph.java

示例15: isValidTarget

import net.minecraft.entity.passive.EntityAnimal; //导入依赖的package包/类
private boolean isValidTarget(Entity e)
{
	if (e == null) return false;
	else if (e instanceof EntityPlayer)
	{
		EntityPlayer p = ((EntityPlayer) e);
		if (p.capabilities.isCreativeMode) return false;
		else
		{
			if (kPlayers) return true;
			else if (!kTeam) return false;
			RivalRebelsPlayer rrp = RivalRebels.round.rrplayerlist.getForName(((EntityPlayer) e).getCommandSenderName());
			if (rrp == null) return kTeam;
			if (rrp.rrteam == RivalRebelsTeam.NONE) return !p.getCommandSenderName().equals(username);
			if (rrp.rrteam != team) return kTeam;
			else return false;
		}
	}
	else return (kMobs && (e instanceof EntityRhodes || (e instanceof EntityMob && !(e instanceof EntityAnimal) && !(e instanceof EntityBat) && !(e instanceof EntityVillager) && !(e instanceof EntitySquid)) || e instanceof EntityGhast));
}
 
开发者ID:rodolphito,项目名称:Rival-Rebels-Mod,代码行数:21,代码来源:TileEntityReciever.java


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