本文整理汇总了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);
}
示例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;
}
示例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;
}
示例4: canProcess
import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
@Override
public boolean canProcess(ElectricTileEntity machine, int entityIndex, EntityAnimal entity) {
return ((entity != null) && entity.isChild());
}
示例5: canProcess
import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
@Override
public boolean canProcess(ElectricTileEntity machine, int entityIndex, EntityAnimal entity) {
return ((entity != null) && !entity.isChild());
}
示例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));
}
示例7: canBeMilked
import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
@Override
public boolean canBeMilked() {
EntityAnimal animal = this.getAnimal();
return (animal instanceof EntityCow) && !animal.isChild();
}
示例8: canBeBowled
import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
@Override
public boolean canBeBowled() {
EntityAnimal animal = this.getAnimal();
return (animal instanceof EntityMooshroom) && !animal.isChild();
}
示例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;
}
示例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;
}