本文整理匯總了Java中net.minecraft.potion.PotionEffect.getPotionID方法的典型用法代碼示例。如果您正苦於以下問題:Java PotionEffect.getPotionID方法的具體用法?Java PotionEffect.getPotionID怎麽用?Java PotionEffect.getPotionID使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.potion.PotionEffect
的用法示例。
在下文中一共展示了PotionEffect.getPotionID方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: S1DPacketEntityEffect
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public S1DPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
this.entityId = entityIdIn;
this.effectId = (byte)(effect.getPotionID() & 255);
this.amplifier = (byte)(effect.getAmplifier() & 255);
if (effect.getDuration() > 32767)
{
this.duration = 32767;
}
else
{
this.duration = effect.getDuration();
}
this.hideParticles = (byte)(effect.getIsShowParticles() ? 1 : 0);
}
示例2: getPotionFromInventory
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
private int getPotionFromInventory() {
int pot = -1;
int counter = 0;
int i = 1;
while (i < 45) {
ItemStack is;
ItemPotion potion;
Item item;
if (this.mc.thePlayer.inventoryContainer.getSlot(i).getHasStack() && (item = (is = this.mc.thePlayer.inventoryContainer.getSlot(i).getStack()).getItem()) instanceof ItemPotion && (potion = (ItemPotion)item).getEffects(is) != null) {
for (Object o : potion.getEffects(is)) {
PotionEffect effect = (PotionEffect)o;
if (effect.getPotionID() != Potion.heal.id || !ItemPotion.isSplash((int)is.getItemDamage())) continue;
++counter;
pot = i;
}
}
++i;
}
Character colorFormatCharacter = new Character('\u00a7');
this.suffix = OptionManager.getOption((String)"Hyphen", (Module)ModuleManager.getModule(HUD.class)).value ? colorFormatCharacter + "7 - " + counter : colorFormatCharacter + "7 " + counter;
return pot;
}
示例3: isPotionApplicable
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
if (this.getCreatureAttribute() == EnumCreatureAttribute.UNDEAD)
{
int i = potioneffectIn.getPotionID();
if (i == Potion.regeneration.id || i == Potion.poison.id)
{
return false;
}
}
return true;
}
示例4: getColorFromItemStack
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int pass) {
PotionEffect effect = getEffect(stack);
if (effect == null || effect.getPotionID() < 0 || effect.getPotionID() >= Potion.potionTypes.length)
return super.getColorFromItemStack(stack, pass);
return pass == 0 ? Potion.potionTypes[effect.getPotionID()].getLiquidColor() : super.getColorFromItemStack(stack, pass);
}
示例5: onImpact
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
/**
* Called when this EntityThrowable hits a block or entity.
*/
protected void onImpact(MovingObjectPosition p_70184_1_)
{
if (!this.worldObj.isRemote)
{
List<PotionEffect> list = Items.potionitem.getEffects(this.potionDamage);
if (list != null && !list.isEmpty())
{
AxisAlignedBB axisalignedbb = this.getEntityBoundingBox().expand(4.0D, 2.0D, 4.0D);
List<EntityLivingBase> list1 = this.worldObj.<EntityLivingBase>getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (!list1.isEmpty())
{
for (EntityLivingBase entitylivingbase : list1)
{
double d0 = this.getDistanceSqToEntity(entitylivingbase);
if (d0 < 16.0D)
{
double d1 = 1.0D - Math.sqrt(d0) / 4.0D;
if (entitylivingbase == p_70184_1_.entityHit)
{
d1 = 1.0D;
}
for (PotionEffect potioneffect : list)
{
int i = potioneffect.getPotionID();
if (Potion.potionTypes[i].isInstant())
{
Potion.potionTypes[i].affectEntity(this, this.getThrower(), entitylivingbase, potioneffect.getAmplifier(), d1);
}
else
{
int j = (int)(d1 * (double)potioneffect.getDuration() + 0.5D);
if (j > 20)
{
entitylivingbase.addPotionEffect(new PotionEffect(i, j, potioneffect.getAmplifier()));
}
}
}
}
}
}
}
this.worldObj.playAuxSFX(2002, new BlockPos(this), this.getPotionDamage());
this.setDead();
}
}
示例6: isPotionApplicable
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
return potioneffectIn.getPotionID() == Potion.poison.id ? false : super.isPotionApplicable(potioneffectIn);
}
示例7: S1EPacketRemoveEntityEffect
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public S1EPacketRemoveEntityEffect(int entityIdIn, PotionEffect effect)
{
this.entityId = entityIdIn;
this.effectId = effect.getPotionID();
}
示例8: addInformation
import net.minecraft.potion.PotionEffect; //導入方法依賴的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()) }));
}
}
}
}
示例9: drawActivePotionEffects
import net.minecraft.potion.PotionEffect; //導入方法依賴的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;
}
}
}