@@ -41,6 +41,8 @@ public ItemVisual(VisualizationContext ctx, ItemEntity entity, float partialTick
4141 instances = new InstanceRecycler <>(() -> ctx .instancerProvider ()
4242 .instancer (InstanceTypes .TRANSFORMED , model )
4343 .createInstance ());
44+
45+ animate (partialTick );
4446 }
4547
4648 public static boolean isSupported (ItemEntity entity ) {
@@ -53,9 +55,13 @@ public void beginFrame(Context ctx) {
5355 return ;
5456 }
5557
58+ animate (ctx .partialTick ());
59+ }
60+
61+ private void animate (float partialTick ) {
5662 pPoseStack .setIdentity ();
5763 TransformStack .of (pPoseStack )
58- .translate (getVisualPosition (ctx . partialTick () ));
64+ .translate (getVisualPosition (partialTick ));
5965
6066 instances .resetCount ();
6167 ItemStack itemstack = entity .getItem ();
@@ -65,16 +71,17 @@ public void beginFrame(Context ctx) {
6571 boolean flag = bakedModel .isGui3d ();
6672 int j = this .getRenderAmount (itemstack );
6773 float f = 0.25F ;
68- float f1 = shouldBob () ? Mth .sin (((float ) entity .getAge () + ctx .partialTick ()) / 10.0F + entity .bobOffs ) * 0.1F + 0.1F : 0 ;
69- float f2 = bakedModel .getTransforms ()
70- .getTransform (ItemDisplayContext .GROUND ).scale .y ();
71- pPoseStack .translate (0.0F , f1 + 0.25F * f2 , 0.0F );
72- float f3 = entity .getSpin (ctx .partialTick ());
74+ float f1 = shouldBob () ? Mth .sin (((float ) entity .getAge () + partialTick ) / 10.0F + entity .bobOffs ) * 0.1F + 0.1F : 0 ;
75+ float groundScaleX = bakedModel .getTransforms ().ground .scale .y ();
76+ float groundScaleY = bakedModel .getTransforms ().ground .scale .y ();
77+ float groundScaleZ = bakedModel .getTransforms ().ground .scale .y ();
78+ pPoseStack .translate (0.0F , f1 + 0.25F * groundScaleZ , 0.0F );
79+ float f3 = entity .getSpin (partialTick );
7380 pPoseStack .mulPose (Axis .YP .rotation (f3 ));
7481 if (!flag ) {
75- float f7 = -0.0F * (float ) (j - 1 ) * 0.5F ;
76- float f8 = -0.0F * (float ) (j - 1 ) * 0.5F ;
77- float f9 = -0.09375F * (float ) (j - 1 ) * 0.5F ;
82+ float f7 = -0.0F * (float ) (j - 1 ) * 0.5F * groundScaleX ;
83+ float f8 = -0.0F * (float ) (j - 1 ) * 0.5F * groundScaleY ;
84+ float f9 = -0.09375F * (float ) (j - 1 ) * 0.5F * groundScaleZ ;
7885 pPoseStack .translate (f7 , f8 , f9 );
7986 }
8087
@@ -101,7 +108,7 @@ public void beginFrame(Context ctx) {
101108 .setChanged ();
102109 pPoseStack .popPose ();
103110 if (!flag ) {
104- pPoseStack .translate (0.0 , 0.0 , 0.09375F );
111+ pPoseStack .translate (0.0 , 0.0 , 0.09375F * groundScaleZ );
105112 }
106113 }
107114
0 commit comments