Java 类net.minecraftforge.client.event.FOVUpdateEvent 实例源码

项目:CrystalMod    文件:ItemBlowGun.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
    ItemStack currentItem = fovEvt.getEntity().getActiveItemStack();
    if (ItemStackTools.isNullStack(currentItem) || currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
        return;
    }

    int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
    float ratio = drawDuration / (float) 20.0F;

    if (ratio > 1.0F) {
        ratio = 1.0F;
    } else {
        ratio *= ratio;
    }
    fovEvt.setNewfov((1.0F - ratio * 0.35f));
}
项目:CrystalMod    文件:ItemDarkIronBow.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
  ItemStack currentItem = fovEvt.getEntity().getActiveItemStack();
  if (ItemStackTools.isNullStack(currentItem) || currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
    return;
  }

  int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
  float ratio = drawDuration / (float) getDrawTime(currentItem);

  if (ratio > 1.0F) {
    ratio = 1.0F;
  } else {
    ratio *= ratio;
  }
  fovEvt.setNewfov((1.0F - ratio * fovMultiplier));

}
项目:TeambattleMod    文件:ClientEventHandler.java   
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
    EntityPlayer player = event.entity;
    if (!TConfigs.fovAtBowOrSpeed) {
        if (player.isUsingItem()) {
            if (player.getItemInUse().getItem() == TItems.teambattlebow || player.getItemInUse().getItem() == Items.bow) {
                event.newfov = 1.0f;
                return;
            }
        }
        if (player.getActivePotionEffect(Potion.moveSpeed) != null) {
            event.newfov = 1.0f;
            return;
        }
    }
    if (player.isUsingItem() && player.getItemInUse().getItem() == TItems.teambattlebow) {
        int s = player.getItemInUseDuration();
        float f = s * 0.3F;
        if (f > 4.0F) {
            f = 4.0F;
        }
        event.newfov *= 1.0F - f * 0.125F;
    }
}
项目:mod_quiver    文件:ItemCustomBow.java   
/**
     * Helper function for getModel() that allows subclasses to easily overwrite custom animation
     * sequences for bow pull
     * 
     * @param useTime
     * @return
     *//*
    protected int getModelVariation(int useTime) {
        if(useTime >= 21) {
            return 2;
        } else if(useTime > 10) {
            return 1;
        } else {
            return 0;
        }
    }
*/
    @SubscribeEvent
    public void fovUpdate(FOVUpdateEvent event) {
        if (event.getEntity() instanceof EntityPlayer) {
            if (event.getEntity().isHandActive() && event.getEntity().getActiveItemStack().getItem() == this) {
                float fovModifier = getNewFovModifier(event.getEntity().getItemInUseMaxCount()); // getItemInUseMaxCount() seems to be mis-named.  functionally, it is like the old getItemUseDuration()
                float fov = 1.0f;
                fov *= 1.0F - fovModifier * 0.15F;
//              MEMLogger.info("ItemCustomBow fovUpdate(): itemUseDuration = " + event.entity.getItemInUseDuration() + "; fovModifier = " + fovModifier + "; newfov = " + fov);
                event.setNewfov(fov);
            }
        }
    }
