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


Java EntityAnimal.isChild方法代碼示例

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


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

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

示例2: work

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public float work() {
    if (WorkUtils.isDisabled(this.getBlockType())) return 0;

    AxisAlignedBB area = getWorkingArea();
    List<EntityAnimal> animals = this.world.getEntitiesWithinAABB(EntityAnimal.class, area);
    if (animals.size() == 0 || animals.size() > 35) return 0;
    EntityAnimal animal1 = animals.get(0);
    while ((animal1.isChild() || animal1.getGrowingAge() != 0 || getFirstBreedingItem(animal1).isEmpty() || animal1.isInLove()) && animals.indexOf(animal1) + 1 < animals.size())
        animal1 = animals.get(animals.indexOf(animal1) + 1);
    if (animal1.isChild() || animal1.getGrowingAge() != 0) return 0;
    EntityAnimal animal2 = animals.get(0);
    while ((animal2.equals(animal1) || animal2.isChild() || animal2.getGrowingAge() != 0 || getFirstBreedingItem(animal2).isEmpty() || animal1.isInLove()) && animals.indexOf(animal2) + 1 < animals.size())
        animal2 = animals.get(animals.indexOf(animal2) + 1);
    if (animal2.equals(animal1) || animal2.isChild() || animal2.getGrowingAge() != 0) return 0;
    if (animal1.getClass() != animal2.getClass()) return 0;
    ItemStack stack = getFirstBreedingItem(animal1);
    Item item = stack.getItem();
    stack.setCount(stack.getCount() - 1);
    stack = getFirstBreedingItem(animal2);
    if (stack.isEmpty()) {
        ItemHandlerHelper.insertItem(inFeedItems, new ItemStack(item, 1), false);
        return 0;
    }
    stack.setCount(stack.getCount() - 1);
    animal1.setInLove(null);
    animal2.setInLove(null);

    return 1;
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:31,代碼來源:AnimalStockIncreaserTile.java

示例3: checkEntityImmunities

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
/**
 * If an entity is not in range, do some more checks to see if we should
 * give it a shot.
 *
 * @param entity
 * @return
 */
public static boolean checkEntityImmunities(Entity entity)
{
    // quick checks.
    if ( entity.inWater /* isInWater */ || entity.fire > 0 )
    {
        return true;
    }
    if ( !( entity instanceof EntityArrow ) )
    {
        if ( !entity.onGround || entity.riddenByEntity != null
                || entity.ridingEntity != null )
        {
            return true;
        }
    } else if ( !( (EntityArrow) entity ).inGround )
    {
        return true;
    }
    // special cases.
    if ( entity instanceof EntityLiving )
    {
        EntityLiving living = (EntityLiving) entity;
        if ( living.attackTime > 0 || living.hurtTime > 0 || living.activePotionsMap.size() > 0 )
        {
            return true;
        }
        if ( entity instanceof EntityCreature && ( (EntityCreature) entity ).entityToAttack != null )
        {
            return true;
        }
        if ( entity instanceof EntityVillager && ( (EntityVillager) entity ).isMating() /* Getter for first boolean */ )
        {
            return true;
        }
        if ( entity instanceof EntityAnimal )
        {
            EntityAnimal animal = (EntityAnimal) entity;
            if ( animal.isChild() || animal.isInLove() /*love*/ )
            {
                return true;
            }
            if ( entity instanceof EntitySheep && ( (EntitySheep) entity ).getSheared() )
            {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:UraniumMC,項目名稱:Uranium,代碼行數:57,代碼來源:ActivationRange.java

示例4: canProcess

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public boolean canProcess(ElectricTileEntity machine, int entityIndex, EntityAnimal entity) {
    return ((entity != null) && entity.isChild());
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:5,代碼來源:AnimalAgeBabyFilterItem.java

示例5: canProcess

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public boolean canProcess(ElectricTileEntity machine, int entityIndex, EntityAnimal entity) {
    return ((entity != null) && !entity.isChild());
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:5,代碼來源:AnimalAgeAdultFilterItem.java

示例6: breedable

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public boolean breedable() {
    EntityAnimal animal = this.getAnimal();
    return ((animal != null) && !animal.isInLove() && !animal.isChild() && (animal.getGrowingAge() == 0));
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:6,代碼來源:VanillaGenericAnimal.java

示例7: canBeMilked

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public boolean canBeMilked() {
    EntityAnimal animal = this.getAnimal();
    return (animal instanceof EntityCow) && !animal.isChild();
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:6,代碼來源:VanillaGenericAnimal.java

示例8: canBeBowled

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public boolean canBeBowled() {
    EntityAnimal animal = this.getAnimal();
    return (animal instanceof EntityMooshroom) && !animal.isChild();
}
 
開發者ID:faceofcat,項目名稱:Mekfarm,代碼行數:6,代碼來源:VanillaGenericAnimal.java

示例9: checkEntityImmunities

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
/**
 * If an entity is not in range, do some more checks to see if we should
 * give it a shot.
 *
 * @param entity
 * @return
 */
public static boolean checkEntityImmunities(Entity entity)
{
    // quick checks.
    if ( entity.inWater /* isInWater */ || entity.fire > 0 )
    {
        return true;
    }
    if ( !( entity.getClass().equals(EntityArrow.class) ) )
    {
        if ( !entity.onGround || entity.riddenByEntity != null
                || entity.ridingEntity != null )
        {
            return true;
        }
    } else if ( !( (EntityArrow) entity ).inGround )
    {
        return true;
    }
    // special cases.
    if ( entity.getClass().equals(EntityLiving.class) )
    {
        EntityLiving living = (EntityLiving) entity;
        if ( living.attackTime > 0 || living.hurtTime > 0 || living.activePotionsMap.size() > 0 )
        {
            return true;
        }
        if ( entity.getClass().equals(EntityCreature.class) && ( (EntityCreature) entity ).entityToAttack != null )
        {
            return true;
        }
        if ( entity.getClass().equals(EntityVillager.class) && ( (EntityVillager) entity ).isMating() /* Getter for first boolean */ )
        {
            return true;
        }
        if ( entity.getClass().equals(EntityAnimal.class) )
        {
            EntityAnimal animal = (EntityAnimal) entity;
            if ( animal.isChild() || animal.isInLove() /*love*/ )
            {
                return true;
            }
            if ( entity.getClass().equals(EntitySheep.class) && ( (EntitySheep) entity ).getSheared() )
            {
                return true;
            }
        }
    }
    return false;
}
 
開發者ID:Bogdan-G,項目名稱:FFoKC,代碼行數:57,代碼來源:ActivationRange.java

示例10: itemInteractionForEntity

import net.minecraft.entity.passive.EntityAnimal; //導入方法依賴的package包/類
@Override
public boolean itemInteractionForEntity(ItemStack stack,
        EntityPlayer player, EntityLivingBase entity, EnumHand hand) {
    
    if (entity.world.isRemote) {
        
        return true;
    }
    
    if (this.animalEaters.contains(entity.getClass())) {
        
        EntityAnimal animal = (EntityAnimal) entity;
        
        if (animal.getGrowingAge() == 0 && !animal.isInLove()) {
            
            if (!player.capabilities.isCreativeMode) {
                
                stack.shrink(1);
            }
            
            animal.setInLove(player);
            return true;
        }
        
        if (animal.isChild()) {
            
            if (!player.capabilities.isCreativeMode) {
                
                stack.shrink(1);
            }
            
            animal.ageUp((int)(((float)-animal.getGrowingAge() / 20) *
                    0.1F), true);
            return true;
        }
    }
    
    return false;
}
 
開發者ID:JayAvery,項目名稱:geomastery,代碼行數:40,代碼來源:ItemSeed.java


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