net.minecraft.potion.PotionEffect Java Examples

The following examples show how to use net.minecraft.potion.PotionEffect. 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 File: Fullbright.java    From LiquidBounce with 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 #2
Source File: ComponentObscurity.java    From Artifacts with MIT License 6 votes vote down vote up
@Override
	public boolean hitEntity(ItemStack itemStack, EntityLivingBase entityVictim, EntityLivingBase entityAttacker) {
		EntityPlayerMP player = UtilsForComponents.getPlayerFromUsername(entityAttacker.getCommandSenderName());
		
		if(player != null) {
			player.addPotionEffect(new PotionEffect(14, 600, 0));
			
			PacketBuffer out = new PacketBuffer(Unpooled.buffer());
			
			out.writeInt(PacketHandlerClient.OBSCURITY);
			SToCMessage packet = new SToCMessage(out);
			DragonArtifacts.artifactNetworkWrapper.sendTo(packet, player);
			
			//System.out.println("Cloaking player.");
			itemStack.damageItem(1, player);
//			UtilsForComponents.sendItemDamagePacket(entityAttacker, entityAttacker.inventory.currentItem, 1); //itemStack.damageItem(1, player);
//			itemStack.stackTagCompound.setInteger("onItemRightClickDelay", 200);
		}
		return false;
	}
 
Example #3
Source File: IPotionEffectExplodable.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
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 #4
Source File: ComponentAdrenaline.java    From Artifacts with MIT License 6 votes vote down vote up
@Override
public void onTakeDamage(ItemStack itemStack, LivingHurtEvent event, boolean isWornArmor) {
	//System.out.println("Player has been damaged!");
	if(isWornArmor && !event.isCanceled()) {
		if(itemStack.stackTagCompound.getInteger("adrenDelay_armor") <= 0 && event.entity instanceof EntityPlayer) {
			//System.out.println("Attempting to apply potion effects to player.");
			EntityPlayer p = (EntityPlayer)event.entity;
			//if(p.getHealth() <= 4) {
				//System.out.println("Applying Potion Effects.");
				itemStack.stackTagCompound.setInteger("adrenDelay_armor", 300);
				
				p.addPotionEffect(new PotionEffect(1, 100, 1));
				p.addPotionEffect(new PotionEffect(5, 100, 1));
				p.addPotionEffect(new PotionEffect(11, 100, 2));
				
			//}
		}
	}
}
 
Example #5
Source File: ModuleEffectVanish.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) {
	Entity targetEntity = spell.getVictim(world);

	double duration = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell) * 20;

	if (targetEntity instanceof EntityLivingBase) {
		if (!spellRing.taxCaster(world, spell, true)) return false;

		((EntityLivingBase) targetEntity).world.playSound(null, targetEntity.getPosition(), ModSounds.ETHEREAL_PASS_BY, SoundCategory.NEUTRAL, 0.5f, 1);
		((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, (int) duration, 100, false, false));
		((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, (int) duration, 100, false, false));
		VanishTracker.addVanishObject(targetEntity.getEntityId(), (int) duration);
		PacketHandler.NETWORK.sendToAll(new PacketVanishPlayer(targetEntity.getEntityId(), (int) duration));
		//	((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(ModPotions.VANISH, (int) duration, 0, true, false));
	}
	return true;
}
 
Example #6
Source File: EntityLingeringEffect.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@Override
public void applyEntityCollision(Entity e) {
	if (!(e instanceof EntityLivingBase))
		return;
	EntityLivingBase entity = (EntityLivingBase) e;
	List<PotionEffect> effects = ((LingeringPotion) ModItems.lingering_potion).getEffects(stack);
	boolean addedEffect = false;

	for (PotionEffect effect : effects) {
		int effectID = effect.getPotionID();
		if (Potion.potionTypes[effectID].isInstant()) {
			Potion.potionTypes[effectID].affectEntity(thrower, entity, effect.getAmplifier(), 0.25);
			addedEffect = true;
		} else if (!entity.isPotionActive(effectID)) {
			entity.addPotionEffect(effect);
			addedEffect = true;
		}
	}

	if (addedEffect) {
		int ticks = dataWatcher.getWatchableObjectInt(TICKS_DATA_WATCHER);
		if (setTickCount(ticks + 5 * 20)) // Add 5 seconds to the expiration time (decreasing radius by 0.5 blocks)
			return;
	}
}
 
