net.minecraft.util.EntitySelectors#net.minecraft.potion.PotionEffect源码实例Demo

下面列出了net.minecraft.util.EntitySelectors#net.minecraft.potion.PotionEffect 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: Et-Futurum   文件: EntityLingeringEffect.java
@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;
	}
}
 
源代码2 项目: Electro-Magic-Tools   文件: ItemNanoGoggles.java
@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));
        }
    }
}
 
源代码3 项目: NotEnoughItems   文件: ContainerPotionCreator.java
@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);
}
 
源代码4 项目: ForbiddenMagic   文件: ItemBloodRapier.java
@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;
}
 
源代码5 项目: ToroQuest   文件: EntitySpawning.java
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));
}
 
源代码6 项目: LiquidBounce   文件: Fullbright.java
@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;
    }
}
 
源代码7 项目: Hyperium   文件: VanillaEnhancementsHud.java
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();
}
 
源代码8 项目: GT-Classic   文件: GTTileEchotron.java
@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);
	}
}
 
源代码9 项目: GT-Classic   文件: GTItemEchotron.java
@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;
}
 
源代码10 项目: Et-Futurum   文件: LingeringPotion.java
@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);
		}
	}
}
 
源代码11 项目: Artifacts   文件: ComponentAdrenaline.java
@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));
				
			//}
		}
	}
}
 
源代码12 项目: Wizardry   文件: IPotionEffectExplodable.java
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());
		}
	});
}
 
源代码13 项目: Artifacts   文件: ComponentObscurity.java
@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;
	}
 
源代码14 项目: Wizardry   文件: EventHandler.java
@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());
				}
			}
		}
	}
}
 
源代码15 项目: Wizardry   文件: ModuleEffectVanish.java
@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;
}
 
源代码16 项目: NotEnoughItems   文件: GuiPotionCreator.java
private PotionEffect getEffect(int id) {
    ItemStack potion = container.potionInv.getStackInSlot(0);
    if (potion != null && potion.hasTagCompound() && potion.getTagCompound().hasKey("CustomPotionEffects")) {
        NBTTagList potionTagList = potion.getTagCompound().getTagList("CustomPotionEffects", 10);
        for (int i = 0; i < potionTagList.tagCount(); i++) {
            PotionEffect effect = PotionEffect.readCustomPotionEffectFromNBT(potionTagList.getCompoundTagAt(i));
            if (effect.getPotionID() == id)
                return effect;
        }
    }
    return null;
}
 
private static void populateCompressedOxygen()
{
    Fluid tCompressedOxygenFluid = ModFluidManager.GetNewFluid("CompressedOxygen");
    tCompressedOxygenFluid.setGaseous(true);
    tCompressedOxygenFluid.setViscosity(1);
    tCompressedOxygenFluid.setDensity(1);
    tCompressedOxygenFluid.setLuminosity(0);
    tCompressedOxygenFluid.setTemperature(295);
    tCompressedOxygenFluid.setRarity(EnumRarity.epic); // The rarity of the fluid. Used primarily in tool tips.

    _mCompressedOxygen = new ModSimpleBaseFluid(tCompressedOxygenFluid, Material.water);


    // Add potion effects to the fluid if player steps into a pool
    // Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
    // Level 0: Potion Level I
    // Level 1: Potion Level II
    // ...
    // For the duration: Set it low to vanish the effect as soon as the player leaves the pool
    // If you set the duration to 200, the potion timer will start to tick for 10 seconds after
    // the player has left the pool.
    _mCompressedOxygen.addPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    // Same for stacking potion effects, except that you want to set the duration to the amount which will be
    // ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
    // fluid block
    _mCompressedOxygen.addStackingPotionEffect(new PotionEffect(Potion.weakness.id, 20, 3));

    _mCompressedOxygen.setRegisterBucket(false); // don't register a bucket
}
 
源代码18 项目: Wizardry   文件: PotionLowGrav.java
@SubscribeEvent
public void fall(LivingFallEvent event) {
	EntityLivingBase entity = event.getEntityLiving();
	if (!entity.isPotionActive(this)) return;

	PotionEffect effect = entity.getActivePotionEffect(this);
	if (effect == null) return;

	event.setDistance((float) (event.getDistance() / (effect.getAmplifier() + 0.5)));
}
 
