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


Java EnumAction.DRINK屬性代碼示例

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


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

示例1: updateItemUse

/**
 * Plays sounds and makes particles for item in use state
 */
protected void updateItemUse(ItemStack itemStackIn, int p_71010_2_)
{
    if (itemStackIn.getItemUseAction() == EnumAction.DRINK)
    {
        this.playSound("random.drink", 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
    }

    if (itemStackIn.getItemUseAction() == EnumAction.EAT)
    {
        for (int i = 0; i < p_71010_2_; ++i)
        {
            Vec3 vec3 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
            vec3 = vec3.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
            vec3 = vec3.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
            double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
            Vec3 vec31 = new Vec3(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
            vec31 = vec31.rotatePitch(-this.rotationPitch * (float)Math.PI / 180.0F);
            vec31 = vec31.rotateYaw(-this.rotationYaw * (float)Math.PI / 180.0F);
            vec31 = vec31.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);

            if (itemStackIn.getHasSubtypes())
            {
                this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(itemStackIn.getItem()), itemStackIn.getMetadata()});
            }
            else
            {
                this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec31.xCoord, vec31.yCoord, vec31.zCoord, vec3.xCoord, vec3.yCoord + 0.05D, vec3.zCoord, new int[] {Item.getIdFromItem(itemStackIn.getItem())});
            }
        }

        this.playSound("random.eat", 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:36,代碼來源:EntityPlayer.java

示例2: getItemUseAction

@Override
public EnumAction getItemUseAction(ItemStack stack) {
	
	if (stack.getItem() == UCItems.potionreverse)
		return EnumAction.DRINK;
	
	return EnumAction.EAT;
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:8,代碼來源:ItemGenericFood.java

示例3: updateItemUse

/**
 * Plays sounds and makes particles for item in use state
 */
protected void updateItemUse(ItemStack stack, int eatingParticleCount)
{
    if (!stack.func_190926_b() && this.isHandActive())
    {
        if (stack.getItemUseAction() == EnumAction.DRINK)
        {
            this.playSound(SoundEvents.ENTITY_GENERIC_DRINK, 0.5F, this.world.rand.nextFloat() * 0.1F + 0.9F);
        }

        if (stack.getItemUseAction() == EnumAction.EAT)
        {
            for (int i = 0; i < eatingParticleCount; ++i)
            {
                Vec3d vec3d = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
                vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
                vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
                double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
                Vec3d vec3d1 = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
                vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
                vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
                vec3d1 = vec3d1.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);

                if (stack.getHasSubtypes())
                {
                    this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem()), stack.getMetadata()});
                }
                else
                {
                    this.world.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
                }
            }

            this.playSound(SoundEvents.ENTITY_GENERIC_EAT, 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
        }
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:39,代碼來源:EntityLivingBase.java

示例4: updateItemUse

/**
 * Plays sounds and makes particles for item in use state
 */
protected void updateItemUse(@Nullable ItemStack stack, int eatingParticleCount)
{
    if (stack != null && this.isHandActive())
    {
        if (stack.getItemUseAction() == EnumAction.DRINK)
        {
            this.playSound(SoundEvents.ENTITY_GENERIC_DRINK, 0.5F, this.worldObj.rand.nextFloat() * 0.1F + 0.9F);
        }

        if (stack.getItemUseAction() == EnumAction.EAT)
        {
            for (int i = 0; i < eatingParticleCount; ++i)
            {
                Vec3d vec3d = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.1D, Math.random() * 0.1D + 0.1D, 0.0D);
                vec3d = vec3d.rotatePitch(-this.rotationPitch * 0.017453292F);
                vec3d = vec3d.rotateYaw(-this.rotationYaw * 0.017453292F);
                double d0 = (double)(-this.rand.nextFloat()) * 0.6D - 0.3D;
                Vec3d vec3d1 = new Vec3d(((double)this.rand.nextFloat() - 0.5D) * 0.3D, d0, 0.6D);
                vec3d1 = vec3d1.rotatePitch(-this.rotationPitch * 0.017453292F);
                vec3d1 = vec3d1.rotateYaw(-this.rotationYaw * 0.017453292F);
                vec3d1 = vec3d1.addVector(this.posX, this.posY + (double)this.getEyeHeight(), this.posZ);

                if (stack.getHasSubtypes())
                {
                    this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem()), stack.getMetadata()});
                }
                else
                {
                    this.worldObj.spawnParticle(EnumParticleTypes.ITEM_CRACK, vec3d1.xCoord, vec3d1.yCoord, vec3d1.zCoord, vec3d.xCoord, vec3d.yCoord + 0.05D, vec3d.zCoord, new int[] {Item.getIdFromItem(stack.getItem())});
                }
            }

            this.playSound(SoundEvents.ENTITY_GENERIC_EAT, 0.5F + 0.5F * (float)this.rand.nextInt(2), (this.rand.nextFloat() - this.rand.nextFloat()) * 0.2F + 1.0F);
        }
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:39,代碼來源:EntityLivingBase.java

