net.minecraft.init.MobEffects Java Examples
The following examples show how to use
net.minecraft.init.MobEffects.
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: VanillaWares.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleSpiderNightVision(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); if (CyberwareAPI.isCyberwareInstalled(e, new ItemStack(Items.SPIDER_EYE))) { e.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, Integer.MAX_VALUE, -53, true, false)); } else { PotionEffect effect = e.getActivePotionEffect(MobEffects.NIGHT_VISION); if (effect != null && effect.getAmplifier() == -53) { e.removePotionEffect(MobEffects.NIGHT_VISION); } } }
Example #2
Source File: ItemWand.java From YouTubeModdingTutorial with MIT License | 6 votes |
private void levitateEntity(World world, EntityPlayer player) { PlayerMana playerMana = PlayerProperties.getPlayerMana(player); if (playerMana.getMana() >= .1f) { world.playSound(null, player.getPosition(), SoundEvents.ENTITY_ENDERPEARL_THROW, SoundCategory.NEUTRAL, 1.0f, 1.0f); playerMana.setMana(playerMana.getMana() - .1f); RayTraceTools.Beam beam = new RayTraceTools.Beam(world, player, 20); RayTraceTools.rayTrace(beam, entity -> { if (entity instanceof EntityLivingBase) { ((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 60, 1)); return true; } else { return false; } }); } }
Example #3
Source File: EntitySpawning.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
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 #4
Source File: EntityMage.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
protected void handleAttackLogicUpdate() { PotionType potiontype = null; if (this.rand.nextFloat() < 0.15F && this.isInsideOfMaterial(Material.WATER) && !this.isPotionActive(MobEffects.WATER_BREATHING)) { potiontype = PotionTypes.WATER_BREATHING; } else if (this.rand.nextFloat() < 0.15F && this.isBurning() && !this.isPotionActive(MobEffects.FIRE_RESISTANCE)) { potiontype = PotionTypes.FIRE_RESISTANCE; } else if (this.rand.nextFloat() < 0.05F && this.getHealth() < this.getMaxHealth()) { potiontype = PotionTypes.HEALING; } else if (this.rand.nextFloat() < 0.5F && this.getAttackTarget() != null && !this.isPotionActive(MobEffects.SPEED) && this.getAttackTarget().getDistanceSq(this) > 121.0D) { potiontype = PotionTypes.SWIFTNESS; } if (potiontype != null) { this.world.playSound(null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_DRINK, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.setItemStackToSlot(EntityEquipmentSlot.OFFHAND, PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), potiontype)); this.attackTimer = 10; this.setAggressive(true); IAttributeInstance iattributeinstance = this.getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED); iattributeinstance.removeModifier(MODIFIER); iattributeinstance.applyModifier(MODIFIER); } }
Example #5
Source File: EntityMage.java From ToroQuest with GNU General Public License v3.0 | 6 votes |
protected void attackWithPotion(EntityLivingBase target) { double targetY = target.posY + (double) target.getEyeHeight() - 1.100000023841858D; double targetX = target.posX + target.motionX - this.posX; double d2 = targetY - this.posY; double targetZ = target.posZ + target.motionZ - this.posZ; float f = MathHelper.sqrt(targetX * targetX + targetZ * targetZ); PotionType potiontype = PotionTypes.HARMING; if (f >= 8.0F && !target.isPotionActive(MobEffects.SLOWNESS)) { potiontype = PotionTypes.SLOWNESS; } else if (target.getHealth() >= 8.0F && !target.isPotionActive(MobEffects.POISON)) { potiontype = PotionTypes.POISON; } else if (f <= 3.0F && !target.isPotionActive(MobEffects.WEAKNESS) && this.rand.nextFloat() < 0.25F) { potiontype = PotionTypes.WEAKNESS; } EntityPotion entitypotion = new EntityPotion(this.world, this, PotionUtils.addPotionToItemStack(new ItemStack(Items.SPLASH_POTION), potiontype)); entitypotion.rotationPitch -= -20.0F; entitypotion.shoot(targetX, d2 + (double) (f * 0.2F), targetZ, 0.75F, 8.0F); this.world.playSound((EntityPlayer) null, this.posX, this.posY, this.posZ, SoundEvents.ENTITY_WITCH_THROW, this.getSoundCategory(), 1.0F, 0.8F + this.rand.nextFloat() * 0.4F); this.world.spawnEntity(entitypotion); }
Example #6
Source File: ModuleEffectVanish.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@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 #7
Source File: GTItemEchotron.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@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 #8
Source File: GTTileEchotron.java From GT-Classic with GNU Lesser General Public License v3.0 | 6 votes |
@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 #9
Source File: ArmorLogicRebreather.java From GregTech with GNU Lesser General Public License v3.0 | 6 votes |
@Override public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { IElectricItem electricItem = itemStack.getCapability(GregtechCapabilities.CAPABILITY_ELECTRIC_ITEM, null); if (electricItem.getCharge() >= energyUsagePerTick) { if (player.isInsideOfMaterial(Material.WATER) && world.isRemote && world.getTotalWorldTime() % 20 == 0L) { Vec3d pos = player.getPositionVector().add(new Vec3d(0.0, player.getEyeHeight(), 0.0)); Particle particle = new ParticleBubble.Factory().createParticle(0, world, pos.x, pos.y, pos.z, 0.0, 0.0, 0.0); particle.setMaxAge(Integer.MAX_VALUE); Minecraft.getMinecraft().effectRenderer.addEffect(particle); } if (player.isInsideOfMaterial(Material.WATER) && !player.isPotionActive(MobEffects.WATER_BREATHING)) { if (player.getAir() < 300 && drainActivationEnergy(electricItem)) { player.setAir(Math.min(player.getAir() + 1, 300)); } } } }
Example #10
Source File: ItemCybereyeUpgrade.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleNightVision(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); ItemStack testItem = new ItemStack(this, 1, 0); if (CyberwareAPI.isCyberwareInstalled(e, testItem) && EnableDisableHelper.isEnabled(CyberwareAPI.getCyberware(e, testItem))) { e.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, Integer.MAX_VALUE, 53, true, false)); } else { PotionEffect effect = e.getActivePotionEffect(MobEffects.NIGHT_VISION); if (effect != null && effect.getAmplifier() == 53) { e.removePotionEffect(MobEffects.NIGHT_VISION); } } }
Example #11
Source File: ModuleEffectTimeSlow.java From Wizardry with GNU Lesser General Public License v3.0 | 6 votes |
@Override @SuppressWarnings("unused") public boolean runOnStart(@Nonnull World world, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { BlockPos targetPos = spell.getTargetPos(); Entity targetEntity = spell.getVictim(world); Entity caster = spell.getCaster(world); if (targetEntity instanceof EntityLivingBase && !((EntityLivingBase) targetEntity).isPotionActive(ModPotions.TIME_SLOW)) { double potency = spellRing.getAttributeValue(world, AttributeRegistry.POTENCY, spell); double duration = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell) * 10; if (!spellRing.taxCaster(world, spell, true)) return false; ((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(ModPotions.TIME_SLOW, (int) duration, (int) potency, false, false)); ((EntityLivingBase) targetEntity).addPotionEffect(new PotionEffect(MobEffects.MINING_FATIGUE, (int) duration, (int) potency, false, false)); } return true; }
Example #12
Source File: BrightnessModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Listener public void onUpdate(EventPlayerUpdate event) { if (event.getStage() == EventStageable.EventStage.PRE) { switch (this.mode.getValue()) { case GAMMA: Minecraft.getMinecraft().gameSettings.gammaSetting = 1000; break; case POTION: Minecraft.getMinecraft().player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, 5210)); break; case TABLE: if (this.world != Minecraft.getMinecraft().world) { if (Minecraft.getMinecraft().world != null) { for (int i = 0; i <= 15; ++i) { Minecraft.getMinecraft().world.provider.getLightBrightnessTable()[i] = 1.0f; } } this.world = Minecraft.getMinecraft().world; } break; } } }
Example #13
Source File: BrightnessModule.java From seppuku with GNU General Public License v3.0 | 6 votes |
@Override public void onDisable() { super.onDisable(); if (this.mode.getValue() == Mode.GAMMA) { Minecraft.getMinecraft().gameSettings.gammaSetting = this.lastGamma; } if (this.mode.getValue() == Mode.POTION && Minecraft.getMinecraft().player != null) { Minecraft.getMinecraft().player.removePotionEffect(MobEffects.NIGHT_VISION); } if (this.mode.getValue() == Mode.TABLE) { if (Minecraft.getMinecraft().world != null) { float f = 0.0F; for (int i = 0; i <= 15; ++i) { float f1 = 1.0F - (float) i / 15.0F; Minecraft.getMinecraft().world.provider.getLightBrightnessTable()[i] = (1.0F - f1) / (f1 * 3.0F + 1.0F) * 1.0F + 0.0F; } } } }
Example #14
Source File: ItemCyberheart.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent(priority=EventPriority.HIGHEST) public void power(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); ItemStack test = new ItemStack(this); if (e.ticksExisted % 20 == 0 && CyberwareAPI.isCyberwareInstalled(e, test)) { if (!CyberwareAPI.getCapability(e).usePower(test, getPowerConsumption(test))) { e.attackEntityFrom(EssentialsMissingHandler.heartless, Integer.MAX_VALUE); } } if (CyberwareAPI.isCyberwareInstalled(e, new ItemStack(this))) { e.removePotionEffect(MobEffects.WEAKNESS); } }
Example #15
Source File: ItemFootUpgrade.java From Cyberware with MIT License | 6 votes |
@SubscribeEvent public void handleHorseMove(LivingUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); if (e instanceof EntityHorse) { EntityHorse horse = (EntityHorse) e; for (Entity pass : horse.getPassengers()) { if (pass instanceof EntityLivingBase && CyberwareAPI.isCyberwareInstalled(pass, new ItemStack(this, 1, 0))) { horse.addPotionEffect(new PotionEffect(MobEffects.SPEED, 1, 5, true, false)); break; } } } }
Example #16
Source File: PotionCrash.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent(priority = EventPriority.LOWEST, receiveCanceled = true) public void fall(LivingFallEvent e) { EntityLivingBase entitySource = e.getEntityLiving(); PotionEffect crash = entitySource.getActivePotionEffect(this); if (crash == null) return; PotionEffect jump = entitySource.getActivePotionEffect(MobEffects.JUMP_BOOST); float f = (jump == null) ? 0.0f : (jump.getAmplifier() + 1); float damage = MathHelper.clamp((e.getDistance() - 3.0f - f) * e.getDamageMultiplier() * 2, 0, 10f); float range = damage / 10f + Math.max(crash.getAmplifier(), 5); if (damage > 0.0f) { e.setDamageMultiplier(e.getDamageMultiplier() / (crash.getAmplifier() + 2)); List<EntityLivingBase> entities = entitySource.world.getEntitiesWithinAABB(EntityLivingBase.class, entitySource.getEntityBoundingBox().grow(range * 2)); entities.stream().filter(entity -> entity != entitySource && entity.onGround).forEach(entity -> { entity.attackEntityFrom(damageSourceEarthquake(entitySource), range); entity.motionY = range / 10.0; entity.velocityChanged = true; }); if (!entitySource.world.isRemote) for (BlockPos pos : BlockPos.getAllInBoxMutable( new BlockPos(entitySource.getPositionVector()) .add(-range, -2, -range), new BlockPos(entitySource.getPositionVector()) .add(range, 0, range))) { IBlockState state = entitySource.world.getBlockState(pos); if (state.isFullCube()) entitySource.world.playEvent(2001, pos.toImmutable(), Block.getStateId(state)); } } }
Example #17
Source File: ModuleEffectDecay.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { // ; Entity targetEntity = spell.getVictim(world); BlockPos targetPos = spell.getTargetPos(); // Entity caster = spell.getCaster(world); if (targetPos == null) return false; double potency = spellRing.getAttributeValue(world, AttributeRegistry.POTENCY, spell) / 5; // double area = spellRing.getAttributeValue(AttributeRegistry.AREA, spell) / 2; double time = spellRing.getAttributeValue(world, AttributeRegistry.DURATION, spell) * 10; if (!spellRing.taxCaster(world, spell, true)) return false; world.playSound(null, targetPos, ModSounds.SLOW_MOTION_IN, SoundCategory.NEUTRAL, 1, RandUtil.nextFloat(0.1f, 0.5f)); if (targetEntity instanceof EntityLivingBase) { EntityLivingBase target = (EntityLivingBase) targetEntity; target.addPotionEffect(new PotionEffect(MobEffects.WITHER, (int) time, (int) potency)); target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, (int) time, (int) potency)); } if (targetPos != null) { // TODO: Add block decay } return true; }
Example #18
Source File: ItemFairyImbuedApple.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@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 #19
Source File: PotionSteroid.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@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 #20
Source File: ItemHeartUpgrade.java From Cyberware with MIT License | 5 votes |
protected float applyPotionDamageCalculations(EntityLivingBase e, DamageSource source, float damage) { if (source.isDamageAbsolute()) { return damage; } else { if (e.isPotionActive(MobEffects.RESISTANCE) && source != DamageSource.outOfWorld) { int i = (e.getActivePotionEffect(MobEffects.RESISTANCE).getAmplifier() + 1) * 5; int j = 25 - i; float f = damage * (float)j; damage = f / 25.0F; } if (damage <= 0.0F) { return 0.0F; } else { int k = EnchantmentHelper.getEnchantmentModifierDamage(e.getArmorInventoryList(), source); if (k > 0) { damage = CombatRules.getDamageAfterMagicAbsorb(damage, (float)k); } return damage; } } }
Example #21
Source File: ItemCybereyes.java From Cyberware with MIT License | 5 votes |
@SubscribeEvent public void handleBlindnessImmunity(CyberwareUpdateEvent event) { EntityLivingBase e = event.getEntityLiving(); if (CyberwareAPI.isCyberwareInstalled(e, new ItemStack(this))) { e.removePotionEffect(MobEffects.BLINDNESS); } }
Example #22
Source File: ItemDiamondApple.java From Production-Line with MIT License | 5 votes |
@Override protected void onFoodEaten(ItemStack itemStack, World world, @Nonnull EntityPlayer player) { if (!world.isRemote) { player.addPotionEffect(new PotionEffect(MobEffects.ABSORPTION, 2400, 0)); player.addPotionEffect(new PotionEffect(MobEffects.REGENERATION, 6000, 4)); if (itemStack.getItemDamage() == 1) { player.addPotionEffect(new PotionEffect(MobEffects.HEALTH_BOOST, 12000, 0)); player.addPotionEffect(new PotionEffect(MobEffects.RESISTANCE, 6000, 4)); player.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 6000, 0)); } } super.onFoodEaten(itemStack, world, player); }
Example #23
Source File: ModuleEffectPoisonCloud.java From Wizardry with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean run(@NotNull World world, ModuleInstanceEffect instance, @Nonnull SpellData spell, @Nonnull SpellRing spellRing) { Vec3d position = spell.getTarget(world); BlockPos pos = spell.getTargetPos(); if (position == null || pos == null) return true; if (!spellRing.taxCaster(world, spell, true)) return false; double potency = spellRing.getAttributeValue(world, AttributeRegistry.POTENCY, spell); double area = spellRing.getAttributeValue(world, AttributeRegistry.AREA, spell); if (world.getTotalWorldTime() % 2 == 0) world.playSound(null, pos, ModSounds.FIZZING_LOOP, SoundCategory.NEUTRAL, RandUtil.nextFloat(0.6f, 1f), RandUtil.nextFloat(0.1f, 4f)); for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(null, new AxisAlignedBB(new BlockPos(position)).grow(area, area, area))) { if (entity instanceof EntityLivingBase) { EntityLivingBase living = (EntityLivingBase) entity; if (potency >= 3) { living.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 100)); } living.addPotionEffect(new PotionEffect(MobEffects.POISON, 60, (int) (potency / 3))); } } return true; }
Example #24
Source File: Potions.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
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); } }
Example #25
Source File: EnchantmentWitherArrow.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override public void onEntityDamaged(EntityLivingBase user, Entity entityHit, int level) { //calc damage modifier if (entityHit instanceof EntityLivingBase) { ((EntityLivingBase) entityHit).addPotionEffect(new PotionEffect(MobEffects.WITHER, Config.enchantmentWitherArrowDuration)); } }
Example #26
Source File: EnchantmentWitherWeapon.java From EnderZoo with Creative Commons Zero v1.0 Universal | 5 votes |
@Override public void onEntityDamaged(EntityLivingBase user, Entity entityHit, int level) { //calc damage modifier if (entityHit instanceof EntityLivingBase) { ((EntityLivingBase) entityHit).addPotionEffect(new PotionEffect(MobEffects.WITHER, Config.enchantmentWitherWeaponDuration)); } }
Example #27
Source File: EnchantmentEnderDamage.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@Override public void onEntityDamaged(EntityLivingBase hurtEntity, Entity damagingEntity, int level) { String entityName = EntityList.getEntityString(hurtEntity); if (hurtEntity instanceof EntityEnderman || hurtEntity instanceof EntityDragon || (entityName != null && entityName.toLowerCase().contains("ender"))) { hurtEntity.addPotionEffect(new PotionEffect(MobEffects.WEAKNESS, level * 200, Math.max(1, (5 * level) / 7))); hurtEntity.addPotionEffect(new PotionEffect(MobEffects.POISON, level * 200, Math.max(1, (5 * level) / 7))); } }
Example #28
Source File: EventHandlers.java From GregTech with GNU Lesser General Public License v3.0 | 5 votes |
@SubscribeEvent public static void onEndermanTeleportEvent(EnderTeleportEvent event) { if (event.getEntity() instanceof EntityEnderman && event.getEntityLiving() .getActivePotionEffect(MobEffects.WEAKNESS) != null) { event.setCanceled(true); } }
Example #29
Source File: GTItemCloakingDevice.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@Override public boolean onItemActive(ItemStack stack, World worldIn, Entity entityIn, int slot, boolean selected) { if (entityIn instanceof EntityPlayer) { EntityPlayer player = (EntityPlayer) entityIn; player.addPotionEffect(new PotionEffect(MobEffects.INVISIBILITY, 5, 0, false, false)); player.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 18, 0, false, false)); } return true; }
Example #30
Source File: GTItemSpringBoots.java From GT-Classic with GNU Lesser General Public License v3.0 | 5 votes |
@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); } } }