@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)); }
@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)); }
@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; } }
/** * 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); } } }
@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; } } }
@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); }
@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; } }
@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)); }
@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; } } }
@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); } }
@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)); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void updateFOV(FOVUpdateEvent event) { if (event.getEntity().getActivePotionEffect(Thermionics.POTION_EFFORTLESS_SPEED)!=null) { event.setNewfov(1.0f); } }
@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); }
@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); } }
@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); } }
@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; }*/ }
@SubscribeEvent public void onFOVUpdate(FOVUpdateEvent evt) { if (mc.gameSettings.thirdPersonView == 0 && showScopeOverlap) { evt.newfov = 1 / 6.0F; } }
@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()); } } }
/** * 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); } } } }
@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; } }
@SubscribeEvent public void onFov(FOVUpdateEvent event) { if (isKnockedOut) { event.setNewfov(0.5f); } }
public static float getOffsetFOV(EntityPlayer entity, float fov) { FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov); MinecraftForge.EVENT_BUS.post(fovUpdateEvent); return fovUpdateEvent.getNewfov(); }
public static float getOffsetFOV(EntityPlayerSP entity, float fov) { FOVUpdateEvent fovUpdateEvent = new FOVUpdateEvent(entity, fov); MinecraftForge.EVENT_BUS.post(fovUpdateEvent); return fovUpdateEvent.newfov; }
@SubscribeEvent public void onFOVUpdate(FOVUpdateEvent evt) { if (mc.gameSettings.thirdPersonView == 0 && (showScopeOverlap || showSpyglassOverlay)) evt.setNewfov(evt.getNewfov() / 6.0F); }
@SubscribeEvent public void onFOVUpdate(FOVUpdateEvent evt) { if (isUsingBinoculars() && mc.gameSettings.thirdPersonView == 0) { evt.setNewfov(currentZoom); } }
@SideOnly (Side.CLIENT) @SubscribeEvent public void fovUpdate (FOVUpdateEvent event) { if (event.getEntity().getEntityAttribute(SharedMonsterAttributes.MOVEMENT_SPEED).getAttributeValue() == 0) event.setNewfov(1f); }
@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; }
@SubscribeEvent public void onFov(FOVUpdateEvent e) { if (FarragoMod.scoped) { e.newfov = (float)FarragoMod.config.getDouble("rifle.scope.factor"); } }
@SubscribeEvent public void onFOV(FOVUpdateEvent e) { e.newfov = 0.818181818f; }
@SubscribeEvent @SideOnly(Side.CLIENT) public void fovUpdateEvent(FOVUpdateEvent event){ if(PlayerUtils.isPlayerMountedOnCamera(event.getEntity())) event.setNewfov(((EntitySecurityCamera) event.getEntity().getRidingEntity()).getZoomAmount()); }
@SubscribeEvent @SideOnly(Side.CLIENT) public void fovUpdateEvent(FOVUpdateEvent event){ if(PlayerUtils.isPlayerMountedOnCamera(event.entity)) event.newfov = ((EntitySecurityCamera) event.entity.ridingEntity).getZoomAmount(); }