From 6accfc8d22f8873040f347abaf45e9008686a203 Mon Sep 17 00:00:00 2001 From: Soopyboo32 <49228220+Soopyboo32@users.noreply.github.com> Date: Mon, 6 Dec 2021 16:29:41 +0800 Subject: Make a utils thing at allows for human readable mappings --- features/cosmetics/cosmetic/dragon/dragonWings.js | 132 +++++++++++----------- 1 file changed, 67 insertions(+), 65 deletions(-) (limited to 'features/cosmetics/cosmetic') diff --git a/features/cosmetics/cosmetic/dragon/dragonWings.js b/features/cosmetics/cosmetic/dragon/dragonWings.js index cbf2879..4044e85 100644 --- a/features/cosmetics/cosmetic/dragon/dragonWings.js +++ b/features/cosmetics/cosmetic/dragon/dragonWings.js @@ -1,3 +1,4 @@ +import { f, m, m } from "../../../../mappings/mappings.js"; import Cosmetic from "../../cosmetic.js"; const ModelDragon = Java.type("net.minecraft.client.model.ModelDragon") @@ -12,8 +13,8 @@ let textures = {//TODO: dynamicly load textures from server classic: new Image(javax.imageio.ImageIO.read(new java.io.File("./config/ChatTriggers/modules/SoopyV2/features/cosmetics/textures/dragon/classic.png"))), purple: new Image(javax.imageio.ImageIO.read(new java.io.File("./config/ChatTriggers/modules/SoopyV2/features/cosmetics/textures/dragon/purple.png"))) } -let wing = getField(dragon, "field_78225_k") -let wingTip = getField(dragon, "field_78222_l") +let wing = getField(dragon, f.wing) +let wingTip = getField(dragon, f.wingTip) class DragonWings extends Cosmetic { constructor(player, parent) { @@ -28,11 +29,12 @@ class DragonWings extends Cosmetic { onRenderEntity(ticks, isInGui){ - if(this.player.getPlayer().func_98034_c(Player.getPlayer())){ + if(this.player.getPlayer()[m.isInvisibleToPlayer](Player.getPlayer())){ return } - if(!this.parent.firstPersonVisable.getValue() && Client.getMinecraft().field_71474_y.field_74320_O === 0) return + let thirdPersonView = Client.getMinecraft()[f.gameSettings.Minecraft][f.thirdPersonView] + if(!this.parent.firstPersonVisable.getValue() && thirdPersonView === 0) return let isSelfPlayer = this.player.getUUID().toString() === Player.getUUID().toString() let isInInv = isSelfPlayer && ticks === 1 @@ -43,12 +45,12 @@ class DragonWings extends Cosmetic { let timeSince = (Date.now()-this.lastRender)/1000 this.lastRender = Date.now() - let rotation = isInInv?0:this.player.getPlayer().field_70760_ar+(this.player.getPlayer().field_70761_aq-this.player.getPlayer().field_70760_ar)*ticks + 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().field_70165_t-this.player.getPlayer().field_70142_S)**2+(this.player.getPlayer().field_70161_v-this.player.getPlayer().field_70136_U)**2) + 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 verticleSpeed = this.player.getPlayer().field_70163_u-this.player.getPlayer().field_70137_T + let verticleSpeed = this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ] this.animOffset += Math.min(1, horisontalSpeed)*10*timeSince+1*timeSince @@ -62,18 +64,18 @@ class DragonWings extends Cosmetic { let wingBackAmount = 0 - if(this.player.getPlayer().field_70172_ad > 15){ //damage tick + if(this.player.getPlayer()[f.hurtResistantTime] > 15){ //damage tick this.animOffset += 15*timeSince } // 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 - if((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E && !isInGui){ //flying + if((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity] && !isInGui){ //flying this.animOffset += 5*timeSince //flap in mid air flapAmountMultiplyer *= 1.75 //flap harder - if(isSelfPlayer && Client.getMinecraft().field_71474_y.field_74320_O === 0){ + if(isSelfPlayer && thirdPersonView === 0){ if(!this.parent.lessFirstPersonVisable.getValue()){ flapAmountMultiplyerNoEnd += 0.4 flapMainOffsetThing = 0.3 @@ -101,14 +103,14 @@ class DragonWings extends Cosmetic { this.animOffset += (verticleSpeed+0.5)*-3*timeSince } - GlStateManager.func_179094_E(); // pushMatrix + GlStateManager[m.pushMatrix](); // pushMatrix Tessellator.colorize(this.settings.color.r, this.settings.color.g, this.settings.color.b); if(!isSelfPlayer){ Tessellator.translate( - (this.player.getPlayer().field_70142_S + (this.player.getPlayer().field_70165_t-this.player.getPlayer().field_70142_S) * ticks) - (Player.getPlayer().field_70142_S + (Player.getPlayer().field_70165_t-Player.getPlayer().field_70142_S) * ticks), - (this.player.getPlayer().field_70137_T + (this.player.getPlayer().field_70163_u-this.player.getPlayer().field_70137_T) * ticks) - (Player.getPlayer().field_70137_T + (Player.getPlayer().field_70163_u-Player.getPlayer().field_70137_T) * ticks), - (this.player.getPlayer().field_70136_U + (this.player.getPlayer().field_70161_v-this.player.getPlayer().field_70136_U) * ticks) - (Player.getPlayer().field_70136_U + (Player.getPlayer().field_70161_v-Player.getPlayer().field_70136_U) * ticks)) + (this.player.getPlayer()[f.lastTickPosX] + (this.player.getPlayer()[f.posX.Entity]-this.player.getPlayer()[f.lastTickPosX]) * ticks) - (Player.getPlayer()[f.lastTickPosX] + (Player.getPlayer()[f.posX.Entity]-Player.getPlayer()[f.lastTickPosX]) * ticks), + (this.player.getPlayer()[f.lastTickPosY] + (this.player.getPlayer()[f.posY.Entity]-this.player.getPlayer()[f.lastTickPosY]) * ticks) - (Player.getPlayer()[f.lastTickPosY] + (Player.getPlayer()[f.posY.Entity]-Player.getPlayer()[f.lastTickPosY]) * ticks), + (this.player.getPlayer()[f.lastTickPosZ] + (this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ]) * ticks) - (Player.getPlayer()[f.lastTickPosZ] + (Player.getPlayer()[f.posZ.Entity]-Player.getPlayer()[f.lastTickPosZ]) * ticks)) } if(textures[this.settings.texture || "classic"]){ @@ -117,25 +119,25 @@ class DragonWings extends Cosmetic { Tessellator.bindTexture(textures.classic) //bind default texture (classic) } - if(this.player.getPlayer().field_70154_o){ - rotation = this.player.getPlayer().field_70759_as+(this.player.getPlayer().field_70759_as-this.player.getPlayer().field_70758_at)*ticks + if(this.player.getPlayer()[f.ridingEntity.Entity]){ + rotation = this.player.getPlayer()[f.rotationYawHead]+(this.player.getPlayer()[f.rotationYawHead]-this.player.getPlayer()[f.prevRotationYawHead])*ticks } - if(!this.player.getPlayer().func_70608_bn()){ //dont rotate when in bed + if(!this.player.getPlayer()[m.isPlayerSleeping]()){ //dont rotate when in bed Tessellator.rotate((180-rotation),0,1,0) Tessellator.translate(0,1.2,0.1) - if(this.player.getPlayer().func_70093_af()){ //isSneaking + if(this.player.getPlayer()[m.isSneaking.Entity]()){ //isSneaking Tessellator.translate(0, -0.125,0) Tessellator.rotate(-20, 1,0,0) Tessellator.translate(0, 0,0.1) - if(isSelfPlayer && Client.getMinecraft().field_71474_y.field_74320_O === 0){}else{ + if(isSelfPlayer && thirdPersonView === 0){}else{ Tessellator.translate(0, -0.125,0) } } - if(isSelfPlayer && !isInInv && Client.getMinecraft().field_71474_y.field_74320_O === 0){ + if(isSelfPlayer && !isInInv && thirdPersonView === 0){ //Make wings less scuffed when in first person looking down/up Tessellator.translate(0, 0.25, 0.003*(this.player.getPitch())) } @@ -143,14 +145,14 @@ class DragonWings extends Cosmetic { //Higher = more elytra like - wing.field_78796_g = 0.25; //rotateAngleY + wing[f.rotateAngleZ] = 0.25; //rotateAngleY let shouldStandingStillWingThing = false let changeStandingStillWingThing = 0 if(horisontalSpeed < 0.01){ - if(!((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E)){ //not flying + if(!((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity])){ //not flying let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) if(amt < 1*Math.PI){ this.animOffset += 2*timeSince*Math.min(1,(amt/(1*Math.PI))*2) @@ -162,22 +164,22 @@ class DragonWings extends Cosmetic { flapAmountMultiplyer += (1-(amt/(1*Math.PI)-1))/2 } } - if(this.player.getPlayer().func_70093_af()){ //isSneaking - if(this.player.getPlayer().field_70125_A > 20){ + if(this.player.getPlayer()[m.isSneaking.Entity]()){ //isSneaking + if(this.player.getPlayer()[f.rotationPitch] > 20){ shouldStandingStillWingThing = true - changeStandingStillWingThing = Math.max(0,this.player.getPlayer().field_70125_A/600) + changeStandingStillWingThing = Math.max(0,this.player.getPlayer()[f.rotationPitch]/600) } } } if(shouldStandingStillWingThing){ - wing.field_78796_g = 0.25+(changeStandingStillWingThing)*3 + wing[f.rotateAngleY] = 0.25+(changeStandingStillWingThing)*3 } - if(this.player.getPlayer().func_70608_bn()){ //player in bed + if(this.player.getPlayer()[m.isPlayerSleeping]()){ //player in bed try{ //try catch incase no bed at that location - let facing = World.getWorld().func_180495_p(this.player.getPlayer().field_71081_bT).func_177229_b(FACING).func_176736_b() //0-3 is S-W-N-E + let facing = World.getWorld().func_180495_p(this.player.getPlayer()[f.playerLocation])[m.getValue.BlockState$StateImplementation](FACING)[m.getHorizontalIndex]() //0-3 is S-W-N-E let rotation = 0 switch(facing){ @@ -203,12 +205,12 @@ class DragonWings extends Cosmetic { Tessellator.translate(0, 0.75-this.settings.scale*100,0) Tessellator.rotate(rotation, 0, 1, 0) - wing.field_78795_f = 0; //rotateAngleX + wing[f.rotateAngleX] = 0; //rotateAngleX - wing.field_78808_h = (-0.5+Math.sin(this.animOffset/5)*0.1)*this.settings.scale*100; //rotateAngleZ + wing[f.rotateAngleZ] = (-0.5+Math.sin(this.animOffset/5)*0.1)*this.settings.scale*100; //rotateAngleZ - wingTip.field_78808_h = -2.20+Math.sin(this.animOffset/5)*0.1 + wingTip[f.rotateAngleZ] = -2.20+Math.sin(this.animOffset/5)*0.1 }catch(e){} }else if(wingBackAmount === 0){ //tilt @@ -219,7 +221,7 @@ class DragonWings extends Cosmetic { wing_tilt_offset += (changeStandingStillWingThing)*4 } - wing.field_78795_f = 0.75 - Math.cos(this.animOffset) * 0.2+wing_tilt_offset; //rotateAngleX + wing[f.rotateAngleX] = 0.75 - Math.cos(this.animOffset) * 0.2+wing_tilt_offset; //rotateAngleX let wing_goback_amount = 0.15/(Math.min(1, horisontalSpeed)*3+0.25) @@ -237,74 +239,74 @@ class DragonWings extends Cosmetic { temp_horis_wingthing = -(changeStandingStillWingThing)*0.75 } - wing.field_78808_h = (Math.sin(this.animOffset)/temp_wing_thing + 0.125) * wing_goback_amount*(1+(flapAmountMultiplyer-1)*1)*flapAmountMultiplyerNoEnd -0.4-wing_tilt_offset/3+temp_horis_wingthing+flapMainOffsetThing; //rotateAngleZ + wing[f.rotateAngleZ] = (Math.sin(this.animOffset)/temp_wing_thing + 0.125) * wing_goback_amount*(1+(flapAmountMultiplyer-1)*1)*flapAmountMultiplyerNoEnd -0.4-wing_tilt_offset/3+temp_horis_wingthing+flapMainOffsetThing; //rotateAngleZ - wingTip.field_78808_h = -((Math.sin((this.animOffset+1.5+(1-temp_wing_thing)/8.5))/(1+(temp_wing_thing-1)/3) + 0.5)) * 0.75*(1+(flapAmountMultiplyer-1)*1)/(1+temp_horis_wingthing) - (1-flapAmountMultiplyer)*2-(1-temp_wing_thing)/10+wingEndOffsetThing; //rotateAngleZ + wingTip[f.rotateAngleZ] = -((Math.sin((this.animOffset+1.5+(1-temp_wing_thing)/8.5))/(1+(temp_wing_thing-1)/3) + 0.5)) * 0.75*(1+(flapAmountMultiplyer-1)*1)/(1+temp_horis_wingthing) - (1-flapAmountMultiplyer)*2-(1-temp_wing_thing)/10+wingEndOffsetThing; //rotateAngleZ }else{ //tilt let wing_tilt_offset = -Math.min(0.8, horisontalSpeed*3) //When go faster tilt wing back so its in direction of wind - wing.field_78795_f = 0.75 - Math.cos(this.animOffset) * 0.2+wing_tilt_offset-wingBackAmount/2; //rotateAngleX + wing[f.rotateAngleX] = 0.75 - Math.cos(this.animOffset) * 0.2+wing_tilt_offset-wingBackAmount/2; //rotateAngleX - wing.field_78808_h = -wingBackAmount; //rotateAngleZ + wing[f.rotateAngleZ] = -wingBackAmount; //rotateAngleZ - wingTip.field_78808_h = -((Math.sin((this.animOffset))*0.5 + 0.3)) + wingTip[f.rotateAngleZ] = -((Math.sin((this.animOffset))*0.5 + 0.3)) } - GlStateManager.func_179129_p() //disable culling + GlStateManager[m.disableCull]() //disable culling let wing_center_dist = ((0-Math.log(1000*this.settings.scale+0.01)-2)-100000*this.settings.scale*this.settings.scale)/1000 // GL11.glDepthMask(GL11.GL_FALSE); Tessellator.translate(-wing_center_dist, 0, 0) Tessellator.scale(this.settings.scale, this.settings.scale, this.settings.scale) - wing.func_78791_b(1) //render left wing + wing[m.renderWithRotation](1) //render left wing Tessellator.translate(2*wing_center_dist/this.settings.scale, 0, 0) Tessellator.scale(-1, 1, 1) - wing.func_78791_b(1) //render right wing + wing[m.renderWithRotation](1) //render right wing - if(this.player.getPlayer().field_70737_aN > 0){ //damage tick - GlStateManager.func_179094_E(); // pushMatrix - GlStateManager.func_179143_c(514); - GlStateManager.func_179090_x(); - GlStateManager.func_179147_l(); - GlStateManager.func_179112_b(770, 771); - GlStateManager.func_179131_c(1, 0, 0, 0.25); + if(this.player.getPlayer()[f.hurtTime] > 0){ //damage tick + GlStateManager[m.pushMatrix](); // pushMatrix + GlStateManager[m.depthFunc](514); + GlStateManager[m.disableTexture2D](); + GlStateManager[m.enableBlend](); + GlStateManager[m.blendFunc](770, 771); + GlStateManager.func_179131_c(1, 0, 0, 0.25); //m.color.glstatemanager.ffff Tessellator.scale(-1, 1, 1) Tessellator.translate(-2*wing_center_dist/this.settings.scale, 0, 0) - wing.func_78791_b(1) //render left wing + wing[m.renderWithRotation](1) //render left wing Tessellator.translate(2*wing_center_dist/this.settings.scale, 0, 0) Tessellator.scale(-1, 1, 1) - wing.func_78791_b(1) //render right wing + wing[m.renderWithRotation](1) //render right wing - GlStateManager.func_179098_w(); - GlStateManager.func_179084_k(); - GlStateManager.func_179143_c(515); - GlStateManager.func_179121_F(); // popMatrix + GlStateManager[m.enableTexture2D](); + GlStateManager[m.disableBlend](); + GlStateManager[m.depthFunc](515); + GlStateManager[m.popMatrix](); // popMatrix } Tessellator.colorize(1, 1, 1) - GlStateManager.func_179089_o() //enable culling - GlStateManager.func_179121_F(); // popMatrix + GlStateManager[m.enableCull]() //enable culling + GlStateManager[m.popMatrix](); // popMatrix } testPlaySound(){ - if(this.player.getPlayer().func_98034_c(Player.getPlayer())){ + if(this.player.getPlayer()[m.isInvisibleToPlayer](Player.getPlayer())){ return } - let horisontalSpeed = Math.sqrt((this.player.getPlayer().field_70165_t-this.player.getPlayer().field_70142_S)**2+(this.player.getPlayer().field_70161_v-this.player.getPlayer().field_70136_U)**2) + 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 verticleSpeed = this.player.getPlayer().field_70163_u-this.player.getPlayer().field_70137_T + let verticleSpeed = 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 - if((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E){ //flying + if((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity]){ //flying if(this.animOffset-this.lastFlapSound > 2*Math.PI){ @@ -316,7 +318,7 @@ class DragonWings extends Cosmetic { } if(horisontalSpeed < 0.01){ - if(!((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E)){ //not flying + if(!((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround.Entity])){ //not flying let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) if(amt < 1*Math.PI){ if(amt > 0.65*Math.PI && (2*Math.PI+this.animOffset)-this.lastFlapSound > 2*Math.PI){ @@ -367,19 +369,19 @@ class DragonWings extends Cosmetic { this.lastRender = Date.now() - let horisontalSpeed = Math.sqrt((this.player.getPlayer().field_70165_t-this.player.getPlayer().field_70142_S)**2+(this.player.getPlayer().field_70161_v-this.player.getPlayer().field_70136_U)**2) + 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 verticleSpeed = this.player.getPlayer().field_70163_u-this.player.getPlayer().field_70137_T + let verticleSpeed = this.player.getPlayer()[f.posZ.Entity]-this.player.getPlayer()[f.lastTickPosZ] this.animOffset += Math.min(1, horisontalSpeed)*10*timeSince+1*timeSince - if(this.player.getPlayer().field_70172_ad > 0){ //damage tick + if(this.player.getPlayer()[f.hurtResistantTime] > 0){ //damage tick this.animOffset += 5*timeSince } // 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 - if((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E){ //flying + if((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround]){ //flying this.animOffset += 5*timeSince //flap in mid air if(verticleSpeed > 0){ @@ -391,7 +393,7 @@ class DragonWings extends Cosmetic { } if(horisontalSpeed < 0.01){ - if(!((verticleSpeed>-0.2) && !this.player.getPlayer().field_70122_E)){ //not flying + if(!((verticleSpeed>-0.2) && !this.player.getPlayer()[f.onGround])){ //not flying let amt = (this.animOffset+Math.PI/2)%(20*Math.PI) if(amt < 1*Math.PI){ this.animOffset += 2*timeSince*Math.min(1,(amt/(1*Math.PI))*2) -- cgit