本文整理匯總了Java中net.minecraft.potion.PotionEffect.getAmplifier方法的典型用法代碼示例。如果您正苦於以下問題:Java PotionEffect.getAmplifier方法的具體用法?Java PotionEffect.getAmplifier怎麽用?Java PotionEffect.getAmplifier使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類net.minecraft.potion.PotionEffect
的用法示例。
在下文中一共展示了PotionEffect.getAmplifier方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: applyEffects
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public void applyEffects(EntityLivingBase target, EntityLivingBase source, EntityLivingBase indirectsource) {
for (CaskPotionEffect effect : effects)
{
PotionEffect potioneffect = effect.potionEffect;
PotionEffect currentStack = target.getActivePotionEffect(potioneffect.getPotion());
if (potioneffect.getPotion().isInstant())
{
potioneffect.getPotion().affectEntity(source, indirectsource, target, potioneffect.getAmplifier(), 1.0D);
}
else
{
int amplifier = currentStack.getAmplifier();
int duration = currentStack.getDuration();
if(currentStack != null)
{
amplifier = Math.min(amplifier + currentStack.getAmplifier() + 1,effect.maxStack);
if(amplifier != currentStack.getAmplifier())
duration += currentStack.getDuration();
}
PotionEffect newStack = new PotionEffect(potioneffect.getPotion(),duration,amplifier,false,false); //TODO: curative item?? alchemical hangover cure???
target.addPotionEffect(newStack);
}
}
}
示例2: onItemUse
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@SubscribeEvent
public void onItemUse(LivingEntityUseItemEvent event)
{
EntityLivingBase living = event.getEntityLiving();
ItemStack stack = event.getItem();
PotionEffect effect = living.getActivePotionEffect(this);
if(ItemUtil.matchesOreDict(stack,"torch") && effect != null)
{
//TODO: Blow a cloud of fire out
if(effect.getDuration() > 10)
{
PotionEffect reducedEffect = new PotionEffect(this, effect.getDuration() - 5, effect.getAmplifier(), effect.getIsAmbient(), effect.doesShowParticles());
reducedEffect.setCurativeItems(effect.getCurativeItems());
living.addPotionEffect(reducedEffect);
}
else
{
living.removePotionEffect(this);
}
}
}
示例3: fall
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
super.fall(distance, damageMultiplier);
PotionEffect potioneffect = this.getActivePotionEffect(Potion.jump);
float f = potioneffect != null ? (float)(potioneffect.getAmplifier() + 1) : 0.0F;
int i = MathHelper.ceiling_float_int((distance - 3.0F - f) * damageMultiplier);
if (i > 0)
{
this.playSound(this.getFallSoundString(i), 1.0F, 1.0F);
this.attackEntityFrom(DamageSource.fall, (float)i);
int j = MathHelper.floor_double(this.posX);
int k = MathHelper.floor_double(this.posY - 0.20000000298023224D);
int l = MathHelper.floor_double(this.posZ);
Block block = this.worldObj.getBlockState(new BlockPos(j, k, l)).getBlock();
if (block.getMaterial() != Material.air)
{
Block.SoundType block$soundtype = block.stepSound;
this.playSound(block$soundtype.getStepSound(), block$soundtype.getVolume() * 0.5F, block$soundtype.getFrequency() * 0.75F);
}
}
}
示例4: 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);
}
示例5: fall
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public void fall(float distance, float damageMultiplier)
{
super.fall(distance, damageMultiplier);
PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.JUMP_BOOST);
float f = potioneffect == null ? 0.0F : (float)(potioneffect.getAmplifier() + 1);
int i = MathHelper.ceil((distance - 3.0F - f) * damageMultiplier);
if (i > 0)
{
this.playSound(this.getFallSound(i), 1.0F, 1.0F);
this.attackEntityFrom(DamageSource.fall, (float)i);
int j = MathHelper.floor(this.posX);
int k = MathHelper.floor(this.posY - 0.20000000298023224D);
int l = MathHelper.floor(this.posZ);
IBlockState iblockstate = this.world.getBlockState(new BlockPos(j, k, l));
if (iblockstate.getMaterial() != Material.AIR)
{
SoundType soundtype = iblockstate.getBlock().getSoundType();
this.playSound(soundtype.getFallSound(), soundtype.getVolume() * 0.5F, soundtype.getPitch() * 0.75F);
}
}
}
示例6: copyBrew
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
private Object copyBrew(Object brew) {
if (brew instanceof PotionEffect) {
PotionEffect potion = (PotionEffect) brew;
return new PotionEffect(potion.getPotion(), potion.getDuration(), potion.getAmplifier());
}
return ((BrewEffect) brew).copy();
}
示例7: SPacketEntityEffect
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public SPacketEntityEffect(int entityIdIn, PotionEffect effect)
{
this.entityId = entityIdIn;
this.effectId = (byte)(Potion.getIdFromPotion(effect.getPotion()) & 255);
this.amplifier = (byte)(effect.getAmplifier() & 255);
if (effect.getDuration() > 32767)
{
this.duration = 32767;
}
else
{
this.duration = effect.getDuration();
}
this.flags = 0;
if (effect.getIsAmbient())
{
this.flags = (byte)(this.flags | 1);
}
if (effect.doesShowParticles())
{
this.flags = (byte)(this.flags | 2);
}
}
示例8: addPotionEffectTooltip
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
@SideOnly(Side.CLIENT)
public static void addPotionEffectTooltip(List<PotionEffect> list, List<String> lores, float durationFactor)
{
List<Tuple<String, AttributeModifier>> attributeModifiers = Lists.newArrayList();
if (list.isEmpty())
{
String s = I18n.translateToLocal("effect.none").trim();
lores.add(TextFormatting.GRAY + s);
}
else
{
for (PotionEffect potioneffect : list)
{
String s1 = I18n.translateToLocal(potioneffect.getEffectName()).trim();
Potion potion = potioneffect.getPotion();
Map<IAttribute, AttributeModifier> map = potion.getAttributeModifierMap();
if (!map.isEmpty())
{
for (Map.Entry<IAttribute, AttributeModifier> entry : map.entrySet())
{
AttributeModifier attributemodifier = entry.getValue();
AttributeModifier attributemodifier1 = new AttributeModifier(attributemodifier.getName(), potion.getAttributeModifierAmount(potioneffect.getAmplifier(), attributemodifier), attributemodifier.getOperation());
attributeModifiers.add(new Tuple(((IAttribute)entry.getKey()).getName(), attributemodifier1));
}
}
if (potioneffect.getAmplifier() > 0)
{
s1 = s1 + " " + I18n.translateToLocal("potion.potency." + potioneffect.getAmplifier()).trim();
}
if (potioneffect.getDuration() > 20)
{
s1 = s1 + " (" + Potion.getPotionDurationString(potioneffect, durationFactor) + ")";
}
if (potion.isBadEffect())
{
lores.add(TextFormatting.RED + s1);
}
else
{
lores.add(TextFormatting.BLUE + s1);
}
}
}
if (!attributeModifiers.isEmpty())
{
lores.add("");
lores.add(TextFormatting.DARK_PURPLE + I18n.translateToLocal("potion.whenDrank"));
for (Tuple<String, AttributeModifier> tuple : attributeModifiers)
{
AttributeModifier attributemodifier2 = tuple.getSecond();
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)
{
lores.add(TextFormatting.BLUE + I18n.translateToLocalFormatted("attribute.modifier.plus." + attributemodifier2.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.translateToLocal("attribute.name." + (String)tuple.getFirst())));
}
else if (d0 < 0.0D)
{
d1 = d1 * -1.0D;
lores.add(TextFormatting.RED + I18n.translateToLocalFormatted("attribute.modifier.take." + attributemodifier2.getOperation(), ItemStack.DECIMALFORMAT.format(d1), I18n.translateToLocal("attribute.name." + (String)tuple.getFirst())));
}
}
}
}
示例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 : Ordering.natural().sortedCopy(collection))
{
Potion potion = potioneffect.getPotion();
if(!potion.shouldRender(potioneffect)) continue;
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
this.mc.getTextureManager().bindTexture(INVENTORY_BACKGROUND);
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);
}
potion.renderInventoryEffect(i, j, potioneffect, mc);
if (!potion.shouldRenderInvText(potioneffect)) { j += l; continue; }
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.getPotionDurationString(potioneffect, 1.0F);
this.fontRendererObj.drawStringWithShadow(s, (float)(i + 10 + 18), (float)(j + 6 + 10), 8355711);
j += l;
}
}
}
示例10: 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;
}
}
}
示例11: onRender
import net.minecraft.potion.PotionEffect; //導入方法依賴的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;
}
}
}
示例12: isPotionApplicable
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public boolean isPotionApplicable(PotionEffect potioneffectIn)
{
return potioneffectIn.getPotion() == TF2weapons.stun && potioneffectIn.getAmplifier()>=3;
}
示例13: 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()) }));
}
}
}
}
示例14: renderXDolfOverlay
import net.minecraft.potion.PotionEffect; //導入方法依賴的package包/類
public void renderXDolfOverlay() {
if(Wrapper.getMinecraft().gameSettings.showDebugInfo || hideGui || Wrapper.getMinecraft().currentScreen instanceof GuiChat) return;
int width = Client.gameResolution.getScaledWidth();
int height = Client.gameResolution.getScaledHeight();
Fonts.roboto18.drawStringWithShadow("Xdolf", 2, 0, 0x55FF55);
int count = 0;
try {
for(Module mod: Hacks.display) {
int x2 = width - (Fonts.roboto18.getStringWidth(mod.getName()));
int y = (10 * count);
Fonts.roboto18.drawStringWithShadow(mod.getName(), x2 - 2, y, 0xffffff);
count++;
}
} catch (Exception ex) {}
Collection<PotionEffect> var4 = Wrapper.getPlayer().getActivePotionEffects();
if (!var4.isEmpty()) {
final ResourceLocation var5 = new ResourceLocation("textures/gui/container/inventory.png");
int var6 = -23;
int count2 = 0;
for (PotionEffect potioneffect : Ordering.natural().sortedCopy(var4)) {
count2++;
Potion var9 = potioneffect.getPotion();
Wrapper.getMinecraft().renderEngine.bindTexture(var5);
String s1 = I18n.format(var9.getName(), new Object[0]);
if (potioneffect.getAmplifier() == 1) {
s1 = s1 + " II";
} else if (potioneffect.getAmplifier() == 2) {
s1 = s1 + " III";
} else if (potioneffect.getAmplifier() == 3) {
s1 = s1 + " IV";
}
String var11 = Potion.getPotionDurationString(potioneffect, 1.0F);
int var14 = width -Fonts.roboto18.getStringWidth(s1) - 2 - 20;
int var16 = width - (Fonts.roboto18.getStringWidth(var11) / 2) - 4 - 20;
if (var9.hasStatusIcon()) {
int var10 = var9.getStatusIconIndex();
this.drawTexturedModalRect(width - 20, height - (count2 * 20), 0 + var10 % 8 * 18,
198 + var10 / 8 * 18, 18, 18);
}
Fonts.roboto18.drawStringWithShadow(s1, var14, height - (count2 * 20),
16777215);
var14 = width - Fonts.roboto18.getStringWidth(var11) - 2;
Fonts.roboto18.drawStringWithShadow(var11, (var16) - 8,
height + 10 - (count2 * 20), 8355711);
}
}
for(XdolfWindow window: XdolfGuiClick.windowList) {
if(!(Wrapper.getMinecraft().currentScreen instanceof XdolfGuiClick)) {
if(window.isPinned()) {
window.draw(0, 0);
}
}
}
}