Example #7
Source File: ItemNanoGoggles.java    From Electro-Magic-Tools with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
    if (ConfigHandler.nightVisionOff == false) {
        if (ElectricItem.manager.canUse(itemStack, 1 / 1000)) {

            int x = MathHelper.floor_double(player.posX);
            int z = MathHelper.floor_double(player.posZ);
            int y = MathHelper.floor_double(player.posY);

            int lightlevel = player.worldObj.getBlockLightValue(x, y, z);
            if (lightlevel >= 0)
                player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300, -3));
            ElectricItem.manager.use(itemStack, 1 / 1000, player);
        } else {
            player.addPotionEffect(new PotionEffect(Potion.blindness.id, 300, 0, true));
        }
    }
}
 
Example #8
Source File: LingeringPotion.java    From Et-Futurum with The Unlicense 6 votes vote down vote up
@Override
public String getItemStackDisplayName(ItemStack stack) {
	if (stack.getItemDamage() == 0)
		return StatCollector.translateToLocal("item.emptyPotion.name").trim();
	else {
		String s = StatCollector.translateToLocal("potion.prefix.lingering").trim() + " ";

		List<PotionEffect> list = getEffects(stack);
		String s1;

		if (list != null && !list.isEmpty()) {
			s1 = list.get(0).getEffectName();
			s1 = s1 + ".postfix";
			return s + StatCollector.translateToLocal(s1).trim();
		} else {
			s1 = PotionHelper.func_77905_c(stack.getItemDamage());
			return StatCollector.translateToLocal(s1).trim() + " " + super.getItemStackDisplayName(stack);
		}
	}
}
 
Example #9
Source File: GTItemEchotron.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public boolean onItemActive(ItemStack stack, World worldIn, Entity entityIn, int slot, boolean selected) {
	if (worldIn.getTotalWorldTime() % 100 == 0) {
		entityIn.playSound(GTSounds.SONAR, 1.0F, 1.0F);
		AxisAlignedBB area = new AxisAlignedBB(entityIn.getPosition()).grow(16);
		List<Entity> list = entityIn.world.getEntitiesInAABBexcluding(entityIn, area, null);
		if (!list.isEmpty()) {
			for (Entity thing : list) {
				if (thing instanceof EntityLiving) {
					((EntityLivingBase) thing).addPotionEffect(new PotionEffect(MobEffects.GLOWING, 80, 0, false, false));
				}
				if (thing instanceof EntityPlayer) {
					((EntityPlayer) thing).addPotionEffect(new PotionEffect(MobEffects.GLOWING, 80, 0, false, false));
				}
			}
		}
		return true;
	}
	return false;
}
 
Example #10
Source File: GTTileEchotron.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void update() {
	if (world.getTotalWorldTime() % 100 == 0 && this.energy >= 10 && !redstoneEnabled()) {
		world.playSound((EntityPlayer) null, this.pos, GTSounds.SONAR, SoundCategory.BLOCKS, 1.0F, 1.0F);
		AxisAlignedBB area = new AxisAlignedBB(new int3(pos, getFacing()).asBlockPos()).grow(32.0D);
		List<Entity> list = world.getEntitiesInAABBexcluding(world.getPlayerEntityByUUID(this.owner), area, null);
		if (!list.isEmpty()) {
			for (Entity thing : list) {
				if (thing instanceof EntityLiving) {
					((EntityLivingBase) thing).addPotionEffect(new PotionEffect(MobEffects.GLOWING, 80, 0, false, false));
				}
				if (thing instanceof EntityPlayer) {
					((EntityPlayer) thing).addPotionEffect(new PotionEffect(MobEffects.GLOWING, 80, 0, false, false));
				}
			}
		}
		this.useEnergy(10);
	}
}
 
