44
44
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .CopperGolemState ;
45
45
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .EntityMetadata ;
46
46
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .GlobalPos ;
47
- import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MannequinProfile ;
48
47
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MetadataType ;
49
48
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MetadataTypes ;
50
49
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .PaintingVariant ;
@@ -1837,9 +1836,15 @@ public static void writeDynamicGameProfile(ByteBuf buf, GameProfile profile) {
1837
1836
}
1838
1837
1839
1838
public static ResolvableProfile readResolvableProfile (ByteBuf buf ) {
1840
- return buf .readBoolean ()
1841
- ? new ResolvableProfile (MinecraftTypes .readStaticGameProfile (buf ), false )
1842
- : new ResolvableProfile (MinecraftTypes .readDynamicGameProfile (buf ), true );
1839
+ boolean dynamic = !buf .readBoolean ();
1840
+ GameProfile profile = dynamic ? MinecraftTypes .readDynamicGameProfile (buf ) : MinecraftTypes .readStaticGameProfile (buf );
1841
+ Key body = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1842
+ Key cape = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1843
+ Key elytra = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1844
+ GameProfile .TextureModel model = MinecraftTypes .readNullable (buf , in -> {
1845
+ return in .readBoolean () ? GameProfile .TextureModel .SLIM : GameProfile .TextureModel .WIDE ;
1846
+ });
1847
+ return new ResolvableProfile (profile , body , cape , elytra , model , dynamic );
1843
1848
}
1844
1849
1845
1850
public static void writeResolvableProfile (ByteBuf buf , ResolvableProfile profile ) {
@@ -1849,36 +1854,11 @@ public static void writeResolvableProfile(ByteBuf buf, ResolvableProfile profile
1849
1854
} else {
1850
1855
MinecraftTypes .writeDynamicGameProfile (buf , profile .getProfile ());
1851
1856
}
1852
- }
1853
-
1854
- public static MannequinProfile .CustomProfile readCustomProfile (ByteBuf buf ) {
1855
- Key texture = MinecraftTypes .readResourceLocation (buf );
1856
- Key capeTexture = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1857
- Key elytraTexture = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1858
- GameProfile .TextureModel model = buf .readBoolean () ? GameProfile .TextureModel .SLIM : GameProfile .TextureModel .WIDE ;
1859
- return new MannequinProfile .CustomProfile (texture , capeTexture , elytraTexture , model );
1860
- }
1861
-
1862
- public static void writeCustomProfile (ByteBuf buf , MannequinProfile .CustomProfile profile ) {
1863
- MinecraftTypes .writeResourceLocation (buf , profile .getTexture ());
1864
- MinecraftTypes .writeNullable (buf , profile .getCapeTexture (), MinecraftTypes ::writeResourceLocation );
1865
- MinecraftTypes .writeNullable (buf , profile .getElytraTexture (), MinecraftTypes ::writeResourceLocation );
1866
- buf .writeBoolean (profile .getModel () == GameProfile .TextureModel .SLIM );
1867
- }
1868
-
1869
- public static MannequinProfile readMannequinProfile (ByteBuf buf ) {
1870
- return buf .readBoolean ()
1871
- ? new MannequinProfile (MinecraftTypes .readCustomProfile (buf ), null )
1872
- : new MannequinProfile (null , MinecraftTypes .readResolvableProfile (buf ));
1873
- }
1874
1857
1875
- public static void writeMannequinProfile (ByteBuf buf , MannequinProfile profile ) {
1876
- buf .writeBoolean (profile .getCustomProfile () != null );
1877
- if (profile .getCustomProfile () != null ) {
1878
- MinecraftTypes .writeCustomProfile (buf , profile .getCustomProfile ());
1879
- } else {
1880
- MinecraftTypes .writeResolvableProfile (buf , profile .getProfile ());
1881
- }
1858
+ MinecraftTypes .writeNullable (buf , profile .getBody (), MinecraftTypes ::writeResourceLocation );
1859
+ MinecraftTypes .writeNullable (buf , profile .getCape (), MinecraftTypes ::writeResourceLocation );
1860
+ MinecraftTypes .writeNullable (buf , profile .getElytra (), MinecraftTypes ::writeResourceLocation );
1861
+ MinecraftTypes .writeNullable (buf , profile .getModel (), (out , model ) -> out .writeBoolean (model == GameProfile .TextureModel .SLIM ));
1882
1862
}
1883
1863
1884
1864
public static GameProfile .Property readProperty (ByteBuf buf ) {
0 commit comments