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


Java PotionHelper類代碼示例

本文整理匯總了Java中net.minecraft.potion.PotionHelper的典型用法代碼示例。如果您正苦於以下問題:Java PotionHelper類的具體用法?Java PotionHelper怎麽用?Java PotionHelper使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: updatePotionMetadata

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
/**
 * Clears potion metadata values if the entity has no potion effects. Otherwise, updates potion effect color,
 * ambience, and invisibility metadata values
 */
protected void updatePotionMetadata()
{
    if (this.activePotionsMap.isEmpty())
    {
        this.resetPotionEffectMetadata();
        this.setInvisible(false);
    }
    else
    {
        int i = PotionHelper.calcPotionLiquidColor(this.activePotionsMap.values());
        this.dataWatcher.updateObject(8, Byte.valueOf((byte)(PotionHelper.getAreAmbient(this.activePotionsMap.values()) ? 1 : 0)));
        this.dataWatcher.updateObject(7, Integer.valueOf(i));
        this.setInvisible(this.isPotionActive(Potion.invisibility.id));
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:20,代碼來源:EntityLivingBase.java

示例2: RabbitFoot

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
@SuppressWarnings("unchecked")
public RabbitFoot() {
	setTextureName("rabbit_foot");
	setUnlocalizedName(Utils.getUnlocalisedName("rabbit_foot"));
	setCreativeTab(EtFuturum.enableRabbit ? EtFuturum.creativeTab : null);

	if (EtFuturum.enableRabbit)
		try {
			Field f = ReflectionHelper.findField(PotionHelper.class, "potionRequirements", "field_77927_l");
			f.setAccessible(true);
			HashMap<Integer, String> potionRequirements = (HashMap<Integer, String>) f.get(null);
			potionRequirements.put(Potion.jump.getId(), "0 & 1 & !2 & 3");

			Field f2 = ReflectionHelper.findField(PotionHelper.class, "potionAmplifiers", "field_77928_m");
			f2.setAccessible(true);
			HashMap<Integer, String> potionAmplifiers = (HashMap<Integer, String>) f2.get(null);
			potionAmplifiers.put(Potion.jump.getId(), "5");

			Field f3 = ReflectionHelper.findField(Potion.class, "liquidColor", "field_76414_N");
			f3.setAccessible(true);
			f3.set(Potion.jump, 0x22FF4C);
		} catch (Exception e) {
		}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:25,代碼來源:RabbitFoot.java

示例3: getItemStackDisplayName

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
@Override
public String getItemStackDisplayName(ItemStack stack) {
	if (stack.getItemDamage() == 0)
		return StatCollector.translateToLocal("item.emptyPotion.name").trim();
	else {
		String s = StatCollector.translateToLocal("potion.prefix.lingering").trim() + " ";

		List<PotionEffect> list = getEffects(stack);
		String s1;

		if (list != null && !list.isEmpty()) {
			s1 = list.get(0).getEffectName();
			s1 = s1 + ".postfix";
			return s + StatCollector.translateToLocal(s1).trim();
		} else {
			s1 = PotionHelper.func_77905_c(stack.getItemDamage());
			return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack);
		}
	}
}
 
開發者ID:jm-organization,項目名稱:connor41-etfuturum2,代碼行數:21,代碼來源:LingeringPotion.java

示例4: register

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
/**
 * Registers blocks, items, stats, etc.
 */
public static void register()
{
    if (!alreadyRegistered)
    {
        alreadyRegistered = true;
        redirectOutputToLog();
        SoundEvent.registerSounds();
        Block.registerBlocks();
        BlockFire.init();
        Potion.registerPotions();
        Enchantment.registerEnchantments();
        Item.registerItems();
        PotionType.registerPotionTypes();
        PotionHelper.init();
        EntityList.init();
        StatList.init();
        Biome.registerBiomes();
        registerDispenserBehaviors();
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:24,代碼來源:Bootstrap.java

示例5: getOutput

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
/**
 * Code copied from TileEntityBrewingStand.brewPotions()
 * It brews the potion by doing the bit-shifting magic and then checking if the new PotionEffect list is different to the old one,
 * or if the new potion is a splash potion when the old one wasn't.
 */
@Override
public ItemStack getOutput(ItemStack input, ItemStack ingredient)
{
    if (ingredient != null && input != null && isIngredient(ingredient))
    {
        ItemStack result = PotionHelper.doReaction(ingredient, input);
        if (result != input)
        {
            return result;
        }
        return null;
    }

    return null;
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:21,代碼來源:VanillaBrewingRecipe.java

示例6: register

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
/**
 * Registers blocks, items, stats, etc.
 */
public static void register()
{
    if (!alreadyRegistered)
    {
        alreadyRegistered = true;

        if (LOGGER.isDebugEnabled())
        {
            redirectOutputToLog();
        }

        SoundEvent.registerSounds();
        Block.registerBlocks();
        BlockFire.init();
        Potion.registerPotions();
        Enchantment.registerEnchantments();
        Item.registerItems();
        PotionType.registerPotionTypes();
        PotionHelper.init();
        StatList.init();
        Biome.registerBiomes();
        registerDispenserBehaviors();
        net.minecraftforge.fml.common.registry.GameData.vanillaSnapshot();
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:29,代碼來源:Bootstrap.java

示例7: registerPotionTypes

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
@SubscribeEvent
public static void registerPotionTypes(final RegistryEvent.Register<PotionType> event) {
    event.getRegistry().registerAll(PURIFICATION_TYPE, RUST_TYPE, BONE_SKIN_TYPE, RECALL_TYPE, BURNING_TYPE, BLEEDING_TYPE,
            INFERNO_TYPE);
    event.getRegistry().registerAll(HUNGER_TYPE, BLINDNESS_TYPE, NAUSEA_TYPE, RESISTANCE_TYPE, LEVITATION_TYPE);

    PotionHelper.addMix(PotionTypes.AWKWARD, GSItem.TOXIC_SLIME, RUST_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.GOLDEN_KOI.ordinal())), PURIFICATION_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.BONE_FISH.ordinal())), BONE_SKIN_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.SPECULAR_FISH.ordinal())), RECALL_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.MAGMA_JELLYFISH.ordinal())), BURNING_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.PIRANHA.ordinal())), BLEEDING_TYPE);
    PotionHelper.addMix(BURNING_TYPE, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.FLAREFIN_KOI.ordinal())), INFERNO_TYPE);

    // vanilla potions
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(Items.FISH, 1, 2)), PotionType.getPotionTypeForName("luck"));
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(Items.ROTTEN_FLESH, 1)), HUNGER_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.BLUE_JELLYFISH.ordinal())), NAUSEA_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.SPOOKYFIN.ordinal())), BLINDNESS_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.CAVEFISH.ordinal())), RESISTANCE_TYPE);
    PotionHelper.addMix(PotionTypes.AWKWARD, Ingredient.fromStacks(new ItemStack(GSItem.FISH, 1, ItemFish.EnumFishType.CHORUS_KOI.ordinal())), LEVITATION_TYPE);
}
 
