當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。