Java Code Examples for net.minecraft.potion.Potion

The following examples show how to use net.minecraft.potion.Potion. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: Et-Futurum   Source File: EntityTippedArrow.java    License: The Unlicense 6 votes vote down vote up
@Override
public void onCollideWithPlayer(EntityPlayer player) {
	boolean inGround = false;
	try {
		inGround = ReflectionHelper.getPrivateValue(EntityArrow.class, this, "inGround", "field_70254_i");
	} catch (Exception e) {
	}

	if (!worldObj.isRemote && inGround && arrowShake <= 0 && isEffectValid()) {
		boolean flag = canBePickedUp == 1 || canBePickedUp == 2 && player.capabilities.isCreativeMode;

		ItemStack stack = new ItemStack(ModItems.tipped_arrow);
		TippedArrow.setEffect(stack, Potion.potionTypes[effect.getPotionID()], effect.getDuration());

		if (canBePickedUp == 1 && !player.inventory.addItemStackToInventory(stack))
			flag = false;

		if (flag) {
			playSound("random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
			player.onItemPickup(this, 1);
			setDead();
		}
	}
}
 
Example 2
/**
 * @author CCBlueX
 */
@Overwrite
protected void jump() {
    final JumpEvent jumpEvent = new JumpEvent(this.getJumpUpwardsMotion());
    LiquidBounce.eventManager.callEvent(jumpEvent);
    if(jumpEvent.isCancelled())
        return;

    this.motionY = jumpEvent.getMotion();

    if(this.isPotionActive(Potion.jump))
        this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);

    if(this.isSprinting()) {
        float f = this.rotationYaw * 0.017453292F;
        this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
        this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
    }

    this.isAirBorne = true;
}
 
Example 3
@Override
    public void onWornTick(ItemStack arg0, EntityLivingBase pEntity) {
        if (!(pEntity instanceof EntityPlayer)) {
            return;
        }

        if (_mRnd.nextInt(20) == 0)
        {         
            EntityPlayer tPlayer = (EntityPlayer)pEntity;
            InventoryBaubles tBaubles = PlayerHandler.getPlayerBaubles(tPlayer);
            //PotionEffect tEff = getNBTPotionEffect(arg0);
            //int tStoredVictus = GetNBTVictusVis(arg0);
            
            /*if (tEff == null || tStoredVictus < 1)
            {
                return;
            }
*/
            Potion tPot = Potion.wither;
            if (tPlayer.isPotionActive(tPot))
            {
                tPlayer.removePotionEffect(tPot.id);
                //DamageItem(arg0);
            }
        }
    }
 
Example 4
Source Project: LiquidBounce   Source File: Fullbright.java    License: GNU General Public License v3.0 6 votes vote down vote up
@EventTarget(ignoreCondition = true)
public void onUpdate(final UpdateEvent event) {
    if (getState() || LiquidBounce.moduleManager.getModule(XRay.class).getState()) {
        switch(modeValue.get().toLowerCase()) {
            case "gamma":
                if(mc.gameSettings.gammaSetting <= 100F)
                    mc.gameSettings.gammaSetting++;
                break;
            case "nightvision":
                mc.thePlayer.addPotionEffect(new PotionEffect(Potion.nightVision.id, 1337, 1));
                break;
        }
    }else if(prevGamma != -1) {
        mc.gameSettings.gammaSetting = prevGamma;
        prevGamma = -1;
    }
}
 
Example 5
Source Project: LiquidBounce   Source File: HypixelHop.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onMotion() {
    if(MovementUtils.isMoving()) {

        if(mc.thePlayer.onGround) {
            mc.thePlayer.jump();

            float speed = MovementUtils.getSpeed() < 0.56F ? MovementUtils.getSpeed() * 1.045F : 0.56F;

            if(mc.thePlayer.onGround && mc.thePlayer.isPotionActive(Potion.moveSpeed))
                speed *= 1F + 0.13F * (1 + mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier());

            MovementUtils.strafe(speed);
            return;
        }else if(mc.thePlayer.motionY < 0.2D)
            mc.thePlayer.motionY -= 0.02D;

        MovementUtils.strafe(MovementUtils.getSpeed() * 1.01889F);
    }else{
        mc.thePlayer.motionX = mc.thePlayer.motionZ = 0D;
    }
}
 
