1
1
package dev .renoux .dinnermod .mixins ;
2
2
3
3
import net .minecraft .client .render .entity .LivingEntityRenderer ;
4
- import net .minecraft .client .render .entity .PlayerModelPart ;
5
4
import net .minecraft .client .util .math .MatrixStack ;
6
5
import net .minecraft .entity .LivingEntity ;
7
6
import net .minecraft .entity .passive .*;
8
7
import net .minecraft .entity .player .PlayerEntity ;
8
+ import net .minecraft .entity .player .PlayerModelPart ;
9
9
import net .minecraft .util .Formatting ;
10
10
import net .minecraft .util .math .RotationAxis ;
11
11
import org .spongepowered .asm .mixin .Mixin ;
12
+ import org .spongepowered .asm .mixin .Unique ;
12
13
import org .spongepowered .asm .mixin .injection .At ;
13
14
import org .spongepowered .asm .mixin .injection .Inject ;
14
15
import org .spongepowered .asm .mixin .injection .callback .CallbackInfo ;
19
20
@ Mixin (LivingEntityRenderer .class )
20
21
public class LivingEntityRendererMixin {
21
22
23
+ @ Unique
22
24
private void transformFromName (String string , MatrixStack matrices ) {
23
- if (string .equals ("Pisteur_alpin" )) {
24
- matrices .translate (0.3D , 0.1F , 0.0D );
25
- matrices .multiply (RotationAxis .POSITIVE_Z .rotationDegrees (15.0F ));
26
- } else if (string .equals ("Kresqle" )) {
27
- matrices .translate (0.8D , 0.1F , 0.0D );
28
- matrices .multiply (RotationAxis .POSITIVE_Z .rotationDegrees (42.0F ));
29
- } else if (string .equals ("Aragorn1202" )) {
30
- matrices .translate (0.0D , 0.1F , 0.0D );
31
- matrices .multiply (RotationAxis .POSITIVE_Z .rotationDegrees (5.0F ));
32
- }
25
+ switch (string ) {
26
+ case "Pisteur_alpin" -> {
27
+ matrices .translate (0.3D , 0.1F , 0.0D );
28
+ matrices .multiply (RotationAxis .POSITIVE_Z .rotationDegrees (15.0F ));
29
+ }
30
+ case "Kresqle" -> {
31
+ matrices .translate (0.8D , 0.1F , 0.0D );
32
+ matrices .multiply (RotationAxis .POSITIVE_Z .rotationDegrees (42.0F ));
33
+ }
34
+ case "Aragorn1202" -> {
35
+ matrices .translate (0.0D , 0.1F , 0.0D );
36
+ matrices .multiply (RotationAxis .POSITIVE_Z .rotationDegrees (5.0F ));
37
+ }
38
+ }
33
39
}
34
40
35
41
@ Inject (at = @ At ("TAIL" ), method = "setupTransforms" )
36
- private void setupTransforms (LivingEntity entity , MatrixStack matrices , float animationProgress , float bodyYaw ,
37
- float tickDelta , CallbackInfo ci ) {
42
+ private void setupTransforms (LivingEntity entity , MatrixStack matrices , float animationProgress , float bodyYaw , float tickDelta , float scale , CallbackInfo ci ) {
38
43
Config Configuration = Config .getConfig ();
39
44
if ((entity instanceof PlayerEntity player )) {
40
- String string = player .getEntityName ();
45
+ String string = player .getName (). getString ();
41
46
if (player .isMainPlayer () && Configuration .getRotation () > 1 ) {
42
47
switch (Configuration .getRotation ()) {
43
48
case 2 -> {
@@ -64,7 +69,7 @@ private static void shouldFlipUpsideDown(LivingEntity entity, CallbackInfoReturn
64
69
Config Configuration = Config .getConfig ();
65
70
boolean value = false ;
66
71
if (entity instanceof PlayerEntity player ) {
67
- String string = player .getEntityName ();
72
+ String string = player .getName (). getString ();
68
73
if ((player .isMainPlayer () && Configuration .getRotation () == 1 ) || ((string .equals ("fantomitechno" )
69
74
|| string .equals ("fant0mib0t" ) || string .equals ("NewGlace" ) || string .equals ("Hardel" )
70
75
|| string .equals ("Dinnerbone" ) || string .equals ("Grumm" )) && !player .isMainPlayer ())) {
@@ -86,4 +91,4 @@ private static void shouldFlipUpsideDown(LivingEntity entity, CallbackInfoReturn
86
91
cir .cancel ();
87
92
cir .setReturnValue (value );
88
93
}
89
- }
94
+ }
0 commit comments