示例5: getItemUseAction

public EnumAction getItemUseAction(ItemStack itemstack)
{
	int meta = itemstack.getItemDamage();

	if (EnumSkyrootBucketType.getType(meta) != EnumSkyrootBucketType.Water)
	{
		return EnumAction.DRINK;
	}
	else
	{
		return EnumAction.NONE;
	}
}
 
開發者ID:Modding-Legacy,項目名稱:Aether-Legacy,代碼行數:13,代碼來源:ItemSkyrootBucket.java

示例6: getItemUseAction

@Override
public EnumAction getItemUseAction(ItemStack stack)
{
    return EnumAction.DRINK;
}
 
開發者ID:DaedalusGame,項目名稱:Soot,代碼行數:5,代碼來源:ItemMug.java

示例7: getItemUseAction

@Override
@Nonnull
public EnumAction getItemUseAction(ItemStack stack) {
    return EnumAction.DRINK;
}
 
開發者ID:Buuz135,項目名稱:Industrial-Foregoing,代碼行數:5,代碼來源:ItemStraw.java

示例8: getItemUseAction

@Override
public EnumAction getItemUseAction(ItemStack stack) {
	return EnumAction.DRINK;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:4,代碼來源:ItemBrewDrink.java

示例9: getItemUseAction

@Override
public EnumAction getItemUseAction(ItemStack stack) {
	return hasDrinkEffect(stack.getMetadata()) ? EnumAction.DRINK : EnumAction.NONE;
}
 
開發者ID:kenijey,項目名稱:harshencastle,代碼行數:4,代碼來源:GlassContainer.java

示例10: getItemUseAction

@Override
public EnumAction getItemUseAction(ItemStack stack){
	return EnumAction.DRINK;
}
 
開發者ID:elucent,項目名稱:SimplyTea,代碼行數:4,代碼來源:SimplyTea.java

示例11: getItemUseAction

@Nonnull
@Override
public EnumAction getItemUseAction(ItemStack stack) {
    return EnumAction.DRINK;
}
 
開發者ID:LasmGratel,項目名稱:FoodCraft-Reloaded,代碼行數:5,代碼來源:ItemDrink.java

示例12: getItemUseAction

@Override
public EnumAction getItemUseAction(ItemStack stack)
   {
       return EnumAction.DRINK;
   }
 
開發者ID:Alec-WAM,項目名稱:CrystalMod,代碼行數:5,代碼來源:ItemDrinkableEnderFluid.java

示例13: getItemUseAction

@Nonnull
@Override
public EnumAction getItemUseAction(ItemStack stack) {
	if (stack.getItemDamage() == 2) return EnumAction.DRINK;
	return EnumAction.NONE;
}
 
開發者ID:TeamWizardry,項目名稱:Wizardry,代碼行數:6,代碼來源:ItemJar.java

示例14: getItemUseAction

@Patch.Exception
@Hook("biomesoplenty.common.item.ItemJarFilled#func_77661_b")
public static Hook.Result getItemUseAction(ItemJarFilled item, ItemStack stack) {
	return item.getContentsType(stack) == JarContents.HONEY ? new Hook.Result(EnumAction.DRINK) : Hook.Result.VOID;
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:5,代碼來源:ExItemJarFilled.java

示例15: getItemUseAction

@Patch.Exception
@Hook("net.minecraft.item.ItemBucket#func_77661_b")
public static Hook.Result getItemUseAction(ItemBucket item, ItemStack stack) {
	return item == Items.LAVA_BUCKET ? new Hook.Result(EnumAction.DRINK) : Hook.Result.VOID;
}
 
開發者ID:NekoCaffeine,項目名稱:Alchemy,代碼行數:5,代碼來源:DrinkingLava.java


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