Example 6
@Override
protected void attackEntity(Entity entity, float f)
{
    
    if (attackTime <= 0 && (f < 3.0D) && (entity.boundingBox.maxY > boundingBox.minY) && (entity.boundingBox.minY < boundingBox.maxY))
    {
        attackTime = 20;
        boolean flag = (rand.nextInt(3) == 0);
        if (flag)
        {
            if (entity instanceof EntityPlayer) 
            {
            	MoCreatures.poisonPlayer((EntityPlayer) entity);
            }
            ((EntityLiving) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 200, 0));
            MoCTools.playCustomSound(this, "wyvernpoisoning", worldObj);
        }
        
        int dmg = 5;
        if (getType() >= 5) dmg = 10;
        entity.attackEntityFrom(DamageSource.causeMobDamage(this), dmg);
        openMouth();
    }
}
 
Example 7
/**
 * @author CCBlueX
 */
@Overwrite
protected void jump() {
    final JumpEvent jumpEvent = new JumpEvent(this.getJumpUpwardsMotion());
    LiquidBounce.eventManager.callEvent(jumpEvent);
    if(jumpEvent.isCancelled())
        return;

    this.motionY = jumpEvent.getMotion();

    if(this.isPotionActive(Potion.jump))
        this.motionY += (double) ((float) (this.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F);

    if(this.isSprinting()) {
        float f = this.rotationYaw * 0.017453292F;
        this.motionX -= (double) (MathHelper.sin(f) * 0.2F);
        this.motionZ += (double) (MathHelper.cos(f) * 0.2F);
    }

    this.isAirBorne = true;
}
 
Example 8
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
    stack.damageItem(1, player);
    if (victim instanceof EntityHorse || victim instanceof EntityPig)
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 5));
    else if (victim instanceof EntityPlayer || victim instanceof EntityGolem) {
        victim.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.digSpeed.id, 200, 1));
        victim.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 200, 1));
    }
    if (!player.worldObj.isRemote && !Config.noLust && player.worldObj.provider.dimensionId == -1 && player.worldObj.rand.nextInt(15) == 1) {
        EntityItem ent = victim.entityDropItem(new ItemStack(ForbiddenItems.deadlyShards, 1, 4), 1.0F);
        ent.motionY += player.worldObj.rand.nextFloat() * 0.05F;
        ent.motionX += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
        ent.motionZ += (player.worldObj.rand.nextFloat() - player.worldObj.rand.nextFloat()) * 0.1F;
    }
    return true;
}
 
Example 9
@Override
protected void attackEntity(Entity entity, float f)
{
    
    if (attackTime <= 0 && (f < 3.0D) && (entity.boundingBox.maxY > boundingBox.minY) && (entity.boundingBox.minY < boundingBox.maxY))
    {
        attackTime = 20;
        boolean flag = (entity instanceof EntityPlayer);
        if (flag)
        {
            MoCreatures.poisonPlayer((EntityPlayer) entity);
        }
        ((EntityLiving) entity).addPotionEffect(new PotionEffect(Potion.poison.id, 150, 0));
        entity.attackEntityFrom(DamageSource.causeMobDamage(this), 2);
    }
}
 
Example 10
Source Project: Kettle   Source File: CraftAreaEffectCloud.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean removeCustomEffect(PotionEffectType effect) {
    int effectId = effect.getId();
    net.minecraft.potion.PotionEffect existing = null;
    for (net.minecraft.potion.PotionEffect mobEffect : getHandle().effects) {
        if (Potion.getIdFromPotion(mobEffect.getPotion()) == effectId) {
            existing = mobEffect;
        }
    }
    if (existing == null) {
        return false;
    }
    getHandle().effects.remove(existing);
    getHandle().refreshEffects();
    return true;
}
 
