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


Java Potion.potionTypes方法代码示例

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


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

示例1: getPotionId

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
private static int getPotionId(String p_getPotionId_0_)
{
    if (p_getPotionId_0_.equals("potion.water"))
    {
        return 0;
    }
    else
    {
        Potion[] apotion = Potion.potionTypes;

        for (int i = 0; i < apotion.length; ++i)
        {
            Potion potion = apotion[i];

            if (potion != null && potion.getName().equals(p_getPotionId_0_))
            {
                return potion.getId();
            }
        }

        return -1;
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:24,代码来源:CustomColors.java

示例2: getPotionNameDamage

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
private static int getPotionNameDamage(String p_getPotionNameDamage_0_)
{
    String s = "potion." + p_getPotionNameDamage_0_;
    Potion[] apotion = Potion.potionTypes;

    for (int i = 0; i < apotion.length; ++i)
    {
        Potion potion = apotion[i];

        if (potion != null)
        {
            String s1 = potion.getName();

            if (s.equals(s1))
            {
                return potion.getId();
            }
        }
    }

    return -1;
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:23,代码来源:CustomItems.java

示例3: onInitialSpawn

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
/**
 * Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
 * when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
 */
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, IEntityLivingData livingdata)
{
    livingdata = super.onInitialSpawn(difficulty, livingdata);

    if (this.worldObj.rand.nextInt(100) == 0)
    {
        EntitySkeleton entityskeleton = new EntitySkeleton(this.worldObj);
        entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
        entityskeleton.onInitialSpawn(difficulty, (IEntityLivingData)null);
        this.worldObj.spawnEntityInWorld(entityskeleton);
        entityskeleton.mountEntity(this);
    }

    if (livingdata == null)
    {
        livingdata = new EntitySpider.GroupData();

        if (this.worldObj.getDifficulty() == EnumDifficulty.HARD && this.worldObj.rand.nextFloat() < 0.1F * difficulty.getClampedAdditionalDifficulty())
        {
            ((EntitySpider.GroupData)livingdata).func_111104_a(this.worldObj.rand);
        }
    }

    if (livingdata instanceof EntitySpider.GroupData)
    {
        int i = ((EntitySpider.GroupData)livingdata).potionEffectId;

        if (i > 0 && Potion.potionTypes[i] != null)
        {
            this.addPotionEffect(new PotionEffect(i, Integer.MAX_VALUE));
        }
    }

    return livingdata;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:40,代码来源:EntitySpider.java

示例4: func_183001_h

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
private int func_183001_h(int p_183001_1_)
{
    if (p_183001_1_ >= 0 && p_183001_1_ < Potion.potionTypes.length && Potion.potionTypes[p_183001_1_] != null)
    {
        Potion potion = Potion.potionTypes[p_183001_1_];
        return potion != Potion.moveSpeed && potion != Potion.digSpeed && potion != Potion.resistance && potion != Potion.jump && potion != Potion.damageBoost && potion != Potion.regeneration ? 0 : p_183001_1_;
    }
    else
    {
        return 0;
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:TileEntityBeacon.java

示例5: getUnlocalizedName

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@Override
public String getUnlocalizedName(ItemStack stack) {
	PotionEffect effect = getEffect(stack);
	if (effect == null || effect.getPotionID() < 0 || effect.getPotionID() >= Potion.potionTypes.length)
		return super.getUnlocalizedName(stack);

	Potion potion = Potion.potionTypes[effect.getPotionID()];
	return "tipped_arrow." + potion.getName();
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:10,代码来源:TippedArrow.java

示例6: drawActivePotionEffects

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
/**
 * Display the potion effects list
 */
private void drawActivePotionEffects()
{
    int i = this.guiLeft - 124;
    int j = this.guiTop;
    int k = 166;
    Collection<PotionEffect> collection = this.mc.thePlayer.getActivePotionEffects();

    if (!collection.isEmpty())
    {
        GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
        GlStateManager.disableLighting();
        int l = 33;

        if (collection.size() > 5)
        {
            l = 132 / (collection.size() - 1);
        }

        for (PotionEffect potioneffect : this.mc.thePlayer.getActivePotionEffects())
        {
            Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
            GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
            this.mc.getTextureManager().bindTexture(inventoryBackground);
            this.drawTexturedModalRect(i, j, 0, 166, 140, 32);

            if (potion.hasStatusIcon())
            {
                int i1 = potion.getStatusIconIndex();
                this.drawTexturedModalRect(i + 6, j + 7, 0 + i1 % 8 * 18, 198 + i1 / 8 * 18, 18, 18);
            }

            String s1 = I18n.format(potion.getName(), new Object[0]);

            if (potioneffect.getAmplifier() == 1)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.2", new Object[0]);
            }
            else if (potioneffect.getAmplifier() == 2)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.3", new Object[0]);
            }
            else if (potioneffect.getAmplifier() == 3)
            {
                s1 = s1 + " " + I18n.format("enchantment.level.4", new Object[0]);
            }

            this.fontRendererObj.drawStringWithShadow(s1, (float)(i + 10 + 18), (float)(j + 6), 16777215);
            String s = Potion.getDurationString(potioneffect);
            this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711);
            j += l;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:57,代码来源:InventoryEffectRenderer.java

示例7: onRender

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@EventTarget
public void onRender(EventRender2D e) {
	if (!client.getManagers().getManager(SettingManager.class).getSetting(HUD.class, "PotionEffect").getBooleanValue()) {

		int x = e.width - 20;
		for (PotionEffect p : Minecraft.getMinecraft().thePlayer.getActivePotionEffects()) {
			Potion potion = Potion.potionTypes[p.getPotionID()];
			GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
			if (potion.hasStatusIcon()) {
				RenderUtils.drawFullCircle(x + 5, e.height - 11, 10, ColorUtils.backColor);
				RenderUtils.drawCircle(x + 5, e.height - 11, 10, ColorUtils.arrayColor);
				GL11.glColor4f(1, 1, 1, 1);

				GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
				GlStateManager.disableLighting();

				int i1 = potion.getStatusIconIndex();
				GL11.glScalef((float) 0.8f, (float) 0.8f, (float) 0.8f);
				GlStateManager.enableBlend();
				GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
				Minecraft.getMinecraft().getTextureManager().bindTexture(inventoryBackground);
				Gui.drawTexturedModalRect1((int) (x * 1.25f) - 2, (int) (e.height * 1.25f) - 23, 0 + i1 % 8 * 18,
						198 + i1 / 8 * 18, 18, 18);
				GL11.glScalef((float) 1.25f, (float) 1.25f, (float) 1.25f);
				GlStateManager.disableBlend();

				int i = p.getDuration() / 20;
				int j = i / 60;
				i = i % 60;
				String time = (String) (i < 10 ? j + ":0" + i : j + ":" + i);

				arraylist.drawStringWithShadow(time, x - arraylist.getStringWidth(time) + 12,
						e.height - arraylist.getHeight() - 2, -1);
				if (p.getAmplifier() != 0)
				arraylist.drawStringWithShadow((p.getAmplifier() + 1) + "",
						x - arraylist.getStringWidth((p.getAmplifier() + 1) + "") + 7,
						e.height - arraylist.getHeight() - 13, -1);
			}

			if (Minecraft.getMinecraft().thePlayer.getActivePotionEffects().size() > 5)
				x -= 90 / (Minecraft.getMinecraft().thePlayer.getActivePotionEffects().size() - 1);
			else
				x -= 24;
		}
	}
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:47,代码来源:DrawPotions.java

示例8: isEffectValid

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
private boolean isEffectValid() {
	return effect != null && Potion.potionTypes[effect.getPotionID()] != null;
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:4,代码来源:EntityTippedArrow.java

示例9: addInformation

import net.minecraft.potion.Potion; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
@SuppressWarnings({ "rawtypes", "unchecked" })
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean isComplex) {
	if (stack.getItemDamage() == 0)
		return;

	List<PotionEffect> effects = getEffects(stack);
	HashMultimap<String, AttributeModifier> attributes = HashMultimap.create();

	if (effects == null || effects.isEmpty()) {
		String s = StatCollector.translateToLocal("potion.empty").trim();
		list.add(EnumChatFormatting.GRAY + s);
	} else
		for (PotionEffect potioneffect : effects) {
			String s1 = StatCollector.translateToLocal(potioneffect.getEffectName()).trim();
			Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
			Map<IAttribute, AttributeModifier> map = potion.func_111186_k();

			if (map != null && map.size() > 0)
				for (Entry<IAttribute, AttributeModifier> entry : map.entrySet()) {
					AttributeModifier attributemodifier = entry.getValue();
					AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.func_111183_a(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
					attributes.put(entry.getKey().getAttributeUnlocalizedName(), attributemodifier1);
				}

			if (potioneffect.getAmplifier() > 0)
				s1 = s1 + " " + StatCollector.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
			if (potioneffect.getDuration() > 20)
				s1 = s1 + " (" + Potion.getDurationString(potioneffect) + ")";

			if (potion.isBadEffect())
				list.add(EnumChatFormatting.RED + s1);
			else
				list.add(EnumChatFormatting.GRAY + s1);
		}

	if (!attributes.isEmpty()) {
		list.add("");
		list.add(EnumChatFormatting.DARK_PURPLE + StatCollector.translateToLocal("potion.effects.whenDrank"));

		for (Entry<String, AttributeModifier> entry1 : attributes.entries()) {
			AttributeModifier attributemodifier2 = entry1.getValue();
			double d0 = attributemodifier2.getAmount();
			double d1;

			if (attributemodifier2.getOperation() != 1 && attributemodifier2.getOperation() != 2)
				d1 = attributemodifier2.getAmount();
			else
				d1 = attributemodifier2.getAmount() * 100.0D;

			if (d0 > 0.0D)
				list.add(EnumChatFormatting.BLUE + StatCollector.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
			else if (d0 < 0.0D) {
				d1 *= -1.0D;
				list.add(EnumChatFormatting.RED + StatCollector.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), new Object[] { ItemStack.field_111284_a.format(d1), StatCollector.translateToLocal("attribute.name." + entry1.getKey()) }));
			}
		}
	}
}
 
开发者ID:jm-organization,项目名称:connor41-etfuturum2,代码行数:61,代码来源:LingeringPotion.java


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