源代码19 项目: Artifacts   文件: ComponentFoodie.java
@Override
	public void onHeld(ItemStack par1ItemStack, World par2World,Entity par3Entity, int par4, boolean par5) {
		//onUpdate(par1ItemStack, par2World, par3Entity, par4, par5);
		if(!par2World.isRemote) {
			if(par3Entity instanceof EntityPlayer) {
				EntityPlayer ent = (EntityPlayer) par3Entity;
				if(ent.getFoodStats().getFoodLevel() < 11) {
					ent.addPotionEffect(new PotionEffect(23, 10, 0));
//					ent.addPotionEffect(new PotionEffect(9, 200, 0));
					par1ItemStack.damageItem(1, ent);
				}
			}
		}
	}
 
源代码20 项目: NewHorizonsCoreMod   文件: OvenGlove.java
private boolean isGlovesResistActive ( EntityPlayer tPlayer )
{
  if( isResistActive( tPlayer ) )
  {
    PotionEffect potion = tPlayer.getActivePotionEffect( Potion.fireResistance );
    if( potion.getDuration() <= potionDuration && potion.getAmplifier() == potionAmplifier && potion.getIsAmbient() == potionAmbient ) {
      return true;
    }
  }
  return false;
}
 
源代码21 项目: Sakura_mod   文件: DrinksAlcoholic.java
@Override
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
	Random rand = worldIn.rand;
	if(rand.nextInt(10)<=7) 
		player.addPotionEffect(new PotionEffect(ForgeRegistries.POTIONS.getValue(new ResourceLocation("minecraft", "nausea")), 600, 0));
	super.onFoodEaten(stack, worldIn, player);
}
 
源代码22 项目: Production-Line   文件: ItemDiamondApple.java
@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);
}
 
源代码23 项目: Sakura_mod   文件: PotionAttackPotion.java
@SubscribeEvent
public void onAttacking(AttackEntityEvent event) {
	if(event.getTarget() instanceof EntityLivingBase){
		EntityLivingBase target = (EntityLivingBase) event.getTarget();
		EntityPlayer player = event.getEntityPlayer();
		if(player.isPotionActive(this)){
			target.addPotionEffect(new PotionEffect(potion,lvl*300, lvl));
		}
	}
}
 
源代码24 项目: Wizardry   文件: CommandTeleportUnderworld.java
@Override
public void execute(@NotNull MinecraftServer server, @NotNull ICommandSender sender, @NotNull String[] args) {
	Entity entity = sender.getCommandSenderEntity();
	if (entity instanceof EntityPlayerMP) {
		EntityPlayer player = ((EntityPlayer) entity);
		fallResetter.add(player.getUniqueID());
		TeleportUtil.teleportToDimension(player, Wizardry.underWorld.getId(), 0, 300, 0);
		player.addPotionEffect(new PotionEffect(ModPotions.NULLIFY_GRAVITY, 100, 0, true, false));
	} else notifyCommandListener(sender, this, "wizardry.command.notplayer");
}
 
源代码25 项目: HexxitGear   文件: BuffThiefSet.java
@Override
public void applyPlayerBuffs(EntityPlayer player) {
    player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, 20, 0));
    player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 21 * 20, 0));
    player.landMovementFactor = 0.15F;
    player.jumpMovementFactor = player.landMovementFactor * 0.5F;

    player.stepHeight = 1.003F;
}
 
源代码26 项目: seppuku   文件: PotionUtil.java
public static String getFriendlyPotionName(PotionEffect potionEffect) {
    String effectName = I18n.format(potionEffect.getPotion().getName());
    if (potionEffect.getAmplifier() == 1) {
        effectName = effectName + " " + I18n.format("enchantment.level.2");
    } else if (potionEffect.getAmplifier() == 2) {
        effectName = effectName + " " + I18n.format("enchantment.level.3");
    } else if (potionEffect.getAmplifier() == 3) {
        effectName = effectName + " " + I18n.format("enchantment.level.4");
    }

    return effectName;
}
 
源代码27 项目: Wizardry   文件: PotionSteroid.java
@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);
}
 
源代码28 项目: GregTech   文件: BlockPotionFluid.java
@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);
        }
    }
}
 
源代码29 项目: EnderZoo   文件: Potions.java
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);
  }

}
 
源代码30 项目: Hyperium   文件: FovModifier.java
@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);
}