Example 11
default void explode(Entity entityIn) {
	if (potions.isEmpty()) {
		potions.add(1);
		potions.add(3);
		potions.add(5);
		potions.add(8);
		potions.add(11);
		potions.add(12);
		potions.add(21);
	}

	Random rand = new Random();
	int range = 5;
	List<EntityLivingBase> entities = entityIn.world.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(entityIn.posX - range, entityIn.posY - range, entityIn.posZ - range, entityIn.posX + range, entityIn.posY + range, entityIn.posZ + range));
	for (EntityLivingBase e : entities)
		e.addPotionEffect(new PotionEffect(Potion.getPotionById(potions.get(rand.nextInt(potions.size()))), rand.nextInt(30) * 20, rand.nextInt(2) + 1));

	ClientRunnable.run(new ClientRunnable() {
		@Override
		@SideOnly(Side.CLIENT)
		public void runIfClient() {
			LibParticles.FIZZING_EXPLOSION(entityIn.world, entityIn.getPositionVector());
		}
	});
}
 
Example 12
public void onUpdate(ItemStack itemstack, EntityPlayer player) {
    if(player.ticksExisted % 100 == 0){
        if(player.worldObj.provider.dimensionId == -1){
            for(int x = 0;x < primals.length;x++){
                if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, primals[x]) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 10) {
                    ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, primals[x], 1, true);
                }
            }
        }
        
        if(((ItemWandCasting)itemstack.getItem()).getVis(itemstack, Aspect.FIRE) < ((ItemWandCasting)itemstack.getItem()).getMaxVis(itemstack) / 5) {
            ((ItemWandCasting)itemstack.getItem()).addVis(itemstack, Aspect.FIRE, 1, true);
        }
    }
    
    if(player.isBurning())
        player.extinguish();
        
    if(player.isPotionActive(Potion.wither.id)) {
        if(player.worldObj.isRemote)
            player.removePotionEffectClient(Potion.wither.id);
        else
            player.removePotionEffect(Potion.wither.id);
    }
}
 
Example 13
Source Project: GokiStats   Source File: DataHelper.java    License: MIT License 6 votes vote down vote up
public static float getDamageDealt(EntityPlayer player, Entity target, DamageSource source) {
    float damage = (float) player.getEntityAttribute(SharedMonsterAttributes.ATTACK_DAMAGE).getAttributeValue();
    float bonusDamage = 0.0F;
    boolean targetIsLiving = target instanceof EntityLivingBase;
    boolean critical;
    ItemStack stack = player.getHeldItemMainhand();
    if (targetIsLiving) {
        bonusDamage = EnchantmentHelper.getModifierForCreature(stack, ((EntityLivingBase) target).getCreatureAttribute());
    }
    if ((damage > 0.0F) || (bonusDamage > 0.0F)) {
        critical = (player.fallDistance > 0.0F) && (!player.onGround) && (!player.isOnLadder()) && (!player.isInWater()) && (!player.isPotionActive(Potion.getPotionFromResourceLocation("blindness"))) && (player.getRidingEntity() == null) && (targetIsLiving);
        if ((critical) && (damage > 0.0F)) {
            damage *= 1.5F;
        }
        damage += bonusDamage;
    }
    return damage;
}
 
Example 14
Source Project: HexxitGear   Source File: ItemThiefArmor.java    License: GNU General Public License v3.0 6 votes vote down vote up
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot,
                              int layer) {
    if (entity instanceof EntityPlayer) {
        EntityPlayer player = (EntityPlayer) entity;
        if (player.isPotionActive(Potion.invisibility))
            return "/textures/armor/invisible.png";
    }

    // If the helmet slot, return helmet texture map
    if (slot == 0)
        return "/textures/maps/HoodHelmet.png";

    if (stack.itemID == HexxitGear.thiefLeggings.itemID)
        return "/textures/armor/thief2.png";

    return "/textures/armor/thief.png";
}
 
