Skip to content

Commit

Permalink
Miscellaneous refactorings (#667)
Browse files Browse the repository at this point in the history
* Refactored getSpeed to getFovSpeedMultiplier

Uses the same name as Yarn mappings. Could be worth considering whether it's worth specifying that the multiplier primarily takes the player speed into account, but as far as I can tell, nothing else changes the FOV besides speed-altering effects.

* Refactored displayMessage to hideMessage

Reflects described behavior in #662. Behavior currently unchecked manually.

* Named parameters for getFovMultiplier

Co-authored-by: Will <[email protected]>

---------

Co-authored-by: Will <[email protected]>
  • Loading branch information
maloryware and supersaiyansubtlety authored Nov 27, 2024
1 parent 8041e15 commit 19d56f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ CLASS net/minecraft/unmapped/C_ckkrwxej net/minecraft/client/gui/widget/button/S
METHOD m_eeuzpwym builder (Lnet/minecraft/unmapped/C_rdaqiwdt;Lnet/minecraft/unmapped/C_buwziidm$C_zlxjklbn;Z)Lnet/minecraft/unmapped/C_ckkrwxej$C_klyiyhla;
ARG 0 message
ARG 1 action
ARG 2 displayMessage
ARG 2 hideMessage
CLASS C_dqzfmcqd SpriteOnlyButtonWidget
CLASS C_klyiyhla Builder
FIELD f_bomypkpa sprite Lnet/minecraft/unmapped/C_ncpywfca;
FIELD f_bwxjsqnx displayMessage Z
FIELD f_bwxjsqnx hideMessage Z
FIELD f_dqpzxydv width I
FIELD f_dvtlfeui height I
FIELD f_ekxkdxmq spriteWidth I
Expand All @@ -29,7 +29,7 @@ CLASS net/minecraft/unmapped/C_ckkrwxej net/minecraft/client/gui/widget/button/S
METHOD <init> (Lnet/minecraft/unmapped/C_rdaqiwdt;Lnet/minecraft/unmapped/C_buwziidm$C_zlxjklbn;Z)V
ARG 1 message
ARG 2 onPress
ARG 3 displayMessage
ARG 3 hideMessage
METHOD m_bhotokkh build ()Lnet/minecraft/unmapped/C_ckkrwxej;
METHOD m_ebdkihgv width (I)Lnet/minecraft/unmapped/C_ckkrwxej$C_klyiyhla;
ARG 1 width
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ CLASS net/minecraft/unmapped/C_sgyyxgui net/minecraft/client/network/AbstractCli
ARG 2 profile
METHOD m_ipxgqpif lerpVelocity (F)Lnet/minecraft/unmapped/C_vgpupfxx;
ARG 1 delta
METHOD m_jjnbolzs getSpeed (ZF)F
METHOD m_jjnbolzs getFovMultiplier (ZF)F
ARG 1 firstPerson
ARG 2 effectScale
METHOD m_kzmhnjvr getSkin ()Lnet/minecraft/unmapped/C_idvschhb;
METHOD m_luyaebra getPlayerListEntry ()Lnet/minecraft/unmapped/C_rdnfmxue;

1 comment on commit 19d56f8

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With commit 19d56f8, 3 file(s) were updated with 12 line(s) added and 12 removed compared to the latest Quilt Mappings version.

View the diff here:
diff -bur namedTargetSrc/net/minecraft/client/gui/widget/button/SpriteButtonWidget.java namedSrc/net/minecraft/client/gui/widget/button/SpriteButtonWidget.java
--- namedTargetSrc/net/minecraft/client/gui/widget/button/SpriteButtonWidget.java	2024-11-27 04:34:44.841680044 +0000
+++ namedSrc/net/minecraft/client/gui/widget/button/SpriteButtonWidget.java	2024-11-27 04:33:28.192524123 +0000
@@ -55,8 +55,8 @@
     * @mapping {@literal hashed m_eeuzpwym Lnet/minecraft/unmapped/C_ckkrwxej;m_eeuzpwym(Lnet/minecraft/unmapped/C_rdaqiwdt;Lnet/minecraft/unmapped/C_buwziidm$C_zlxjklbn;Z)Lnet/minecraft/unmapped/C_ckkrwxej$C_klyiyhla;}
     * @mapping {@literal named builder Lnet/minecraft/client/gui/widget/button/SpriteButtonWidget;builder(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/button/ButtonWidget$PressAction;Z)Lnet/minecraft/client/gui/widget/button/SpriteButtonWidget$Builder;}
     */
-   public static SpriteButtonWidget.Builder builder(Text message, ButtonWidget.PressAction action, boolean displayMessage) {
-      return new SpriteButtonWidget.Builder(message, action, displayMessage);
+   public static SpriteButtonWidget.Builder builder(Text message, ButtonWidget.PressAction action, boolean hideMessage) {
+      return new SpriteButtonWidget.Builder(message, action, hideMessage);
    }
 
    /**
@@ -77,9 +77,9 @@
       private final ButtonWidget.PressAction onPress;
       /**
        * @mapping {@literal hashed f_bwxjsqnx Lnet/minecraft/unmapped/C_ckkrwxej$C_klyiyhla;f_bwxjsqnx:Z}
-       * @mapping {@literal named displayMessage Lnet/minecraft/client/gui/widget/button/SpriteButtonWidget$Builder;displayMessage:Z}
+       * @mapping {@literal named hideMessage Lnet/minecraft/client/gui/widget/button/SpriteButtonWidget$Builder;hideMessage:Z}
        */
-      private final boolean displayMessage;
+      private final boolean hideMessage;
       /**
        * @mapping {@literal hashed f_dqpzxydv Lnet/minecraft/unmapped/C_ckkrwxej$C_klyiyhla;f_dqpzxydv:I}
        * @mapping {@literal named width Lnet/minecraft/client/gui/widget/button/SpriteButtonWidget$Builder;width:I}
@@ -117,10 +117,10 @@
        * @mapping {@literal hashed <init> Lnet/minecraft/unmapped/C_ckkrwxej$C_klyiyhla;<init>(Lnet/minecraft/unmapped/C_rdaqiwdt;Lnet/minecraft/unmapped/C_buwziidm$C_zlxjklbn;Z)V}
        * @mapping {@literal named <init> Lnet/minecraft/client/gui/widget/button/SpriteButtonWidget$Builder;<init>(Lnet/minecraft/text/Text;Lnet/minecraft/client/gui/widget/button/ButtonWidget$PressAction;Z)V}
        */
-      public Builder(Text message, ButtonWidget.PressAction onPress, boolean displayMessage) {
+      public Builder(Text message, ButtonWidget.PressAction onPress, boolean hideMessage) {
          this.message = message;
          this.onPress = onPress;
-         this.displayMessage = displayMessage;
+         this.hideMessage = hideMessage;
       }
 
       /**
@@ -170,7 +170,7 @@
          if (this.sprite == null) {
             throw new IllegalStateException("Sprite not set");
          } else {
-            return (SpriteButtonWidget)(this.displayMessage
+            return (SpriteButtonWidget)(this.hideMessage
                ? new SpriteButtonWidget.SpriteOnlyButtonWidget(
                   this.width, this.height, this.message, this.spriteWidth, this.spriteHeight, this.sprite, this.onPress, this.narrationFactory
                )
diff -bur namedTargetSrc/net/minecraft/client/network/AbstractClientPlayerEntity.java namedSrc/net/minecraft/client/network/AbstractClientPlayerEntity.java
--- namedTargetSrc/net/minecraft/client/network/AbstractClientPlayerEntity.java	2024-11-27 04:34:44.741678521 +0000
+++ namedSrc/net/minecraft/client/network/AbstractClientPlayerEntity.java	2024-11-27 04:33:28.016521487 +0000
@@ -130,9 +130,9 @@
 
    /**
     * @mapping {@literal hashed m_jjnbolzs Lnet/minecraft/unmapped/C_sgyyxgui;m_jjnbolzs(ZF)F}
-    * @mapping {@literal named getSpeed Lnet/minecraft/client/network/AbstractClientPlayerEntity;getSpeed(ZF)F}
+    * @mapping {@literal named getFovMultiplier Lnet/minecraft/client/network/AbstractClientPlayerEntity;getFovMultiplier(ZF)F}
     */
-   public float getSpeed(boolean bl, float f) {
+   public float getFovMultiplier(boolean firstPerson, float effectScale) {
       float g = 1.0F;
       if (this.getAbilities().flying) {
          g *= 1.1F;
@@ -148,11 +148,11 @@
          if (this.getActiveItem().isOf(Items.BOW)) {
             float j = Math.min((float)this.getItemUseTime() / 20.0F, 1.0F);
             g *= 1.0F - MathHelper.square(j) * 0.15F;
-         } else if (bl && this.isUsingSpyglass()) {
+         } else if (firstPerson && this.isUsingSpyglass()) {
             return 0.1F;
          }
       }
 
-      return MathHelper.lerp(f, 1.0F, g);
+      return MathHelper.lerp(effectScale, 1.0F, g);
    }
 }
diff -bur namedTargetSrc/net/minecraft/client/render/GameRenderer.java namedSrc/net/minecraft/client/render/GameRenderer.java
--- namedTargetSrc/net/minecraft/client/render/GameRenderer.java	2024-11-27 04:34:44.629676814 +0000
+++ namedSrc/net/minecraft/client/render/GameRenderer.java	2024-11-27 04:33:27.872519329 +0000
@@ -508,7 +508,7 @@
          GameOptions lv2 = this.client.options;
          boolean bl = lv2.getPerspective().isFirstPerson();
          float f = lv2.getFovEffectScale().get().floatValue();
-         g = lv.getSpeed(bl, f);
+         g = lv.getFovMultiplier(bl, f);
       } else {
          g = 1.0F;
       }

Please sign in to comment.