Example #11
Source File: VanillaEnhancementsHud.java    From Hyperium with GNU Lesser General Public License v3.0 6 votes vote down vote up
private String getPotionEffectString(ItemStack heldItemStack) {
    ItemPotion potion = (ItemPotion) heldItemStack.getItem();
    List<PotionEffect> effects = potion.getEffects(heldItemStack);
    if (effects == null) return "";

    StringBuilder potionBuilder = new StringBuilder();

    effects.forEach(entry -> {
        int duration = entry.getDuration() / 20;
        potionBuilder.append(EnumChatFormatting.BOLD.toString());
        potionBuilder.append(StatCollector.translateToLocal(entry.getEffectName()));
        potionBuilder.append(" ");
        potionBuilder.append(entry.getAmplifier() + 1);
        potionBuilder.append(" ");
        potionBuilder.append("(");
        potionBuilder.append(duration / 60).append(String.format(":%02d", duration % 60));
        potionBuilder.append(") ");
    });

    return potionBuilder.toString().trim();
}
 
Example #12
Source File: ContainerPotionCreator.java    From NotEnoughItems with MIT License 6 votes vote down vote up
@SuppressWarnings ("unchecked")
@Override
public void handleInputPacket(PacketCustom packet) {
    ItemStack potion = potionInv.getStackInSlot(0);
    if (potion == null) {
        return;
    }

    boolean add = packet.readBoolean();
    Potion effect = Potion.getPotionById(packet.readUByte());

    NBTTagList effects = potion.getTagCompound().getTagList("CustomPotionEffects", 10);
    NBTTagList newEffects = new NBTTagList();
    for (int i = 0; i < effects.tagCount(); i++) {
        NBTTagCompound tag = effects.getCompoundTagAt(i);
        PotionEffect e = PotionEffect.readCustomPotionEffectFromNBT(tag);
        if (e.getPotion() != effect) {
            newEffects.appendTag(tag);
        }
    }
    if (add) {
        newEffects.appendTag(new PotionEffect(effect, packet.readInt(), packet.readUByte()).writeCustomPotionEffectToNBT(new NBTTagCompound()));
    }
    potion.getTagCompound().setTag("CustomPotionEffects", newEffects);
}
 
Example #13
Source File: EventHandler.java    From Wizardry with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SubscribeEvent
public void onFlyFall(PlayerFlyableFallEvent event) {
	if (event.getEntityPlayer().getEntityWorld().provider.getDimension() == 0) {
		if (event.getEntityPlayer().posY <= 0) {
			BlockPos location = event.getEntityPlayer().getPosition();
			BlockPos bedrock = PosUtils.checkNeighborBlocksThoroughly(event.getEntity().getEntityWorld(), location, Blocks.BEDROCK);
			if (bedrock != null) {
				if (event.getEntity().getEntityWorld().getBlockState(bedrock).getBlock() == Blocks.BEDROCK) {
					TeleportUtil.teleportToDimension(event.getEntityPlayer(), Wizardry.underWorld.getId(), 0, 300, 0);
					((EntityPlayer) event.getEntity()).addPotionEffect(new PotionEffect(ModPotions.NULLIFY_GRAVITY, 100, 0, true, false));
					fallResetter.add(event.getEntity().getUniqueID());
				}
			}
		}
	}
}
 