Example 15
Source Project: Gadomancy   Source File: AuraEffects.java    License: GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void doBlockEffect(ChunkCoordinates originTile, ChunkCoordinates selectedBlock, World world) {
    EntityLiving mob = world.rand.nextBoolean() ? new EntitySkeleton(world) : new EntityZombie(world);
    if(setAndCheckPosition(mob, selectedBlock, world, true) && world.difficultySetting != EnumDifficulty.PEACEFUL) {
        for(int i = 0; i < 5; i++) {
            mob.setCurrentItemOrArmor(i, null);
        }

        int timeout = 40;
        int totalCount = (world.rand.nextInt(3) == 0 ? 1 : 0) + 2;
        do {
            int slot = mob.getEquipmentInSlot(0) == null ? 0 : (mob.getEquipmentInSlot(4) == null ? 4 : (world.rand.nextInt(3)+1));
            if(mob.getEquipmentInSlot(slot) == null) {
                ItemStack[] items = ITEMS_SOUL[slot];
                ItemStack stack = items[world.rand.nextInt(items.length)];
                if(stack.getItem() != Items.bow || mob instanceof EntitySkeleton) {
                    totalCount--;
                    mob.setCurrentItemOrArmor(slot, stack);
                    mob.setEquipmentDropChance(slot, 0);
                }
            }
            timeout--;
        } while (totalCount > 0 && timeout > 0);

        if(timeout > 0) {
            mob.addPotionEffect(new PotionEffect(Potion.invisibility.getId(), MiscUtils.ticksForMinutes(60*24*365), 1, true));

            ChunkCoordinates pos = new ChunkCoordinates((int) mob.posX, (int) mob.posY, (int) mob.posZ);
            pos = iterateDown(pos, world);
            mob.setPosition(pos.posX + 0.5, pos.posY, pos.posZ + 0.5);
            world.spawnEntityInWorld(mob);
        }
    }
}
 
Example 16
Source Project: AdvancedRocketry   Source File: AtmosphereHighPressure.java    License: MIT License 5 votes vote down vote up
@Override
public void onTick(EntityLivingBase player) {
	if(player.world.getTotalWorldTime() % 20  == 0 && !isImmune(player)) {
		if(!isImmune(player)) {
			player.addPotionEffect(new PotionEffect(Potion.getPotionById(2), 40, 3));
			player.addPotionEffect(new PotionEffect(Potion.getPotionById(4), 40, 3));
		}
	}
}
 
Example 17
Source Project: multiconnect   Source File: Protocol_1_12_2.java    License: MIT License 5 votes vote down vote up
private void mutatePotionRegistry(ISimpleRegistry<Potion> registry) {
    registry.unregister(Potions.STRONG_SLOWNESS);
    registry.unregister(Potions.TURTLE_MASTER);
    registry.unregister(Potions.LONG_TURTLE_MASTER);
    registry.unregister(Potions.STRONG_TURTLE_MASTER);
    registry.unregister(Potions.SLOW_FALLING);
    registry.unregister(Potions.LONG_SLOW_FALLING);
}
 
Example 18
public PotionEffect getPotionEffect()
{
    if (potionID == Potion.heal.id || potionID == Potion.harm.id)
    {
        return (new PotionEffect(potionID, 1, concentration));
    }

    return (new PotionEffect(potionID, (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), concentration));
}
 
