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


Java PotionType.getEffects方法代码示例

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


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

示例1: getColorFromPotion

import net.minecraft.potion.PotionType; //导入方法依赖的package包/类
public static Vector3f getColorFromPotion(PotionType type){
	if (type.getEffects().isEmpty())
	{
		return null;
	}
	else
	{
		float f = 0.0F;
		float f1 = 0.0F;
		float f2 = 0.0F;
		int j = 0;

		for (PotionEffect potioneffect : type.getEffects())
		{
			if (potioneffect.doesShowParticles())
			{
				int k = potioneffect.getPotion().getLiquidColor();
				int l = potioneffect.getAmplifier() + 1;
				f += l * (k >> 16 & 255) / 255.0F;
				f1 += l * (k >> 8 & 255) / 255.0F;
				f2 += l * (k >> 0 & 255) / 255.0F;
				j += l;
			}
		}

		if (j == 0)
		{
			return new Vector3f(0, 0, 0);
		}
		else
		{
			f = f / j * 255.0F;
			f1 = f1 / j * 255.0F;
			f2 = f2 / j * 255.0F;
			return new Vector3f(f, f1, f2);
		}
	}
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:39,代码来源:RenderTileJar.java

示例2: loadPotionSubsets

import net.minecraft.potion.PotionType; //导入方法依赖的package包/类
public static void loadPotionSubsets() {
    ArrayList<ItemStack> allPotions = new ArrayList<>();
    for (IPotionRecipe recipe : PotionRecipeHelper.getRecipes()) {
        allPotions.add(recipe.getRecipeOutput());
    }

    ItemStackSet positiveEffects = new ItemStackSet();
    ItemStackSet negativeEffects = new ItemStackSet();
    ItemStackSet neutralEffects = new ItemStackSet();
    for (ItemStack potionStack : allPotions) {
        PotionType potionType = PotionRecipeHelper.getPotionTypeFromStack(potionStack);
        if (potionType == null) {
            continue;
        }
        List<PotionEffect> stackEffects = potionType.getEffects();
        if (stackEffects.isEmpty()) {
            neutralEffects.add(potionStack);
            continue;
        }
        for (PotionEffect effect : stackEffects) {
            //If for some reason a vanilla potion has positive and negative effects, make sure we don't add it to the list more than once.
            if (effect.getPotion().isBadEffect()) {
                if (!negativeEffects.contains(potionStack)) {
                    negativeEffects.add(potionStack);
                }
            } else {
                if (!positiveEffects.contains(potionStack)) {
                    positiveEffects.add(potionStack);
                }
            }
        }
    }

    API.addSubset("Items.Potions", new ItemStackSet().with(Items.POTIONITEM).with(Items.SPLASH_POTION).with(Items.LINGERING_POTION));
    API.addSubset("Items.Potions.Splash", new ItemStackSet().with(Items.SPLASH_POTION));
    API.addSubset("Items.Potions.Lingering", new ItemStackSet().with(Items.LINGERING_POTION));
    API.addSubset("Items.Potions.Positive", positiveEffects);
    API.addSubset("Items.Potions.Negative", negativeEffects);
    API.addSubset("Items.Potions.Neutral", neutralEffects);
}
 
开发者ID:TheCBProject,项目名称:NotEnoughItems,代码行数:41,代码来源:NEIInitialization.java

示例3: addInformation

import net.minecraft.potion.PotionType; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
   public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
   {
	if(ItemNBTHelper.verifyExistance(stack, TILE_NBT_STACK)){
		NBTTagCompound tileNBT = ItemNBTHelper.getCompound(stack).getCompoundTag(TILE_NBT_STACK);
		if(tileNBT.getBoolean("IsShulker")){
			tooltip.add(Lang.localize("tooltip.jar.shulker"));
		}
		if(tileNBT.hasKey("Potion")){
			PotionType type = PotionUtils.getPotionTypeFromNBT(tileNBT);
			if(type !=PotionTypes.EMPTY){
				for (PotionEffect potioneffect : type.getEffects())
	            {
	                String s1 = I18n.translateToLocal(potioneffect.getEffectName()).trim();
	                Potion potion = potioneffect.getPotion();

	                if (potioneffect.getAmplifier() > 0)
	                {
	                    s1 = s1 + " " + I18n.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
	                }

	                if (potioneffect.getDuration() > 20)
	                {
	                    s1 = s1 + " (" + Potion.getPotionDurationString(potioneffect, 1.0F) + ")";
	                }

	                if (potion.isBadEffect())
	                {
	                    tooltip.add(TextFormatting.RED + s1);
	                }
	                else
	                {
	                	tooltip.add(TextFormatting.BLUE + s1);
	                }
	            }
				tooltip.add(Lang.localizeFormat("tooltip.jar.contains", new Object[]{""+tileNBT.getInteger("Count"), "3"}));
			}
		}
	}
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:42,代码来源:BlockJar.java


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