Example #14
Source File: ItemBloodRapier.java    From ForbiddenMagic with Do What The F*ck You Want To Public License 6 votes vote down vote up
@Override
public boolean hitEntity(ItemStack stack, EntityLivingBase victim, EntityLivingBase player) {
    stack.damageItem(1, player);
    victim.motionY *= 0.8;
    if (victim.hurtResistantTime > 18)
        victim.hurtResistantTime -= 5;
    if (Compat.bm & victim instanceof EntityPlayer) {
        String target = ((EntityPlayer) victim).getDisplayName();
        int lp = SoulNetworkHandler.getCurrentEssence(target);
        int damage = Math.max(4000, lp / 4);
        if (lp >= damage)
            lp -= damage;
        else
            lp = 0;
        SoulNetworkHandler.setCurrentEssence(target, lp);
        victim.addPotionEffect(new PotionEffect(DarkPotions.bloodSeal.getId(), 1200));
    }
    return true;
}
 
Example #15
Source File: EntitySpawning.java    From ToroQuest with GNU General Public License v3.0 6 votes vote down vote up
private void replaceEntityWithVillageLord(PossibleConversionData data, EntityLiving toEntity) {
	World world = data.from.world;
	BlockPos pos = data.from.getPosition();

	if (toEntity == null) {
		toEntity = data.to;
	}

	if (toEntity == null) {
		return;
	}

	if (!data.from.isDead) {
		data.from.setDead();
	}

	toEntity.onInitialSpawn(world.getDifficultyForLocation(pos), (IEntityLivingData) null);
	toEntity.setPosition(pos.getX() + 0.5, pos.getY(), pos.getZ() + 0.5);
	world.spawnEntity(toEntity);
	toEntity.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 200, 0));
}
 
Example #16
Source File: WrappedPotionEffectImpl.java    From customstuff4 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public PotionEffect getPotionEffect()
{
    Potion potion = Potion.REGISTRY.getObject(id);
    if (potion == null)
    {
        return null;
    } else
    {
        return new PotionEffect(potion, duration, amplifier, false, showParticles);
    }
}
 
Example #17
Source File: BlockPotionFluid.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onEntityCollidedWithBlock(World worldIn, BlockPos pos, IBlockState state, Entity entityIn) {
    if (!(entityIn instanceof EntityLivingBase) ||
        worldIn.getTotalWorldTime() % 20 != 0) return;
    EntityLivingBase entity = (EntityLivingBase) entityIn;
    for (PotionEffect potionEffect : potionType.getEffects()) {
        if (!potionEffect.getPotion().isInstant()) {
            PotionEffect instantEffect = new PotionEffect(potionEffect.getPotion(), 60, potionEffect.getAmplifier(), true, true);
            entity.addPotionEffect(instantEffect);
        } else {
            potionEffect.getPotion().affectEntity(null, null, entity, potionEffect.getAmplifier(), 1.0);
        }
    }
}
 
Example #18
Source File: PotionTimeSlow.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void handleImportantEntityTicks(EntityLivingBase e) {
	if (e.hurtTime > 0) {
		e.hurtTime--;
	}
	if (e.hurtResistantTime > 0) {
		e.hurtResistantTime--;
	}

	e.prevLimbSwingAmount = e.limbSwingAmount;
	e.prevRenderYawOffset = e.renderYawOffset;
	e.prevRotationPitch = e.rotationPitch;
	e.prevRotationYaw = e.rotationYaw;
	e.prevRotationYawHead = e.rotationYawHead;
	e.prevSwingProgress = e.swingProgress;
	e.prevDistanceWalkedModified = e.distanceWalkedModified;
	e.prevCameraPitch = e.cameraPitch;

	if(e.isPotionActive(ModPotions.TIME_SLOW) && timeScale(e) == 0) {
		PotionEffect pe = e.getActivePotionEffect(ModPotions.TIME_SLOW);
		if (!pe.onUpdate(e)) {
			if (!e.world.isRemote) {
				e.removePotionEffect(ModPotions.TIME_SLOW);
			}
		}
	}

	if(e instanceof EntityDragon) {
		IPhase phase = ((EntityDragon) e).getPhaseManager().getCurrentPhase();
		if(phase.getType() != PhaseList.HOLDING_PATTERN && phase.getType() != PhaseList.DYING) {
			((EntityDragon) e).getPhaseManager().setPhase(PhaseList.HOLDING_PATTERN);
		}
	}
}
 