Example 19
private static <T extends Potion> T registerPotion(Class<T> potionClass) {
    int id = ModConfig.loadPotionId(potionClass.getSimpleName());
    if(id == -1) {
        for(int i = 0; i < Potion.potionTypes.length; i++) {
            if(Potion.potionTypes[i] == null) {
                id = i;
                break;
            }
        }

        if(id == -1) {
            id = Potion.potionTypes.length;
            FMLLog.warning("Gadomancy could not find a free potion id and will extend the potionTypes array! This might cause fatal errors. Please consider changing the config!");
        }
    }

    if(id > 127) {
        FMLLog.warning("The potion id '" + id + "' of potion '" + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' is bigger then 127 this might cause errors as well. Please consider changing the config.");
    }

    if(id >= Potion.potionTypes.length) {
        Potion[] potions = new Potion[Potion.potionTypes.length + 1];
        System.arraycopy(Potion.potionTypes, 0, potions, 0, Potion.potionTypes.length);
        Potion.potionTypes = potions;
    } else if(Potion.potionTypes[id] != null) {
        Potion conflict = Potion.potionTypes[id];
        throw new RuntimeException("Potion id conflict! Do not report this bug you just have to change the configuration files. Failed to register potion '"
                + Gadomancy.NAME + ":" + potionClass.getSimpleName() + "' with id '" + id
                + "'. Another potion with this id already exists: " + conflict.getName() + " (as " + conflict.getClass().getName() + ")");
    }

    return new Injector(potionClass).invokeConstructor(int.class, id);
}
 
Example 20
@Inject(method = "isPotionActive(Lnet/minecraft/potion/Potion;)Z", at = @At("HEAD"), cancellable = true)
private void isPotionActive(Potion p_isPotionActive_1_, final CallbackInfoReturnable<Boolean> callbackInfoReturnable) {
    final AntiBlind antiBlind = (AntiBlind) LiquidBounce.moduleManager.getModule(AntiBlind.class);

    if((p_isPotionActive_1_ == Potion.confusion || p_isPotionActive_1_ == Potion.blindness) && antiBlind.getState() && antiBlind.getConfusionEffect().get())
        callbackInfoReturnable.setReturnValue(false);
}
 
Example 21
Source Project: BaseMetals   Source File: Fluids.java    License: GNU Lesser General Public License v2.1 5 votes vote down vote up
public static void init(){
	if(initDone)return;

	
	// fluids
	fluidMercury = newFluid(BaseMetals.MODID, "mercury",13594,2000,300,0, 0xFFD8D8D8);
	
	// fluid blocks
	fluidBlockMercury = registerFluidBlock(fluidMercury, new InteractiveFluidBlock(
			fluidMercury, false, (World w, EntityLivingBase e)->{
				if(w.rand.nextInt(32) == 0)e.addPotionEffect(new PotionEffect(Potion.REGISTRY.getObject(dizzyPotionKey),30*20,2));
			}),"liquid_mercury");
	
	initDone = true;
}
 
Example 22
Source Project: LiquidBounce   Source File: SNCPBHop.java    License: GNU General Public License v3.0 5 votes vote down vote up
private double getBaseMoveSpeed() {
    double baseSpeed = 0.2873;
    if(mc.thePlayer.isPotionActive(Potion.moveSpeed))
        baseSpeed *= 1.0 + 0.2 * (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1);

    return baseSpeed;
}
 
Example 23
Source Project: mocreaturesdev   Source File: MoCItemWeapon.java    License: GNU General Public License v3.0 5 votes vote down vote up
/**
 * Current implementations of this method in child classes do not use the
 * entry argument beside ev. They just raise the damage on the stack.
 */
@Override
public boolean hitEntity(ItemStack par1ItemStack, EntityLiving par2EntityLiving, EntityLiving par3EntityLiving)
{
    int i = 1;
    if (breakable)
    {
        i = 10;
    }
    par1ItemStack.damageItem(i, par3EntityLiving);
    int potionTime = 100;
    switch (specialWeaponType)
    {
    case 1: //poison
        par2EntityLiving.addPotionEffect(new PotionEffect(Potion.poison.id, potionTime, 0));
        break;
    case 2: //frost slowdown
        par2EntityLiving.addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, potionTime, 0));
        break;
    case 3: //fire
        par2EntityLiving.setFire(10);
        break;
    case 4: //confusion
        par2EntityLiving.addPotionEffect(new PotionEffect(Potion.confusion.id, potionTime, 0));
        break;
    case 5: //blindness
        par2EntityLiving.addPotionEffect(new PotionEffect(Potion.blindness.id, potionTime, 0));
        break;
    default:
        break;
    }

    return true;
}
 
