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


Java ItemFood.isWolfsFavoriteMeat方法代碼示例

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


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

示例1: onBlockActivated

import net.minecraft.item.ItemFood; //導入方法依賴的package包/類
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i1, float f1, float f2, float f3) {
    ItemStack itemstack = player.inventory.getCurrentItem();
    TileEntityDogBowl tile = (TileEntityDogBowl) world.getBlockTileEntity(x, y, z);
    
    if (!world.isRemote && tile != null && itemstack != null && itemstack.getItem() instanceof ItemFood)
    {
        ItemFood food = (ItemFood) itemstack.getItem();
        if (food.isWolfsFavoriteMeat() && tile.canPutFood()) 
        {
            tile.addFood(food.getHealAmount());
            if(!player.capabilities.isCreativeMode)
            itemstack.stackSize--;
            player.swingItem();
            return true;
        }
    }
    return false;
}
 
開發者ID:TheAwesomeGem,項目名稱:MineFantasy,代碼行數:20,代碼來源:BlockDogBowl.java

示例2: changeFoodValue

import net.minecraft.item.ItemFood; //導入方法依賴的package包/類
@Override
public int changeFoodValue(EntityZertumEntity dog, ItemStack stack, int foodValue) {
	int level = dog.talents.getLevel(this);
	if (foodValue == 0) {
		if ((stack.getItem() == Items.fish || stack.getItem() == Items.cooked_fish) && level == 5) {
			foodValue = 30 + 3 * level;
		}

		if (stack.getItem() == Items.rotten_flesh && level >= 3) {
			foodValue = 30 + 3 * level;
		}

		if (dog instanceof EntityForisZertum) {
			if ((stack.getItem() == Items.reeds || stack.getItem() == Items.baked_potato || stack.getItem() == Items.potato || stack.getItem() == Items.wheat || stack.getItem() == Items.wheat_seeds || stack.getItem() == Items.carrot || stack.getItem() == Items.melon || stack.getItem() == Items.melon_seeds || stack.getItem() == Items.pumpkin_pie || stack.getItem() == Items.pumpkin_seeds || stack.getItem() == Items.speckled_melon || stack.getItem() == Items.apple || stack.getItem() == Items.golden_apple || stack.getItem() == ModItems.vitoidFruit)) {
				foodValue = 30 + 3 * level;
			}
		}
		if (dog instanceof EntityDarkZertum) {
			if ((stack.getItem() == ModItems.kurrSeeds)) {
				foodValue = 30 + 3 * level;
			}
		}
		if (dog instanceof EntityMetalZertum) {
			if ((stack.getItem() == Items.gunpowder)) {
				foodValue = 30 + 3 * level;
			}
		}
	}
	else {
		if (stack.getItem() != Items.rotten_flesh && stack.getItem() instanceof ItemFood) {
			ItemFood itemfood = (ItemFood) stack.getItem();

			if (itemfood.isWolfsFavoriteMeat()) {
				foodValue += 4 * level;
			}
		}
	}
	return foodValue;
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:40,代碼來源:BodyMuncher.java

示例3: process

import net.minecraft.item.ItemFood; //導入方法依賴的package包/類
@Override
public void process(List<String> list, ItemStack stack) {
	if (stack.getItem() instanceof ItemFood) {
		ItemFood food = (ItemFood) stack.getItem();
		list.add(StatCollector.translateToLocal("smartcursor.item.healAmount") + food.func_150905_g(stack));
		if (food.isWolfsFavoriteMeat()) list.add(StatCollector.translateToLocal("smartcursor.item.wolfsMeat"));
	}
	if (stack.getItem().isPotionIngredient(stack)) list.add(StatCollector.translateToLocal("smartcursor.item.useInPotions"));
}
 
開發者ID:asaskevich,項目名稱:SmartCursor,代碼行數:10,代碼來源:ItemFoodModule.java

示例4: processInteract

import net.minecraft.item.ItemFood; //導入方法依賴的package包/類
public boolean processInteract(EntityPlayer player, EnumHand hand)
{
    ItemStack itemstack = player.getHeldItem(hand);

    if (this.isTamed())
    {
        if (!itemstack.func_190926_b())
        {
            if (itemstack.getItem() instanceof ItemFood)
            {
                ItemFood itemfood = (ItemFood)itemstack.getItem();

                if (itemfood.isWolfsFavoriteMeat() && ((Float)this.dataManager.get(DATA_HEALTH_ID)).floatValue() < 20.0F)
                {
                    if (!player.capabilities.isCreativeMode)
                    {
                        itemstack.func_190918_g(1);
                    }

                    this.heal((float)itemfood.getHealAmount(itemstack));
                    return true;
                }
            }
            else if (itemstack.getItem() == Items.DYE)
            {
                EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(itemstack.getMetadata());

                if (enumdyecolor != this.getCollarColor())
                {
                    this.setCollarColor(enumdyecolor);

                    if (!player.capabilities.isCreativeMode)
                    {
                        itemstack.func_190918_g(1);
                    }

                    return true;
                }
            }
        }

        if (this.isOwner(player) && !this.world.isRemote && !this.isBreedingItem(itemstack))
        {
            this.aiSit.setSitting(!this.isSitting());
            this.isJumping = false;
            this.navigator.clearPathEntity();
            this.setAttackTarget((EntityLivingBase)null);
        }
    }
    else if (itemstack.getItem() == Items.BONE && !this.isAngry())
    {
        if (!player.capabilities.isCreativeMode)
        {
            itemstack.func_190918_g(1);
        }

        if (!this.world.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.navigator.clearPathEntity();
                this.setAttackTarget((EntityLivingBase)null);
                this.aiSit.setSitting(true);
                this.setHealth(20.0F);
                this.setOwnerId(player.getUniqueID());
                this.playTameEffect(true);
                this.world.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.world.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.processInteract(player, hand);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:82,代碼來源:EntityWolf.java

示例5: processInteract

import net.minecraft.item.ItemFood; //導入方法依賴的package包/類
public boolean processInteract(EntityPlayer player, EnumHand hand, @Nullable ItemStack stack)
{
    if (this.isTamed())
    {
        if (stack != null)
        {
            if (stack.getItem() instanceof ItemFood)
            {
                ItemFood itemfood = (ItemFood)stack.getItem();

                if (itemfood.isWolfsFavoriteMeat() && ((Float)this.dataManager.get(DATA_HEALTH_ID)).floatValue() < 20.0F)
                {
                    if (!player.capabilities.isCreativeMode)
                    {
                        --stack.stackSize;
                    }

                    this.heal((float)itemfood.getHealAmount(stack));
                    return true;
                }
            }
            else if (stack.getItem() == Items.DYE)
            {
                EnumDyeColor enumdyecolor = EnumDyeColor.byDyeDamage(stack.getMetadata());

                if (enumdyecolor != this.getCollarColor())
                {
                    this.setCollarColor(enumdyecolor);

                    if (!player.capabilities.isCreativeMode)
                    {
                        --stack.stackSize;
                    }

                    return true;
                }
            }
        }

        if (this.isOwner(player) && !this.worldObj.isRemote && !this.isBreedingItem(stack))
        {
            this.aiSit.setSitting(!this.isSitting());
            this.isJumping = false;
            this.navigator.clearPathEntity();
            this.setAttackTarget((EntityLivingBase)null);
        }
    }
    else if (stack != null && stack.getItem() == Items.BONE && !this.isAngry())
    {
        if (!player.capabilities.isCreativeMode)
        {
            --stack.stackSize;
        }

        if (!this.worldObj.isRemote)
        {
            if (this.rand.nextInt(3) == 0)
            {
                this.setTamed(true);
                this.navigator.clearPathEntity();
                this.setAttackTarget((EntityLivingBase)null);
                this.aiSit.setSitting(true);
                this.setHealth(20.0F);
                this.setOwnerId(player.getUniqueID());
                this.playTameEffect(true);
                this.worldObj.setEntityState(this, (byte)7);
            }
            else
            {
                this.playTameEffect(false);
                this.worldObj.setEntityState(this, (byte)6);
            }
        }

        return true;
    }

    return super.processInteract(player, hand, stack);
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:80,代碼來源:EntityWolf.java

示例6: willEatFood

import net.minecraft.item.ItemFood; //導入方法依賴的package包/類
/**
 * If the hound will eat a food, normally: this is only meat, but if the hound is half hunger
 * it will eat any food
 */
private boolean willEatFood(ItemFood food) 
{
	return food.isWolfsFavoriteMeat() || getHunger() < getLowHunger();
}
 
開發者ID:TheAwesomeGem,項目名稱:MineFantasy,代碼行數:9,代碼來源:EntityHound.java


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