aboutsummaryrefslogtreecommitdiff
path: root/features/cosmetics/cosmetic
diff options
context:
space:
mode:
authorSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-02-05 17:43:44 +0800
committerSoopyboo32 <49228220+Soopyboo32@users.noreply.github.com>2022-02-05 17:43:44 +0800
commit63c2cacccbb356093fa2b594d1e1df96a446f4a3 (patch)
treeb8a545a3f009b2cff9a3b6a38aa7d1957082e878 /features/cosmetics/cosmetic
parent03a76358b815e0da2d5644dd93f29701b61912f7 (diff)
downloadSoopyV2-63c2cacccbb356093fa2b594d1e1df96a446f4a3.tar.gz
SoopyV2-63c2cacccbb356093fa2b594d1e1df96a446f4a3.tar.bz2
SoopyV2-63c2cacccbb356093fa2b594d1e1df96a446f4a3.zip
change distance calculation to use Math.hypot
Diffstat (limited to 'features/cosmetics/cosmetic')
-rw-r--r--features/cosmetics/cosmetic/dragon/dragonWings.js10
1 files changed, 5 insertions, 5 deletions
diff --git a/features/cosmetics/cosmetic/dragon/dragonWings.js b/features/cosmetics/cosmetic/dragon/dragonWings.js
index f7c7956..bad1fc2 100644
--- a/features/cosmetics/cosmetic/dragon/dragonWings.js
+++ b/features/cosmetics/cosmetic/dragon/dragonWings.js
@@ -55,7 +55,7 @@ class DragonWings extends Cosmetic {
let rotation = isInInv?0:this.player.getPlayer()[f.prevRenderYawOffset]+(this.player.getPlayer()[f.renderYawOffset]-this.player.getPlayer()[f.prevRenderYawOffset])*ticks
// rotation += entity.field_70761_aq+(entity.field_70761_aq-entity.field_70760_ar)*ticks
// console.log(rotation, entity.getEntity().field_70761_aq+(entity.getEntity().field_70761_aq-entity.getEntity().field_70760_ar)*ticks)
- let horisontalSpeed = Math.sqrt((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX])**2+(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ])**2)
+ let horisontalSpeed = Math.hypot((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX]),(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ]))
let verticleSpeed = this.player.getPlayer()[f.posY.Entity]-this.player.getPlayer()[f.lastTickPosY]
@@ -310,7 +310,7 @@ class DragonWings extends Cosmetic {
return
}
- let horisontalSpeed = Math.sqrt((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX])**2+(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ])**2)
+ let horisontalSpeed = Math.hypot((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX]),(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ]))
// if((this.player === Player &&this.player.getPlayer().field_71075_bZ.field_75100_b) || (this.player !== Player && Math.abs(verticleSpeed)<0.2 && !this.player.getPlayer().field_70122_E)){//playerCapabilities.isFlying
@@ -318,7 +318,7 @@ class DragonWings extends Cosmetic {
if(this.animOffset-this.lastFlapSound > 2*Math.PI){
- let dist = Math.sqrt((Player.getX()-this.player.getX())**2+(Player.getY()-this.player.getY())**2+(Player.getZ()-this.player.getZ())**2)+1
+ let dist = Math.hypot((Player.getX()-this.player.getX()),(Player.getY()-this.player.getY()),(Player.getZ()-this.player.getZ()))+1
World.playSound("mob.enderdragon.wings", (this.settings.scale*15)*Math.min(1, 50/(dist*dist)), 1)
this.lastFlapSound = this.animOffset-this.animOffset%(Math.PI*2)
@@ -331,7 +331,7 @@ class DragonWings extends Cosmetic {
if(amt < 1*Math.PI){
if(amt > 0.65*Math.PI && (2*Math.PI+this.animOffset)-this.lastFlapSound > 2*Math.PI){
- let dist = Math.sqrt((Player.getX()-this.player.getX())**2+(Player.getY()-this.player.getY())**2+(Player.getZ()-this.player.getZ())**2)+1
+ let dist = Math.hypot((Player.getX()-this.player.getX()),(Player.getY()-this.player.getY()),(Player.getZ()-this.player.getZ()))+1
World.playSound("mob.enderdragon.wings", (Math.max(0.005,this.settings.scale-0.005)*25)*Math.min(1, 50/Math.min(1,dist*dist))/50, 1-(Math.max(0.005,this.settings.scale-0.005)*25))
this.lastFlapSound = 2*Math.PI+(this.animOffset)-this.animOffset%(Math.PI*2)
@@ -386,7 +386,7 @@ class DragonWings extends Cosmetic {
this.lastRender = Date.now()
- let horisontalSpeed = Math.sqrt((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX])**2+(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ])**2)
+ let horisontalSpeed = Math.hypot((this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX]),(this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ]))
this.animOffset += Math.min(1, horisontalSpeed)*10*timeSince+1*timeSince