當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。