use of cavern.item.ItemBowCavenic in project Cavern2 by kegare.
the class ClientEventHooks method onFOVUpdate.
@SubscribeEvent
public void onFOVUpdate(FOVUpdateEvent event) {
EntityPlayer player = event.getEntity();
if (!player.isHandActive()) {
return;
}
ItemStack using = player.getActiveItemStack();
if (using.isEmpty()) {
return;
}
if (using.getItem() instanceof ItemBowIce) {
float f = player.getItemInUseMaxCount() / 8.0F;
if (f > 1.0F) {
f = 1.0F;
} else {
f *= f;
}
event.setNewfov(event.getFov() * (1.0F - f * 0.15F));
}
if (using.getItem() instanceof ItemBowCavenic) {
ItemBowCavenic.BowMode mode = ItemBowCavenic.BowMode.byItemStack(using);
float zoom = mode.getZoomScale();
if (zoom <= 0.0F) {
return;
}
float f = player.getItemInUseMaxCount() / mode.getPullingSpeed();
if (f > 1.0F) {
f = 1.0F;
} else {
f *= f;
}
event.setNewfov(event.getFov() * (1.0F - f * zoom));
}
}
Aggregations