项目:ZeroQuest    文件:FOVEvent.java   
@SubscribeEvent
   public void FOVBowUpdate(FOVUpdateEvent event){
    if(event.entity.getItemInUse() != null){
        if(event.entity.getItemInUse().getItem() instanceof ItemNileBow){
            int i = event.entity.getItemInUseDuration();
            float f1 = (float)i / 20.0F;

            if (f1 > 1.0F)
            {
                f1 = 1.0F;
            }
            else
            {
                f1 *= f1;
            }

            event.newfov *= 1.0F - f1 * 0.15F;
        }
    }
}
项目:AbyssalCraft    文件:AbyssalCraftClientEventHooks.java   
@SubscribeEvent
public void onUpdateFOV(FOVUpdateEvent event) {
    float fov = event.getFov();

    if( event.getEntity().isHandActive() && event.getEntity().getActiveItemStack() != null
            && event.getEntity().getActiveItemStack().getItem() == ACItems.coralium_longbow) {
        int duration = event.getEntity().getItemInUseCount();
        float multiplier = duration / 20.0F;

        if( multiplier > 1.0F )
            multiplier = 1.0F;
        else
            multiplier *= multiplier;

        fov *= 1.0F - multiplier * 0.15F;
    }

    event.setNewfov(fov);
}
项目:GaiaMod    文件:GaiaModEventHandler.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
    IAttributeInstance atinst = event.entity
            .getEntityAttribute(SharedMonsterAttributes.movementSpeed);
    AttributeModifier mod;
    if ((mod = atinst.getModifier(wtvID)) != null) {
        event.newfov = (event.newfov * 2.0f) - 1.0f; // Reversal operation,
                                                        // as seen in
                                                        // EntityPlayerSP
        event.newfov = event.newfov / (float) (1.0 + mod.getAmount()); // Earth
                                                                        // speed
                                                                        // modifier
        event.newfov = (event.newfov + 1.0f) / 2.0f;
    }
}
项目:EnderZoo    文件:ItemGuardiansBow.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
  ItemStack currentItem = fovEvt.getEntity().getHeldItemMainhand();
  if(currentItem == null || currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
    return;
  }

  int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
  float ratio = drawDuration / (float) getDrawTime();

  if(ratio > 1.0F) {
    ratio = 1.0F;
  } else {
    ratio *= ratio;
  }
  fovEvt.setNewfov((1.0F - ratio * fovMultiplier));

}
项目:RandomAdditions    文件:EventHandlerRandom.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void getFOV(FOVUpdateEvent event)
{
    if (event.entity.isUsingItem() && event.entity.getItemInUse().getItem() == RandomAdditions.tools)
       {
           int i = event.entity.getItemInUseDuration();
           Tool tool = ItemTool.getTool(event.entity.getItemInUse());
           if(tool == ItemTool.bow)
           {
            float f1 = (float)i / ToolBow.getSpan(event.entity, event.entity.getItemInUse());

            if (f1 > 1.0F)
            {
                f1 = 1.0F;
            }
            else
            {
                f1 *= f1;
            }

            event.newfov *= 1.0F - f1 * 0.3F;
           }
       }
}
项目:EnderIO    文件:SpeedController.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public static void handleFovUpdate(@Nonnull FOVUpdateEvent evt) {

  if (ignoreFovEvent) {
    return;
  }

  EntityPlayer player = NullHelper.notnullF(evt.getEntity(), "FOVUpdateEvent has no player");

  if (clearModifiers(player)) {
    // set the same as vanilla does without our speed buff
    evt.setNewfov(getVanillaFovModifier(player));
    setModifiers(player);
  }
}
项目:EnderIO    文件:ItemDarkSteelBow.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onFovUpdateEvent(FOVUpdateEvent fovEvt) {
  ItemStack currentItem = fovEvt.getEntity().getHeldItemMainhand();
  if (currentItem.getItem() != this || fovEvt.getEntity().getItemInUseCount() <= 0) {
    return;
  }

  int drawDuration = getMaxItemUseDuration(currentItem) - fovEvt.getEntity().getItemInUseCount();
  float ratio = drawDuration / (float) getDrawTime(currentItem);

  if (ratio > 1.0F) {
    ratio = 1.0F;
  } else {
    ratio *= ratio;
  }

  float mult = (float) Config.darkSteelBowFovMultipliers[0];
  EnergyUpgradeHolder upgrade = EnergyUpgradeManager.loadFromItem(currentItem);
  if (upgrade != null && upgrade.getEnergy() > 0) {
    mult = (float) Config.darkSteelBowFovMultipliers[upgrade.getUpgrade().getLevel() + 1];
  }
  fovEvt.setNewfov((1.0F - ratio * mult));
}
项目:Thermionics    文件:Thermionics.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void updateFOV(FOVUpdateEvent event) {
    if (event.getEntity().getActivePotionEffect(Thermionics.POTION_EFFORTLESS_SPEED)!=null) {
        event.setNewfov(1.0f);
    }
}
项目:Mods    文件:BlockEventBus.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void getFov(FOVUpdateEvent event) {
    if (!event.getEntity().getHeldItem(EnumHand.MAIN_HAND).isEmpty()
            && event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof TNTCannon)
        if (!event.getEntity().getActiveItemStack().isEmpty()
                && ((TNTCannon) event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem())
                        .getType(event.getEntity().getHeldItem(EnumHand.MAIN_HAND)) == 5)
            event.setNewfov(event.getNewfov() * 0.4f);
}
项目:Mods    文件:TF2EventsClient.java   
@SubscribeEvent
public void getFov(FOVUpdateEvent event) {
    if (event.getEntity().getHeldItem(EnumHand.MAIN_HAND) != null && event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemUsable)
        if (event.getEntity().getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemSniperRifle && event.getEntity().getCapability(TF2weapons.WEAPONS_CAP, null).isCharging()) {
            event.setNewfov(event.getFov() * 0.55f);
        } else if (event.getEntity().getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getModifier(ItemMinigun.slowdownUUID) != null) {
            event.setNewfov(event.getFov() * 1.4f);
        }
}
项目:Aether-Legacy    文件:AetherClientEvents.java   
@SubscribeEvent
public void onBowPulled(FOVUpdateEvent event)
{
    EntityPlayer player = Minecraft.getMinecraft().thePlayer;

    if (player == null || (player != null && player.getActiveItemStack() == null))
    {
        return;
    }

    Item item = player.getActiveItemStack().getItem();

    if (item == ItemsAether.phoenix_bow)
    {
        int i = player.getItemInUseMaxCount();
        float f1 = (float)i / 20.0F;

        if (f1 > 1.0F)
        {
            f1 = 1.0F;
        }
        else
        {
            f1 = f1 * f1;
        }

        float original = event.getFov();

        original *= 1.0F - f1 * 0.15F;

        event.setNewfov(original);
    }
}
项目:TFC2    文件:EntityLivingHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void handleFOV(FOVUpdateEvent event)
{
    EntityPlayer player = event.getEntity();

    // Calculate FOV based on the variable draw speed of the bow depending on player armor.
    //Removed on port
    /*if (player.isUsingItem() && player.getItemInUse().getItem() instanceof ItemCustomBow)
    {
        float fov = 1.0F;
        int duration = player.getItemInUseDuration();
        float speed = ItemCustomBow.getUseSpeed(player);
        float force = duration / speed;

        if (force > 1.0F)
        {
            force = 1.0F;
        }
        else
        {
            force *= force;
        }

        fov *= 1.0F - force * 0.15F;
        event.newfov = fov;
    }*/
}
项目:ARKCraft-Code    文件:ClientEventHandler.java   
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent evt)
{
    if (mc.gameSettings.thirdPersonView == 0 && showScopeOverlap)
    {
        evt.newfov = 1 / 6.0F;
    }
}
项目:TFC2    文件:EntityLivingHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void handleFOV(FOVUpdateEvent event)
{
    EntityPlayer player = event.getEntity();

    // Calculate FOV based on the variable draw speed of the bow depending on player armor.
    //Removed on port
    /*if (player.isUsingItem() && player.getItemInUse().getItem() instanceof ItemCustomBow)
    {
        float fov = 1.0F;
        int duration = player.getItemInUseDuration();
        float speed = ItemCustomBow.getUseSpeed(player);
        float force = duration / speed;

        if (force > 1.0F)
        {
            force = 1.0F;
        }
        else
        {
            force *= force;
        }

        fov *= 1.0F - force * 0.15F;
        event.newfov = fov;
    }*/
}
项目:balkons-weaponmod    文件:WMClientEventHandler.java   
@SubscribeEvent
public void onFOVUpdateEvent(FOVUpdateEvent e)
{
    if (e.entity.isUsingItem() && e.entity.getItemInUse().getItem() instanceof IItemWeapon)
    {
        RangedComponent rc = ((IItemWeapon) e.entity.getItemInUse().getItem()).getRangedComponent();
        if (rc != null && RangedComponent.isReadyToFire(e.entity.getItemInUse()))
        {
            e.newfov = e.fov * rc.getFOVMultiplier(e.entity.getItemInUseDuration());
        }
    }
}
项目:ZeldaSwordSkills    文件:ZSSClientEvents.java   
/**
 * FOV is determined initially in EntityPlayerSP; fov is recalculated for
 * the vanilla bow only in the case that zoom-enhancing gear is worn
 */
