2727
2828import com .mojang .blaze3d .vertex .PoseStack ;
2929import com .mojang .math .Axis ;
30- import net .minecraft .client .renderer .SubmitNodeCollector ;
3130import net .minecraft .client .renderer .item .ItemStackRenderState ;
3231import net .minecraft .client .resources .model .cuboid .ItemTransform ;
3332import net .minecraft .world .item .ItemDisplayContext ;
3433import net .minecraft .world .item .ItemStack ;
34+ import org .joml .Matrix4f ;
3535import org .spongepowered .asm .mixin .Final ;
3636import org .spongepowered .asm .mixin .Mixin ;
3737import org .spongepowered .asm .mixin .Shadow ;
@@ -69,8 +69,8 @@ public abstract class MixinItemStackRenderLayerState {
6969 }
7070
7171 // TODO/MOVE
72- @ Inject (method = "submit " , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/renderer/item/ItemStackRenderState$LayerRenderState;applyTransform(Lcom /mojang/blaze3d/vertex/PoseStack$Pose;)V" ))
73- private void animatium$itemPositions (final PoseStack poseStack , final SubmitNodeCollector nodeCollector , final int packedLight , final int packedOverlay , final int outlineColor , final CallbackInfo ci ) {
72+ @ Inject (method = "applyTransform " , at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/resources/model/cuboid/ItemTransform;apply(ZLcom /mojang/blaze3d/vertex/PoseStack$Pose;)V" ))
73+ private void animatium$itemPositions (final PoseStack . Pose localPose , final CallbackInfo ci ) {
7474 if (Animatium .isEnabled ()) {
7575 final ItemStack stack = itemStackRenderState .animatium$getItemStack ();
7676 if (!stack .isEmpty ()) {
@@ -84,45 +84,45 @@ public abstract class MixinItemStackRenderLayerState {
8484 if (AnimatiumConfig .instance ().items .fishingRodVersion != FishingRodVersion .VANILLA && ItemUtils .isFishingRodItem (stack ) && isFirstPerson ) {
8585 final int ordinal = AnimatiumConfig .instance ().items .fishingRodVersion .ordinal ();
8686 if (ordinal <= FishingRodVersion .V1_8 .ordinal ()) {
87- poseStack .translate (0.070625 , 0.1 , 0.020625 );
87+ localPose .translate (0.070625F , 0.1F , 0.020625F );
8888 }
8989
90- poseStack .translate (x , y , z );
90+ localPose .translate (x , y , z );
9191 if (ordinal == FishingRodVersion .V1_7 .ordinal ()) {
92- poseStack .mulPose (Axis .YP .rotationDegrees (180 ));
92+ localPose .mulPose (Axis .YP .rotationDegrees (180 ). get ( new Matrix4f () ));
9393 }
9494
95- poseStack .translate (-x , -y , -z );
95+ localPose .translate (-x , -y , -z );
9696 }
9797
9898 if (AnimatiumConfig .instance ().items .thinBlockPositions && ItemUtils .isThinBlockItem (stack )) {
9999 if (isFirstPerson ) {
100- poseStack .translate (0 , -4.2 * 0.0625 , 0 );
100+ localPose .translate (0.0F , -4.2F * 0.0625F , 0.0F );
101101 } else if (isThirdPerson ) {
102- poseStack .translate (0 , 0 , -2 * 0.0625 );
102+ localPose .translate (0.0F , 0.0F , -2.0F * 0.0625F );
103103 }
104104 }
105105
106106 // TODO/NEED TO FIX
107107 if (AnimatiumConfig .instance ().items .skullPosition && ItemUtils .isSkullBlock (stack ) && isGui && !AnimatiumConfig .instance ().items .mobHeadIcons ) {
108- poseStack .translate (x , y , z );
109- poseStack .mulPose (Axis .XP .rotationDegrees (Utils .toRadians (this .itemTransform .rotation ().x ())));
110- poseStack .mulPose (Axis .YP .rotationDegrees (Utils .toRadians (this .itemTransform .rotation ().y ())));
111- poseStack .mulPose (Axis .ZP .rotationDegrees (Utils .toRadians (this .itemTransform .rotation ().x ())));
112- poseStack .scale (0.9F , 0.9F , 0.9F );
113- poseStack .scale (this .itemTransform .scale ().x (), this .itemTransform .scale ().y (), this .itemTransform .scale ().z ());
114- animatium$doInverseTransformations (poseStack );
108+ localPose .translate (x , y , z );
109+ localPose .mulPose (Axis .XP .rotationDegrees (Utils .toRadians (this .itemTransform .rotation ().x ())). get ( new Matrix4f ( )));
110+ localPose .mulPose (Axis .YP .rotationDegrees (Utils .toRadians (this .itemTransform .rotation ().y ())). get ( new Matrix4f ( )));
111+ localPose .mulPose (Axis .ZP .rotationDegrees (Utils .toRadians (this .itemTransform .rotation ().x ())). get ( new Matrix4f ( )));
112+ localPose .scale (0.9F , 0.9F , 0.9F );
113+ localPose .scale (this .itemTransform .scale ().x (), this .itemTransform .scale ().y (), this .itemTransform .scale ().z ());
114+ animatium$doInverseTransformations (localPose );
115115 }
116116 }
117117 }
118118 }
119119
120120 @ Unique
121- private void animatium$doInverseTransformations (final PoseStack poseStack ) {
122- poseStack .scale (1 / this .itemTransform .scale ().x (), 1 / this .itemTransform .scale ().y (), 1 / this .itemTransform .scale ().z ());
123- poseStack .mulPose (Axis .ZP .rotationDegrees (-Utils .toRadians (this .itemTransform .rotation ().x ())));
124- poseStack .mulPose (Axis .YP .rotationDegrees (-Utils .toRadians (this .itemTransform .rotation ().y ())));
125- poseStack .mulPose (Axis .XP .rotationDegrees (-Utils .toRadians (this .itemTransform .rotation ().z ())));
126- poseStack .translate (-this .itemTransform .translation ().x (), -this .itemTransform .translation ().y (), -this .itemTransform .translation ().z ());
121+ private void animatium$doInverseTransformations (final PoseStack . Pose localPose ) {
122+ localPose .scale (1 / this .itemTransform .scale ().x (), 1 / this .itemTransform .scale ().y (), 1 / this .itemTransform .scale ().z ());
123+ localPose .mulPose (Axis .ZP .rotationDegrees (-Utils .toRadians (this .itemTransform .rotation ().x ())). get ( new Matrix4f ( )));
124+ localPose .mulPose (Axis .YP .rotationDegrees (-Utils .toRadians (this .itemTransform .rotation ().y ())). get ( new Matrix4f ( )));
125+ localPose .mulPose (Axis .XP .rotationDegrees (-Utils .toRadians (this .itemTransform .rotation ().z ())). get ( new Matrix4f ( )));
126+ localPose .translate (-this .itemTransform .translation ().x (), -this .itemTransform .translation ().y (), -this .itemTransform .translation ().z ());
127127 }
128128}
0 commit comments