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


Java EntityAgeable.isChild方法代碼示例

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


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

示例1: work

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

    AxisAlignedBB area = getWorkingArea();
    List<EntityAgeable> animals = this.world.getEntitiesWithinAABB(EntityAgeable.class, area);
    int totalFluidAdded = 0;
    for (EntityAgeable animal : animals) {
        int toFill = animal.isChild() ? BlockRegistry.animalByproductRecolectorBlock.getSewageBaby() : BlockRegistry.animalByproductRecolectorBlock.getSewageAdult();
        tank.fill(new FluidStack(FluidsRegistry.SEWAGE, toFill), true);
        totalFluidAdded += toFill;
        if (totalFluidAdded > ((AnimalByproductRecolectorBlock) this.getBlockType()).getMaxSludgeOperation()) {
            break;
        }
    }

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

示例2: work

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

    AxisAlignedBB area = getWorkingArea();
    List<EntityAgeable> animals = this.world.getEntitiesWithinAABB(EntityAgeable.class, area);
    if (animals.size() == 0) return 0;
    EntityAgeable animal = animals.get(0);
    while (animal.isChild() == this.hasAddon(AdultFilterAddonItem.class) && animals.indexOf(animal) + 1 < animals.size())
        animal = animals.get(animals.indexOf(animal) + 1);
    if (animal.isChild() == this.hasAddon(AdultFilterAddonItem.class)) return 0;
    BlockPos pos = this.getPos().offset(this.getFacing(), 1);
    animal.setPositionAndUpdate(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
    return 1;
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:16,代碼來源:AnimalIndependenceSelectorTile.java

示例3: doTheZorroThing

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
@SubscribeEvent
public void doTheZorroThing(EntityInteractEvent event) {
    EntityPlayer player = event.entityPlayer;
    if (player.worldObj.isRemote) return;
    if (player.isRiding()) return;
    if (!(event.target instanceof EntityHorse)) return;
    EntityHorse horse = (EntityHorse) event.target;
    if (player.fallDistance <= 2) return;
    if (!horse.isHorseSaddled()) return;
    if (horse.getLeashed()) {
        if (!(horse.getLeashedToEntity() instanceof EntityLeashKnot)) return;
        horse.getLeashedToEntity().interactFirst(player);
    }
    boolean awesome = false;
    if (player.fallDistance > 5 && player.getHeldItem() != null) {
        Item held = player.getHeldItem().getItem();
        boolean has_baby = false;
        if (player.riddenByEntity instanceof EntityAgeable) {
            EntityAgeable ea = (EntityAgeable) player.riddenByEntity;
            has_baby = ea.isChild();
        }
        awesome = held instanceof ItemSword || held instanceof ItemAxe || held instanceof ItemBow || player.riddenByEntity instanceof EntityPlayer || has_baby;
    }
    if (awesome) {
        horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 40, 2, false, false));
        horse.addPotionEffect(new PotionEffect(Potion.resistance.id, 20 * 40, 1, true, true));
        horse.addPotionEffect(new PotionEffect(Potion.jump.id, 20 * 40, 1, true, true));
    } else {
        horse.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 20 * 8, 1, false, false));
    }
    horse.playLivingSound();
}
 
開發者ID:purpleposeidon,項目名稱:Factorization,代碼行數:33,代碼來源:MiscellaneousNonsense.java

示例4: entitySpawnEgg

import net.minecraft.entity.EntityAgeable; //導入方法依賴的package包/類
public static void entitySpawnEgg(EntityPlayer entityPlayer, Entity target) 
	{
		int entity_id = 0;
	
		//DO NOT USE = target.getEntityId();. that is the runtime id, so each instance of EntityCow has its own RUNTIME id
		//different than the class level id which we need here
 
		if( target instanceof EntityHorse ||
			target instanceof EntityWolf)
		{
			return;//these are Ageable, but disabled.
		}
 
		if(target instanceof EntitySquid) 
		{  
			entity_id = Reference.entity_squid;
		} 
		else if(target instanceof EntityBat) 
		{  
			entity_id = Reference.entity_bat;
		} 
		else if(target instanceof EntityAgeable )  
		{ 
			EntityAgeable targ = (EntityAgeable) target;
			//these guys all extend EntityAnimal extends EntityAgeable implements IAnimals
			if(targ.isChild() == false)
			{
				if(target instanceof EntityCow )
				{ 
					entity_id = Reference.entity_cow; 
				}
				if(target instanceof EntityPig )
				{ 
					entity_id = Reference.entity_pig; 
				}
				if(target instanceof EntitySheep )
				{ 
					entity_id = Reference.entity_sheep; 
				} 
				if(target instanceof EntityChicken )
				{ 
					entity_id = Reference.entity_chicken; 
				} 
				if(target instanceof EntityMooshroom )
				{ 
					entity_id = Reference.entity_mooshroom; 
				}
				if(target instanceof EntityRabbit )
				{ 
					entity_id = Reference.entity_rabbit; 
				} 
			} 
		}
		
		if(entity_id > 0)
		{ 
			entityPlayer.swingItem();
			entityPlayer.worldObj.removeEntity(target); 
			
			if(entityPlayer.worldObj.isRemote) 
				ModSpells.spawnParticle(entityPlayer.worldObj, EnumParticleTypes.VILLAGER_HAPPY, target.getPosition());
			else
			{
				//TODO: 
				/*
				ItemStack stack = new ItemStack(ItemRegistry.respawn_egg,1,entity_id);
				
				if(target.hasCustomName())
					stack.setStackDisplayName(target.getCustomNameTag());
					
				entityPlayer.dropPlayerItemWithRandomChoice(stack,true);
*/
			}
			ModSpells.playSoundAt(entityPlayer, "mob.zombie.remedy");
			 
			//ModSpells.decrHeldStackSize(entityPlayer);
			
		} 
	}
 
開發者ID:PrinceOfAmber,項目名稱:SamsPowerups,代碼行數:80,代碼來源:ItemRespawnEggEmpty.java


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