Example #19
Source File: TippedArrow.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@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();
}
 
Example #20
Source File: EntityLivingHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void setThirsty(EntityPlayer player, boolean b)
{
	if (b)
	{
		player.setSprinting(false);
		if(!player.isPotionActive(PotionTFC.THIRST_POTION))
			player.addPotionEffect(new PotionEffect(PotionTFC.THIRST_POTION, Integer.MAX_VALUE, 0, false, false));
	}
	else
	{
		player.removePotionEffect(PotionTFC.THIRST_POTION);
	}
}
 
Example #21
Source File: FovModifier.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
@InvokeEvent
public void fovChange(FovUpdateEvent event) {
    float base = 1.0F;

    if (event.getPlayer().isSprinting()) {
        base += (float) (0.15000000596046448 * Settings.SPRINTING_FOV_MODIFIER);
    }

    if (event.getPlayer().getItemInUse() != null && event.getPlayer().getItemInUse().getItem().equals(Items.bow)) {
        int duration = (int) Math.min(event.getPlayer().getItemInUseDuration(), MAX_BOW_TICKS);
        float modifier = MODIFIER_BY_TICK.get(duration);
        base -= modifier * Settings.BOW_FOV_MODIFIER;
    }

    Collection<PotionEffect> effects = event.getPlayer().getActivePotionEffects();
    for (PotionEffect effect : effects) {
        if (effect.getPotionID() == 1) {
            base += (MODIFIER_SPEED * (effect.getAmplifier() + 1) * Settings.SPEED_FOV_MODIFIER);
        }

        if (effect.getPotionID() == 2) {
            base += (MODIFIER_SLOWNESS * (effect.getAmplifier() + 1) * Settings.SLOWNESS_FOV_MODIFIER);
        }
    }

    event.setNewFov(base);
}
 
Example #22
Source File: NowYouSeeMe.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean isActive() {
    EntityClientPlayerMP player = Wrapper.INSTANCE.player();
    if (player == null) {
        return false;
    }

    if (player.isPotionActive(Potion.invisibility)) {
        PotionEffect activePotionEffect = player.getActivePotionEffect(Potion.invisibility);
        return activePotionEffect.getDuration() > 20000;
    }
    return false;
}
 
Example #23
Source File: ComponentBreathing.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public boolean hitEntity(ItemStack itemStack, EntityLivingBase entityLivingHit, EntityLivingBase player) {
	if(!player.worldObj.isRemote) {
		
		player.addPotionEffect(new PotionEffect(13, 1200, 0));
		
	}
	return false;
}
 
Example #24
Source File: PotionSteroid.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void removeAttributesModifiersFromEntity(EntityLivingBase entityLivingBaseIn, @Nonnull AbstractAttributeMap attributeMapIn, int amplifier) {
	ManaManager.forObject(entityLivingBaseIn)
			.setMana(0)
			.setBurnout(ManaManager.getMaxBurnout(entityLivingBaseIn))
			.close();
	entityLivingBaseIn.addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, 200, 3, true, true));
	entityLivingBaseIn.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 200, 3, true, true));
	entityLivingBaseIn.addPotionEffect(new PotionEffect(MobEffects.HUNGER, 200, 3, true, true));
	entityLivingBaseIn.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 200, 3, true, true));
	if (!(entityLivingBaseIn instanceof EntityPlayer) || !((EntityPlayer) entityLivingBaseIn).capabilities.isCreativeMode)
		entityLivingBaseIn.setHealth(0.5f);

	super.removeAttributesModifiersFromEntity(entityLivingBaseIn, attributeMapIn, amplifier);
}
 