開發者ID:NightKosh,項目名稱:Gravestone-mod-Extended,代碼行數:23,代碼來源:GSPotion.java

示例8: registerPotion

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public void registerPotion(){
	try{
		Class potHepler = PotionHelper.class;
		Field potFields[] = potHepler.getDeclaredFields();
		Field mods;
		mods = Field.class.getDeclaredField("modifiers");
		mods.setAccessible(true);
		for(Field f : potFields){
			if(f.getName() == "potionRequirements" || f.getName() == "field_77927_l"){
				mods.setInt(f, f.getModifiers() & ~Modifier.FINAL);
				f.setAccessible(true);
				final HashMap<Integer,String> newReq = (HashMap<Integer,String>)((HashMap<Integer,String>)f.get(null)).clone();
				newReq.put(HackeryMod.config.idEffectGlitch, HackeryMod.config.gfPotionReq);
				f.set(null, newReq);
			}
		}
	}catch (Exception e){
		HackeryMod.logger.error("Something went wrong while registering potions!");
		e.printStackTrace();
	}
	
}
 
開發者ID:KJ4IPS,項目名稱:Hackery,代碼行數:23,代碼來源:GlitchPowder.java

示例9: func_77832_l

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public List func_77832_l(ItemStack p_77832_1_) {
   if(p_77832_1_.func_77942_o() && p_77832_1_.func_77978_p().func_74764_b("CustomPotionEffects")) {
      ArrayList var6 = new ArrayList();
      NBTTagList var3 = p_77832_1_.func_77978_p().func_74761_m("CustomPotionEffects");

      for(int var4 = 0; var4 < var3.func_74745_c(); ++var4) {
         NBTTagCompound var5 = (NBTTagCompound)var3.func_74743_b(var4);
         var6.add(PotionEffect.func_82722_b(var5));
      }

      return var6;
   } else {
      List var2 = (List)this.field_77836_a.get(Integer.valueOf(p_77832_1_.func_77960_j()));
      if(var2 == null) {
         var2 = PotionHelper.func_77917_b(p_77832_1_.func_77960_j(), false);
         this.field_77836_a.put(Integer.valueOf(p_77832_1_.func_77960_j()), var2);
      }

      return var2;
   }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:22,代碼來源:ItemPotion.java

示例10: func_77628_j

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public String func_77628_j(ItemStack p_77628_1_) {
   if(p_77628_1_.func_77960_j() == 0) {
      return StatCollector.func_74838_a("item.emptyPotion.name").trim();
   } else {
      String var2 = "";
      if(func_77831_g(p_77628_1_.func_77960_j())) {
         var2 = StatCollector.func_74838_a("potion.prefix.grenade").trim() + " ";
      }

      List var3 = Item.field_77726_bs.func_77832_l(p_77628_1_);
      String var4;
      if(var3 != null && !var3.isEmpty()) {
         var4 = ((PotionEffect)var3.get(0)).func_76453_d();
         var4 = var4 + ".postfix";
         return var2 + StatCollector.func_74838_a(var4).trim();
      } else {
         var4 = PotionHelper.func_77905_c(p_77628_1_.func_77960_j());
         return StatCollector.func_74838_a(var4).trim() + " " + super.func_77628_j(p_77628_1_);
      }
   }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:22,代碼來源:ItemPotion.java

示例11: func_76986_a

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public void func_76986_a(Entity p_76986_1_, double p_76986_2_, double p_76986_4_, double p_76986_6_, float p_76986_8_, float p_76986_9_) {
   Icon var10 = this.field_94151_a.func_77617_a(this.field_94150_f);
   if(var10 != null) {
      GL11.glPushMatrix();
      GL11.glTranslatef((float)p_76986_2_, (float)p_76986_4_, (float)p_76986_6_);
      GL11.glEnable('\u803a');
      GL11.glScalef(0.5F, 0.5F, 0.5F);
      this.func_110777_b(p_76986_1_);
      Tessellator var11 = Tessellator.field_78398_a;
      if(var10 == ItemPotion.func_94589_d("bottle_splash")) {
         int var12 = PotionHelper.func_77915_a(((EntityPotion)p_76986_1_).func_70196_i(), false);
         float var13 = (float)(var12 >> 16 & 255) / 255.0F;
         float var14 = (float)(var12 >> 8 & 255) / 255.0F;
         float var15 = (float)(var12 & 255) / 255.0F;
         GL11.glColor3f(var13, var14, var15);
         GL11.glPushMatrix();
         this.func_77026_a(var11, ItemPotion.func_94589_d("overlay"));
         GL11.glPopMatrix();
         GL11.glColor3f(1.0F, 1.0F, 1.0F);
      }

      this.func_77026_a(var11, var10);
      GL11.glDisable('\u803a');
      GL11.glPopMatrix();
   }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:27,代碼來源:RenderSnowball.java

示例12: convertVanilla

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public static int convertVanilla(int damage) {
	final List l = PotionHelper.getPotionEffects(damage, false);
	if (l != null && !l.isEmpty()) {
		final PotionEffect p = (PotionEffect) l.get(0);
		final Potion what = Potion.potionTypes[p.getPotionID()];
		if ((what.isInstant() && p.getAmplifier() >= 1)
				|| (p.getDuration() >= (int) (9600 * what.getEffectiveness()))) {
			for (int i = 0; i < validPotions.size(); ++i) {
				if (validPotions.get(i).id == what.id)
					return freshEffect(i);
			}
		}

	}
	return -1;
}
 
開發者ID:TheDaemoness,項目名稱:IceAndShadow2,代碼行數:17,代碼來源:NyxItemPotion.java

示例13: doRender

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
@Override
public void doRender(Entity par1, double par2, double par4, double par6, float par8, float par9) {
	GL11.glPushMatrix();
	GL11.glTranslatef((float) par2, (float) par4, (float) par6);
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	GL11.glScalef(0.5F, 0.5F, 0.5F);
	this.loadTexture(AmitReference.Sprites.ITEMS_PATH + "thorshammer.png");
	Tessellator var10 = Tessellator.instance;

	if (this.iconIndex == 154) {
		int var11 = PotionHelper.func_77915_a(((EntityPotion) par1).getPotionDamage(), false);
		float var12 = (var11 >> 16 & 255) / 255.0F;
		float var13 = (var11 >> 8 & 255) / 255.0F;
		float var14 = (var11 & 255) / 255.0F;
		GL11.glColor3f(var12, var13, var14);
		GL11.glPushMatrix();
		this.func_77026_a(var10, 141);
		GL11.glPopMatrix();
		GL11.glColor3f(1.0F, 1.0F, 1.0F);
	}

	this.func_77026_a(var10, this.iconIndex);
	GL11.glDisable(GL12.GL_RESCALE_NORMAL);
	GL11.glPopMatrix();
}
 
開發者ID:DrDew2,項目名稱:Amitcraft,代碼行數:26,代碼來源:RenderThorsHammer.java

示例14: getEffects

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public List<PotionEffect> getEffects(ItemStack stack)
{
    if (stack.hasTagCompound() && stack.getTagCompound().hasKey("CustomPotionEffects", 9))
    {
        List<PotionEffect> list1 = Lists.<PotionEffect>newArrayList();
        NBTTagList nbttaglist = stack.getTagCompound().getTagList("CustomPotionEffects", 10);

        for (int i = 0; i < nbttaglist.tagCount(); ++i)
        {
            NBTTagCompound nbttagcompound = nbttaglist.getCompoundTagAt(i);
            PotionEffect potioneffect = PotionEffect.readCustomPotionEffectFromNBT(nbttagcompound);

            if (potioneffect != null)
            {
                list1.add(potioneffect);
            }
        }

        return list1;
    }
    else
    {
        List<PotionEffect> list = (List)this.effectCache.get(Integer.valueOf(stack.getMetadata()));

        if (list == null)
        {
            list = PotionHelper.getPotionEffects(stack.getMetadata(), false);
            this.effectCache.put(Integer.valueOf(stack.getMetadata()), list);
        }

        return list;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:34,代碼來源:ItemPotion.java

示例15: getItemStackDisplayName

import net.minecraft.potion.PotionHelper; //導入依賴的package包/類
public String getItemStackDisplayName(ItemStack stack)
{
    if (stack.getMetadata() == 0)
    {
        return StatCollector.translateToLocal("item.emptyPotion.name").trim();
    }
    else
    {
        String s = "";

        if (isSplash(stack.getMetadata()))
        {
            s = StatCollector.translateToLocal("potion.prefix.grenade").trim() + " ";
        }

        List<PotionEffect> list = Items.potionitem.getEffects(stack);

        if (list != null && !list.isEmpty())
        {
            String s2 = ((PotionEffect)list.get(0)).getEffectName();
            s2 = s2 + ".postfix";
            return s + StatCollector.translateToLocal(s2).trim();
        }
        else
        {
            String s1 = PotionHelper.getPotionPrefix(stack.getMetadata());
            return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack);
        }
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:31,代碼來源:ItemPotion.java


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