@SubscribeEvent
public void updateFOV(FOVUpdateEvent event) {
    ItemStack stack = (event.entity.isUsingItem() ? event.entity.getItemInUse() : null);
    if (stack != null) {
        boolean flag = stack.getItem() instanceof IZoom;
        if (flag || stack.getItem() == Items.bow) {
            float magify = 1.0F;
            for (ItemStack armor : event.entity.inventory.armorInventory) {
                if (armor != null && armor.getItem() instanceof IZoomHelper) {
                    magify += ((IZoomHelper) armor.getItem()).getMagnificationFactor();
                }
            }
            if (flag || magify != 1.0F) {
                float maxTime = (flag ? ((IZoom) stack.getItem()).getMaxZoomTime() : 20.0F);
                float factor = (flag ? ((IZoom) stack.getItem()).getZoomFactor() : 0.15F);
                float charge = (float) event.entity.getItemInUseDuration() / maxTime;
                IAttributeInstance iattributeinstance = event.entity.getEntityAttribute(SharedMonsterAttributes.movementSpeed);
                float fov = (event.entity.capabilities.isFlying ? 1.1F : 1.0F);
                fov *= (iattributeinstance.getAttributeValue() / (double) event.entity.capabilities.getWalkSpeed() + 1.0D) / 2.0D;
                if (event.entity.capabilities.getWalkSpeed() == 0.0F || Float.isNaN(fov) || Float.isInfinite(fov)) {
                    fov = 1.0F;
                }
                if (charge > 1.0F) {
                    charge = 1.0F;
                } else {
                    charge *= charge;
                }
                event.newfov = fov * (1.0F - charge * factor * magify);
            }
        }
    }
}
项目:AgeCraft-Old    文件:ACEventHandlerClient.java   
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
    if(event.entity.isUsingItem() && (event.entity.getItemInUse().getItem() == Tools.bow || event.entity.getItemInUse().getItem() == Tools.crossbow)) {
        int duration = event.entity.getItemInUseDuration();
        float multiplier = (float) duration / 20.0F;
        if(multiplier > 1.0F) {
            multiplier = 1.0F;
        } else {
            multiplier *= multiplier;
        }
        event.newfov *= 1.0F - multiplier * 0.15F;
    }
}
项目:HardcoreRevival    文件:ClientProxy.java   
@SubscribeEvent
public void onFov(FOVUpdateEvent event) {
    if (isKnockedOut) {
        event.setNewfov(0.5f);
    }
}
项目:CustomWorldGen    文件:ForgeHooksClient.java   
public static float getOffsetFOV(EntityPlayer entity, float fov)
{
    FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
    MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
    return fovUpdateEvent.getNewfov();
}
项目:TRHS_Club_Mod_2016    文件:ForgeHooksClient.java   
public static float getOffsetFOV(EntityPlayerSP entity, float fov)
{
    FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
    MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
    return fovUpdateEvent.newfov;
}
项目:ARKCraft    文件:ClientEventHandler.java   
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent evt)
{
    if (mc.gameSettings.thirdPersonView == 0 && (showScopeOverlap || showSpyglassOverlay))
        evt.setNewfov(evt.getNewfov() / 6.0F);
}
项目:CauldronGit    文件:ForgeHooksClient.java   
public static float getOffsetFOV(EntityPlayerSP entity, float fov)
{
    FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
    MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
    return fovUpdateEvent.newfov;
}
项目:Zoom    文件:EventHandler.java   
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent evt) {
    if (isUsingBinoculars() && mc.gameSettings.thirdPersonView == 0) {
        evt.setNewfov(currentZoom);
    }
}
项目:Kingdom-Keys-Re-Coded    文件:RenderingEvents.java   
@SideOnly (Side.CLIENT)
@SubscribeEvent
public void fovUpdate (FOVUpdateEvent event) {
    if (event.getEntity().getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() == 0) event.setNewfov(1f);
}
项目:FusionWarfare    文件:HUDEvent.java   
@SubscribeEvent
public void updateFOV(FOVUpdateEvent event) {

    ItemStack stack = event.entity.inventory.getCurrentItem();

    if (stack != null && stack.getItem() == InitItems.fusion_sniper_rifle) {

        GunData data = new GunData(stack);

        if (Minecraft.getMinecraft().gameSettings.thirdPersonView == 0 && data.scope > 0) {

            event.newfov = 1 - (float)data.scope / 3;   
            return;
        }
    }

    event.newfov = event.fov;       
}
项目:Farrago    文件:ClientProxy.java   
@SubscribeEvent
public void onFov(FOVUpdateEvent e) {
    if (FarragoMod.scoped) {
        e.newfov = (float)FarragoMod.config.getDouble("rifle.scope.factor");
    }
}
项目:Farrago    文件:ToolBlockRenderer.java   
@SubscribeEvent
public void onFOV(FOVUpdateEvent e) {
    e.newfov = 0.818181818f;
}
项目:SecurityCraft    文件:SCEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fovUpdateEvent(FOVUpdateEvent event){
    if(PlayerUtils.isPlayerMountedOnCamera(event.getEntity()))
        event.setNewfov(((EntitySecurityCamera) event.getEntity().getRidingEntity()).getZoomAmount());
}
项目:SecurityCraft    文件:SCEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fovUpdateEvent(FOVUpdateEvent event){
    if(PlayerUtils.isPlayerMountedOnCamera(event.getEntity()))
        event.setNewfov(((EntitySecurityCamera) event.getEntity().getRidingEntity()).getZoomAmount());
}
项目:SecurityCraft    文件:SCEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fovUpdateEvent(FOVUpdateEvent event){
    if(PlayerUtils.isPlayerMountedOnCamera(event.entity))
        event.newfov = ((EntitySecurityCamera) event.entity.ridingEntity).getZoomAmount();
}
项目:SecurityCraft    文件:SCEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fovUpdateEvent(FOVUpdateEvent event){
    if(PlayerUtils.isPlayerMountedOnCamera(event.entity))
        event.newfov = ((EntitySecurityCamera) event.entity.ridingEntity).getZoomAmount();
}
项目:SecurityCraft    文件:SCEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fovUpdateEvent(FOVUpdateEvent event){
    if(PlayerUtils.isPlayerMountedOnCamera(event.getEntity()))
        event.setNewfov(((EntitySecurityCamera) event.getEntity().getRidingEntity()).getZoomAmount());
}
项目:SecurityCraft    文件:SCEventHandler.java   
@SubscribeEvent
@SideOnly(Side.CLIENT)
public void fovUpdateEvent(FOVUpdateEvent event){
    if(PlayerUtils.isPlayerMountedOnCamera(event.entity))
        event.newfov = ((EntitySecurityCamera) event.entity.ridingEntity).getZoomAmount();
}
项目:Cauldron    文件:ForgeHooksClient.java   
public static float getOffsetFOV(EntityPlayerSP entity, float fov)
{
    FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
    MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
    return fovUpdateEvent.newfov;
}
项目:Cauldron    文件:ForgeHooksClient.java   
public static float getOffsetFOV(EntityPlayerSP entity, float fov)
{
    FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
    MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
    return fovUpdateEvent.newfov;
}
项目:Cauldron    文件:ForgeHooksClient.java   
public static float getOffsetFOV(EntityPlayerSP entity, float fov)
{
    FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov);
    MinecraftForge.EVENT_BUS.post(fovUpdateEvent);
    return fovUpdateEvent.newfov;
}