@SubscribeEvent public void onFOVUpdateEvent(FOVUpdateEvent evt) { if (evt.getEntity().getItemStackFromSlot(EntityEquipmentSlot.FEET) != null && evt.getEntity().getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem() == ObjHandler.gemFeet) { evt.setNewfov(evt.getFov() - 0.4F); } }
/* 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); } } }
/** Counter the bow use fov jerkyness with the draw enchantment */ @SubscribeEvent public void onBowFOV(FOVUpdateEvent event) { ItemStack stack = event.entity.getItemInUse(); if (EnchantmentHelper.getEnchantmentLevel(BaseEnchantment.bowCharge, stack) > 0) { 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 @SideOnly(Side.CLIENT) public void onFOVUpdate(FOVUpdateEvent event) { if (!event.entity.isUsingItem()) return; ItemStack stack = event.entity.getItemInUse(); if (stack.getItem() instanceof WeaponBow) { WeaponBow item = (WeaponBow) stack.getItem(); if (item.updatesFOV()) { event.newfov = event.fov / (event.fov + (item.getFOVValue(stack) * getItemInUsePercentaje(event.entity, item.getFOVSpeedFactor(stack)))); } } }