4444import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .CopperGolemState ;
4545import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .EntityMetadata ;
4646import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .GlobalPos ;
47- import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MannequinProfile ;
4847import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MetadataType ;
4948import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MetadataTypes ;
5049import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .PaintingVariant ;
@@ -1837,9 +1836,15 @@ public static void writeDynamicGameProfile(ByteBuf buf, GameProfile profile) {
18371836 }
18381837
18391838 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 );
18431848 }
18441849
18451850 public static void writeResolvableProfile (ByteBuf buf , ResolvableProfile profile ) {
@@ -1849,36 +1854,11 @@ public static void writeResolvableProfile(ByteBuf buf, ResolvableProfile profile
18491854 } else {
18501855 MinecraftTypes .writeDynamicGameProfile (buf , profile .getProfile ());
18511856 }
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- }
18741857
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 ));
18821862 }
18831863
18841864 public static GameProfile .Property readProperty (ByteBuf buf ) {
0 commit comments