Package net.minecraft.potion

Examples of net.minecraft.potion.PotionEffect


    } else onUnequipped(stack, player);
  }

  @Override
  public void onUnequipped(ItemStack stack, EntityLivingBase player) {
    PotionEffect effect = player.getActivePotionEffect(Potion.nightVision);
    if(effect != null && effect.getAmplifier() == -42)
      player.removePotionEffect(Potion.nightVision.id);
  }
View Full Code Here


  @Override
  public void onWornTick(ItemStack stack, EntityLivingBase player) {
    Brew brew = getBrew(stack);
    if(brew != BotaniaAPI.fallbackBrew && player instanceof EntityPlayer && !player.worldObj.isRemote) {
      EntityPlayer eplayer = (EntityPlayer) player;
      PotionEffect effect = brew.getPotionEffects(stack).get(0);
      float cost = (float) brew.getManaCost(stack) / effect.getDuration() / (1 + effect.getAmplifier()) * 2.5F;
      boolean doRand = cost < 1;
      if(ManaItemHandler.requestManaExact(stack, eplayer, (int) Math.ceil(cost), false)) {
        PotionEffect currentEffect = player.getActivePotionEffect(Potion.potionTypes[effect.getPotionID()]);
        if(currentEffect == null || currentEffect.getDuration() < 3) {
          PotionEffect applyEffect = new PotionEffect(effect.getPotionID(), 80, effect.getAmplifier());
          player.addPotionEffect(applyEffect);
        }

        if(!doRand || Math.random() < cost)
          ManaItemHandler.requestManaExact(stack, eplayer, (int) Math.ceil(cost), true);
View Full Code Here

      ItemStack amulet = PlayerHandler.getPlayerBaubles(player).getStackInSlot(0);

      if(amulet != null && amulet.getItem() == this) {
        event.setCanceled(true);
        player.setHealth(player.getMaxHealth());
        player.addPotionEffect(new PotionEffect(Potion.resistance.id, 300, 6));
        player.addChatMessage(new ChatComponentTranslation("botaniamisc.savedByLaurel"));
        player.worldObj.playSoundAtEntity(player, "botania:goldenLaurel", 1F, 0.3F);
        PlayerHandler.getPlayerBaubles(player).setInventorySlotContents(0, null);
      }
    }
View Full Code Here

        onUnequipped(stack, player);
      else {
        if(player.getActivePotionEffect(Potion.digSpeed) != null)
          player.removePotionEffect(Potion.digSpeed.id);

        player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, Integer.MAX_VALUE, 1, true));
      }

      if(player.swingProgress == 0.25F)
        ManaItemHandler.requestManaExact(stack, (EntityPlayer) player, manaCost, true);
    }
View Full Code Here

    }
  }

  @Override
  public void onUnequipped(ItemStack stack, EntityLivingBase player) {
    PotionEffect effect = player.getActivePotionEffect(Potion.digSpeed);
    if(effect != null && effect.getAmplifier() == 1)
      player.removePotionEffect(Potion.digSpeed.id);
  }
View Full Code Here

    ticksTillExpire--;
    ItemNBTHelper.setInt(stack, TAG_TICKS_TILL_EXPIRE, ticksTillExpire);
    ItemNBTHelper.setInt(stack, TAG_TICKS_COOLDOWN, ticksCooldown);

    EntityPlayer player = (EntityPlayer) par3Entity;
    PotionEffect haste = player.getActivePotionEffect(Potion.digSpeed);
    float check = haste == null ? 0.16666667F : haste.getAmplifier() == 1 ? 0.5F : 0.4F;
    if(player.getCurrentEquippedItem() == stack && player.swingProgress == check && !world.isRemote)
      leftClick(player);
  }
View Full Code Here

        if(item instanceof EntityLivingBase) {
          EntityLivingBase targetEntity = (EntityLivingBase)item;
          targetEntity.fallDistance = 0.0F;
          if(targetEntity.getActivePotionEffect(Potion.moveSlowdown) == null)
            targetEntity.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 2, 3, true));
        }

        Vector3 target3 = Vector3.fromEntityCenter(player);
        target3.add(new Vector3(player.getLookVec()).multiply(length));
        target3.y += 0.5;
View Full Code Here

    if(!supertile.getWorldObj().isRemote) {
      List<EntityPlayer> players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range + 1, supertile.yCoord + range + 1, supertile.zCoord + range + 1));
      for(EntityPlayer player : players) {
        if(player.getActivePotionEffect(Potion.regeneration) == null && mana >= cost) {
          player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 60, 2));
          mana -= cost;
        }
      }
    }
  }
View Full Code Here

 
  @Override
    public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
    if(!world.isRemote) {
      for(PotionEffect effect : getBrew(stack).getPotionEffects(stack)) {
        PotionEffect newEffect = new PotionEffect(effect);
        player.addPotionEffect(newEffect);
      }
     
      if(world.rand.nextBoolean())
        world.playSoundAtEntity(player, "random.burp", 1F, 1F);
View Full Code Here

    final int cost = 20;

    List<EntityLivingBase> entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range));
    for(EntityLivingBase entity : entities) {
      if(!(entity instanceof EntityPlayer) && entity.getActivePotionEffect(Potion.poison) == null && mana >= cost && !entity.worldObj.isRemote && entity.getCreatureAttribute() != EnumCreatureAttribute.UNDEAD) {
        entity.addPotionEffect(new PotionEffect(Potion.poison.id, 60, 0));
        mana -= cost;
      }
    }
  }
View Full Code Here

TOP

Related Classes of net.minecraft.potion.PotionEffect

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.