本文整理汇总了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;
}
示例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;
}
示例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"));
}
示例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);
}
示例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);
}
示例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();
}