当前位置: 首页>>代码示例>>Java>>正文


Java Items.BONE属性代码示例

本文整理汇总了Java中net.minecraft.init.Items.BONE属性的典型用法代码示例。如果您正苦于以下问题:Java Items.BONE属性的具体用法?Java Items.BONE怎么用?Java Items.BONE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在net.minecraft.init.Items的用法示例。


在下文中一共展示了Items.BONE属性的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasPlayerGotBoneInHand

/**
 * Gets if the Player has the Bone in the hand.
 */
private boolean hasPlayerGotBoneInHand(EntityPlayer player)
{
    for (EnumHand enumhand : EnumHand.values())
    {
        ItemStack itemstack = player.getHeldItem(enumhand);

        if (this.theWolf.isTamed() && itemstack.getItem() == Items.BONE)
        {
            return true;
        }

        if (this.theWolf.isBreedingItem(itemstack))
        {
            return true;
        }
    }

    return false;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:22,代码来源:EntityAIBeg.java

示例2: hasPlayerGotBoneInHand

/**
 * Gets if the Player has the Bone in the hand.
 */
private boolean hasPlayerGotBoneInHand(EntityPlayer player)
{
    for (EnumHand enumhand : EnumHand.values())
    {
        ItemStack itemstack = player.getHeldItem(enumhand);

        if (itemstack != null)
        {
            if (this.theWolf.isTamed() && itemstack.getItem() == Items.BONE)
            {
                return true;
            }

            if (this.theWolf.isBreedingItem(itemstack))
            {
                return true;
            }
        }
    }

    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:25,代码来源:EntityAIBeg.java

示例3: getDrops

@SuppressWarnings("deprecation")
@Override
public List<ItemStack> getDrops(IBlockAccess world, BlockPos pos, IBlockState state, int fortune) {
	super.getDrops(world, pos, state, fortune);
	
	ItemStack bone = new ItemStack(Items.BONE);
	ArrayList<ItemStack> result = new ArrayList<>();
	result.add(bone);
	return result;
}
 
开发者ID:elytra,项目名称:ThermionicsWorld,代码行数:10,代码来源:BlockShrubBone.java

示例4: processInteract

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,代码行数:81,代码来源:EntityWolf.java

示例5: processInteract

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,代码行数:79,代码来源:EntityWolf.java


注:本文中的net.minecraft.init.Items.BONE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。