Files
TinkersConstruct/src/main/java/tconstruct/weaponry/client/RenderEventHandler.java
T
miozuneGitHub GTNH Actionsgithub-actions[bot]
69bb974420 Use compileOnlyApi for CoFH (#84)
* Use compileOnlyApi for CoFH

* spotlessApply (#85)

Co-authored-by: GitHub GTNH Actions <>

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2023-05-15 08:07:18 +02:00

41 lines
1.4 KiB
Java

package tconstruct.weaponry.client;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.event.FOVUpdateEvent;
import net.minecraftforge.client.event.RenderPlayerEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import tconstruct.library.weaponry.BowBaseAmmo;
import tconstruct.library.weaponry.IWindup;
public class RenderEventHandler {
@SubscribeEvent
public void onAimZoom(FOVUpdateEvent event) {
if (!event.entity.isUsingItem()) return;
if (!(event.entity.getItemInUse().getItem() instanceof IWindup)) return;
ItemStack weapon = event.entity.getItemInUse();
IWindup item = (IWindup) weapon.getItem();
if (item.zoomOnWindup(weapon)) event.newfov = event.fov
/ (event.fov + (item.getZoom(weapon) - 1.0f) * item.getWindupProgress(weapon, event.entity));
}
@SubscribeEvent
public void onRenderPlayer(RenderPlayerEvent.Pre event) {
// if (event.entityPlayer.getCurrentEquippedItem() != null &&
// event.entityPlayer.getCurrentEquippedItem().getItem() == TinkerWeaponry.javelin) {
// }
if (event.entityPlayer.getItemInUse() == null) return;
if (event.entityPlayer.getItemInUse().getItem() instanceof BowBaseAmmo) {
event.renderer.modelBipedMain.aimedBow = true;
event.renderer.modelArmor.aimedBow = true;
event.renderer.modelArmorChestplate.aimedBow = true;
}
}
}