use of net.minecraft.item.BowItem in project NetherEx by LogicTechCorp.
the class RenderEventHandler method onFOVChange.
@SubscribeEvent
public static void onFOVChange(FOVUpdateEvent event) {
PlayerEntity player = event.getEntity();
if (player.isPotionActive(NetherExEffects.FROZEN.get())) {
float fov = 1.0F;
if (player.abilities.isFlying) {
fov *= 1.1F;
}
if (player.isHandActive() && player.getActiveItemStack().getItem() instanceof BowItem) {
float useCount = (float) player.getItemInUseMaxCount() / 20.0F;
if (useCount > 1.0F) {
useCount = 1.0F;
} else {
useCount = useCount * useCount;
}
fov *= 1.0F - useCount * 0.15F;
}
event.setNewfov(fov);
}
}
Aggregations