Example 24
private double getArmorPotentional(boolean getProj) {
    EntityPlayer player = mc.thePlayer;
    double armor = 0.0;
    int epf = 0;
    int resistance = 0;
    if (player.isPotionActive(Potion.resistance)) {
        resistance = player.getActivePotionEffect(Potion.resistance).getAmplifier() + 1;
    }

    for (ItemStack stack : player.inventory.armorInventory) {
        if (stack != null) {
            if (stack.getItem() instanceof ItemArmor) {
                ItemArmor armorItem = (ItemArmor) stack.getItem();
                armor += armorItem.damageReduceAmount * 0.04;
            }

            if (stack.isItemEnchanted()) {
                epf += getEffProtPoints(EnchantmentHelper.getEnchantmentLevel(0, stack));
            }

            if (getProj && stack.isItemEnchanted()) {
                epf += getEffProtPoints(EnchantmentHelper.getEnchantmentLevel(4, stack));
            }
        }
    }

    epf = (Math.min(epf, 25));
    double avgDef = addArmorProtResistance(armor, calcProtection(epf), resistance);
    return roundDouble(avgDef * 100.0);
}
 
Example 25
private void swingItem(EntityPlayerSP entityplayersp) {
    int swingAnimationEnd = entityplayersp.isPotionActive(Potion.digSpeed) ? (6 - (1 +
        entityplayersp.getActivePotionEffect(Potion.digSpeed).getAmplifier())) : (entityplayersp.isPotionActive(Potion.digSlowdown) ? (6 + (1 +
        entityplayersp.getActivePotionEffect(Potion.digSlowdown).getAmplifier()) * 2) : 6);
    if (!entityplayersp.isSwingInProgress || entityplayersp.swingProgressInt >= swingAnimationEnd / 2 || entityplayersp.swingProgressInt < 0) {
        entityplayersp.swingProgressInt = -1;
        entityplayersp.isSwingInProgress = true;
    }
}
 
Example 26
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
	Potion jump = MobEffects.JUMP_BOOST;
	if (!player.isPotionActive(jump)) {
		player.addPotionEffect(new PotionEffect(jump, 10, 2, false, false));
	}
	if (player.onGround && player.isSprinting()) {
		player.jump();
		player.playSound(GTSounds.SPRING, 1.0F, 1.0F + world.rand.nextFloat());
		if (world.rand.nextInt(2) == 0) {
			stack.damageItem(1, player);
		}
	}
}
 
Example 27
Source Project: Kettle   Source File: CraftLivingEntity.java    License: GNU General Public License v3.0 5 votes vote down vote up
public boolean addPotionEffect(PotionEffect effect, boolean force) {
    if (hasPotionEffect(effect.getType())) {
        if (!force) {
            return false;
        }
        removePotionEffect(effect.getType());
    }
    getHandle().addPotionEffect(new net.minecraft.potion.PotionEffect(Potion.getPotionById(effect.getType().getId()), effect.getDuration(), effect.getAmplifier(), effect.isAmbient(), effect.hasParticles()));
    return true;
}
 
Example 28
Source Project: Kettle   Source File: CraftLivingEntity.java    License: GNU General Public License v3.0 5 votes vote down vote up
public Collection<PotionEffect> getActivePotionEffects() {
    List<PotionEffect> effects = new ArrayList<PotionEffect>();
    for (net.minecraft.potion.PotionEffect handle : getHandle().getActivePotionMap().values()) {
        effects.add(new PotionEffect(PotionEffectType.getById(Potion.getIdFromPotion(handle.getPotion())), handle.getDuration(), handle.getAmplifier(), handle.getIsAmbient(), handle.doesShowParticles()));
    }
    return effects;
}
 
Example 29
Source Project: NotEnoughItems   Source File: GuiPotionCreator.java    License: MIT License 5 votes vote down vote up
public GuiSlotPotionEffects(int x, int y) {
    super(x, y, 108, 76);
    for (Potion p : Potion.potionTypes)
        if (p != null)
            validPotions.add(p);
    setSmoothScroll(false);
    setMargins(0, 0, 0, 0);
}
 
Example 30
@Override
public void onUpdate() {
    super.onUpdate();
    if(redstoneSignal > 0)
        return;
    final int range = 6;
    final int cost = 40;
    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.weakness) == null && mana >= cost && !entity.worldObj.isRemote) {
            entity.addPotionEffect(new PotionEffect(Potion.weakness.id, 60, 2));
            mana -= cost;
        }
    }
}