当前位置: 首页>>代码示例>>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;未经允许,请勿转载。