Example #25
Source File: EntityCorruptionProjectile.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void onCollideWithPlayer(EntityPlayer entity) {
	PotionEffect effect = entity.getActivePotionEffect(ModPotions.ZACH_CORRUPTION);
	if (effect == null)
		entity.addPotionEffect(new PotionEffect(ModPotions.ZACH_CORRUPTION, 100, 0, true, false));
	else
		entity.addPotionEffect(new PotionEffect(ModPotions.ZACH_CORRUPTION, 100, effect.getAmplifier() + 1, true, false));
}
 
Example #26
Source File: Fluids.java    From BaseMetals with 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 #27
Source File: ComponentAdrenaline.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack, boolean worn) {
	int delay = itemStack.stackTagCompound.getInteger("adrenDelay_armor");
	if(!world.isRemote && delay > 0) {
		if(delay == 198) {
			//System.out.println("Crashing!");
			player.addPotionEffect(new PotionEffect(4, 200, 1));
			player.addPotionEffect(new PotionEffect(17, 200, 0));
		}
	}
}
 
Example #28
Source File: ItemFairyImbuedApple.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
	if(!worldIn.isRemote) {
		player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 60*20, 0, false, true));
		player.addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 60*20, 1, false, true));
		player.addPotionEffect(new PotionEffect(MobEffects.SPEED, 60*20, 0, false, true));
		player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 3*20, 3, false, true));
	}
}
 
Example #29
Source File: GuiHandyBag.java    From enderutilities with GNU Lesser General Public License v3.0 5 votes vote down vote up
protected void updateActivePotionEffects()
{
    boolean hasVisibleEffect = false;

    for (PotionEffect potioneffect : this.mc.player.getActivePotionEffects())
    {
        Potion potion = potioneffect.getPotion();

        if (potion.shouldRender(potioneffect))
        {
            hasVisibleEffect = true;
            break;
        }
    }

    if (this.mc.player.getActivePotionEffects().isEmpty() == false && hasVisibleEffect)
    {
        if (net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.client.event.GuiScreenEvent.PotionShiftEvent(this)))
        {
            this.guiLeft = (this.width - this.xSize) / 2;
        }
        else
        {
            this.guiLeft = 160 + (this.width - this.xSize - 200) / 2;
        }

        this.hasActivePotionEffects = true;
    }
    else
    {
        this.guiLeft = (this.width - this.xSize) / 2;
        this.hasActivePotionEffects = false;
    }
}
 
Example #30
Source File: Potions.java    From EnderZoo with Creative Commons Zero v1.0 Universal 5 votes vote down vote up
public Potions() {
  withering = new PotionType(WITHERING, new PotionEffect(MobEffects.WITHER, 900)).setRegistryName(EnderZoo.MODID, WITHERING);
  witheringLong = new PotionType(WITHERING, new PotionEffect(MobEffects.WITHER, 2400)).setRegistryName(EnderZoo.MODID, WITHERING_LONG);

  confusion = new PotionType(CONFUSION, new PotionEffect(MobEffects.NAUSEA, 900)).setRegistryName(EnderZoo.MODID, CONFUSION);
  confusionLong = new PotionType(CONFUSION, new PotionEffect(MobEffects.NAUSEA, 2400)).setRegistryName(EnderZoo.MODID, CONFUSION_LONG);

  if (Config.floatingPotionEnabled) {
    floatingPotion = FloatingPotion.create();
    floating = new PotionType(FLOATING, new PotionEffect(floatingPotion, Config.floatingPotionDuration)).setRegistryName(EnderZoo.MODID, FLOATING);
    floatingLong = new PotionType(FLOATING, new PotionEffect(floatingPotion, Config.floatingPotionDurationLong)).setRegistryName(EnderZoo.MODID, FLOATING_TWO);
    floatingTwo = new PotionType(FLOATING, new PotionEffect(floatingPotion, Config.floatingPotionTwoDuration, 1)).setRegistryName(EnderZoo.MODID, FLOATING_LONG);
  }

}