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


Java EntityAnimal.getClass方法代码示例

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


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

示例1: canMateWith

import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
public boolean canMateWith(EntityAnimal otherAnimal)
{
    if (otherAnimal == this)
    {
        return false;
    }
    else if (otherAnimal.getClass() != this.getClass())
    {
        return false;
    }
    else
    {
        EntityHorseCustom entityhorse = (EntityHorseCustom) otherAnimal;

        if (this.canMate() && entityhorse.canMate())
        {
            HorseType horsetype = this.getType();
            HorseType horsetype1 = entityhorse.getType();
            return this.isMale() != entityhorse.isMale() && !this.isSterile() && !entityhorse.isSterile() && (horsetype == horsetype1 || horsetype == HorseType.HORSE && horsetype1 == HorseType.DONKEY || horsetype == HorseType.DONKEY && horsetype1 == HorseType.HORSE);
        }
        else
        {
            return false;
        }
    }
}
 
开发者ID:wascardev,项目名称:equidcraft,代码行数:27,代码来源:EntityHorseCustom.java

示例2: canMateWith

import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
/**
 * Returns true if the mob is currently able to mate with the specified mob.
 */
@Override
public boolean canMateWith(EntityAnimal par1EntityAnimal) {
	if (par1EntityAnimal == this) {
		return false;
	} else if (par1EntityAnimal.getClass() != this.getClass()) {
		return false;
	} else {
		EntityHorseclaw entityHorseclaw = (EntityHorseclaw) par1EntityAnimal;

		if (this.func_110200_cJ() && entityHorseclaw.func_110200_cJ()) {
			int i = this.getHorseType();
			int j = entityHorseclaw.getHorseType();
			return i == j || i == 0 && j == 1 || i == 1 && j == 0;
		} else {
			return false;
		}
	}
}
 
开发者ID:mookie1097,项目名称:NausicaaMod,代码行数:22,代码来源:EntityHorseclaw.java

示例3: func_70878_b

import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
public boolean func_70878_b(EntityAnimal p_70878_1_) {
   if(p_70878_1_ == this) {
      return false;
   } else if(p_70878_1_.getClass() != this.getClass()) {
      return false;
   } else {
      EntityHorse var2 = (EntityHorse)p_70878_1_;
      if(this.func_110200_cJ() && var2.func_110200_cJ()) {
         int var3 = this.func_110265_bP();
         int var4 = var2.func_110265_bP();
         return var3 == var4 || var3 == 0 && var4 == 1 || var3 == 1 && var4 == 0;
      } else {
         return false;
      }
   }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:EntityHorse.java

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

示例5: getAnimals

import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
public ArrayList getAnimals( final World world ) {
	final List list = world.getEntitiesWithinAABB( EntityAnimal.class, fairy.boundingBox.expand( 5D, 5D, 5D ) );

	if ( list.size() < 2 ) {
		return null;
	}

	final ArrayList list2 = new ArrayList();

	for ( int i = 0; i < list.size(); i++ ) {
		final EntityAnimal entity1 = (EntityAnimal) list.get( i );

		final int fleeingTick = ReflectionHelper.getPrivateValue(EntityCreature.class, entity1, MCP_FLEEINGTICK);
		if ( fairy.peacefulAnimal( entity1 ) && fairy.canEntityBeSeen( entity1 ) && entity1.getHealth() > 0
				&& entity1.getEntityToAttack() == null && fleeingTick <= 0 && !entity1.isInLove()
				&& entity1.getGrowingAge() == 0 ) {
			for ( int j = 0; j < list.size(); j++ ) {
				final EntityAnimal entity2 = (EntityAnimal) list.get( j );

				if ( entity1 != entity2 && entity1.getClass() == entity2.getClass()
						&& entity2.getGrowingAge() == 0 ) {
					list2.add( entity1 );
				}
			}
		}
	}

	if ( list2.size() <= 0 ) {
		return null;
	} else {
		return list2;
	}
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:34,代码来源:FairyJob.java

示例6: 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 mob)
{
	if(hasGenders()){
		if( this.getGender() == 0 && ((EntityIatMob) mob).getGender() == 1){
           	return true;
           }if(this.getGender() == 1 && ((EntityIatMob) mob).getGender() == 0){
           	return true;
           }	
	}
	return mob == this ? false : (mob.getClass() != this.getClass() ? false : this.isInLove() && mob.isInLove());
}
 
开发者ID:Alex-the-666,项目名称:It-s-About-Time-Minecraft-Mod,代码行数:15,代码来源:EntityIatMob.java

示例7: EntityAIMate

import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
public EntityAIMate(EntityAnimal animal, double speedIn)
{
    this(animal, speedIn, animal.getClass());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:EntityAIMate.java

示例8: peacefulAnimal

import net.minecraft.entity.passive.EntityAnimal; //导入方法依赖的package包/类
public boolean peacefulAnimal(EntityAnimal animal) {
	Class thing = animal.getClass();
	return thing == EntityPig.class || thing == EntityCow.class
			|| thing == EntityChicken.class || thing == EntitySheep.class
			|| thing == EntityMooshroom.class;
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:7,代码来源:EntityFairy.java


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