diff options
author | ingle <inglettronald@gmail.com> | 2022-11-28 10:14:44 -0600 |
---|---|---|
committer | ingle <inglettronald@gmail.com> | 2022-11-28 10:14:44 -0600 |
commit | 15b61517c59f8aa8135af82d6814739ad5da76b3 (patch) | |
tree | 19a13669ba1714cf9f763d632fafcfc6382eec54 /src/main/kotlin/dulkirmod/features/HurtCamSlider.kt | |
parent | 7df387ec0f015fc7b8179131f17a107be4d77f04 (diff) | |
download | DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.tar.gz DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.tar.bz2 DulkirMod-15b61517c59f8aa8135af82d6814739ad5da76b3.zip |
- 1.1.3
Diffstat (limited to 'src/main/kotlin/dulkirmod/features/HurtCamSlider.kt')
-rw-r--r-- | src/main/kotlin/dulkirmod/features/HurtCamSlider.kt | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main/kotlin/dulkirmod/features/HurtCamSlider.kt b/src/main/kotlin/dulkirmod/features/HurtCamSlider.kt new file mode 100644 index 0000000..7237d95 --- /dev/null +++ b/src/main/kotlin/dulkirmod/features/HurtCamSlider.kt @@ -0,0 +1,31 @@ +package dulkirmod.features + +import dulkirmod.DulkirMod.Companion.mc +import dulkirmod.config.Config +import net.minecraft.client.renderer.GlStateManager +import net.minecraft.entity.EntityLivingBase +import net.minecraft.util.MathHelper + +object HurtCamSlider { + fun renderHurt(partialTicks: Float): Boolean { + if (!Config.hurtCamSlider) return false + if (mc.renderViewEntity is EntityLivingBase) { + val entitylivingbase = mc.renderViewEntity as EntityLivingBase + var f: Float = (entitylivingbase.hurtTime.toFloat() - partialTicks) + if (entitylivingbase.health <= 0.0f) { + val f1: Float = entitylivingbase.deathTime.toFloat() + partialTicks + GlStateManager.rotate(40.0f - 8000.0f / (f1 + 200.0f), 0.0f, 0.0f, 1.0f) + } + if (f < 0.0f) { + return true + } + f /= entitylivingbase.maxHurtTime.toFloat() + f = MathHelper.sin(f * f * f * f * Math.PI.toFloat()) + val f2 = entitylivingbase.attackedAtYaw + GlStateManager.rotate(-f2, 0.0f, 1.0f, 0.0f) + GlStateManager.rotate(-f * 14.0f * Config.hurtCamIntensity, 0.0f, 0.0f, 1.0f) + GlStateManager.rotate(f2, 0.0f, 1.0f, 0.0f) + } + return true + } +}
\ No newline at end of file |