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 ;
47
48
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MetadataType ;
48
49
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .MetadataTypes ;
49
50
import org .geysermc .mcprotocollib .protocol .data .game .entity .metadata .PaintingVariant ;
55
56
import org .geysermc .mcprotocollib .protocol .data .game .entity .player .BlockBreakStage ;
56
57
import org .geysermc .mcprotocollib .protocol .data .game .entity .player .GameMode ;
57
58
import org .geysermc .mcprotocollib .protocol .data .game .entity .player .PlayerSpawnInfo ;
59
+ import org .geysermc .mcprotocollib .protocol .data .game .entity .player .ResolvableProfile ;
58
60
import org .geysermc .mcprotocollib .protocol .data .game .inventory .VillagerTrade ;
59
61
import org .geysermc .mcprotocollib .protocol .data .game .item .HashedStack ;
60
62
import org .geysermc .mcprotocollib .protocol .data .game .item .ItemStack ;
78
80
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .Particle ;
79
81
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .ParticleData ;
80
82
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .ParticleType ;
83
+ import org .geysermc .mcprotocollib .protocol .data .game .level .particle .PowerParticleData ;
81
84
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .SculkChargeParticleData ;
82
85
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .ShriekParticleData ;
86
+ import org .geysermc .mcprotocollib .protocol .data .game .level .particle .SpellParticleData ;
83
87
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .TrailParticleData ;
84
88
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .VibrationParticleData ;
85
89
import org .geysermc .mcprotocollib .protocol .data .game .level .particle .positionsource .BlockPositionSource ;
@@ -985,6 +989,7 @@ public static void writeParticle(ByteBuf buf, Particle particle) {
985
989
public static ParticleData readParticleData (ByteBuf buf , ParticleType type ) {
986
990
return switch (type ) {
987
991
case BLOCK , BLOCK_MARKER , FALLING_DUST , DUST_PILLAR , BLOCK_CRUMBLE -> new BlockParticleData (MinecraftTypes .readVarInt (buf ));
992
+ case DRAGON_BREATH -> new PowerParticleData (buf .readFloat ());
988
993
case DUST -> {
989
994
int color = buf .readInt ();
990
995
float scale = buf .readFloat ();
@@ -996,7 +1001,12 @@ public static ParticleData readParticleData(ByteBuf buf, ParticleType type) {
996
1001
float scale = buf .readFloat ();
997
1002
yield new DustColorTransitionParticleData (color , scale , newColor );
998
1003
}
999
- case ENTITY_EFFECT , TINTED_LEAVES -> new ColorParticleData (buf .readInt ());
1004
+ case EFFECT , INSTANT_EFFECT -> {
1005
+ int color = buf .readInt ();
1006
+ float power = buf .readFloat ();
1007
+ yield new SpellParticleData (color , power );
1008
+ }
1009
+ case ENTITY_EFFECT , TINTED_LEAVES , FLASH -> new ColorParticleData (buf .readInt ());
1000
1010
case ITEM -> new ItemParticleData (MinecraftTypes .readItemStack (buf ));
1001
1011
case SCULK_CHARGE -> new SculkChargeParticleData (buf .readFloat ());
1002
1012
case SHRIEK -> new ShriekParticleData (MinecraftTypes .readVarInt (buf ));
@@ -1544,6 +1554,51 @@ public static void writeDynamicGameProfile(ByteBuf buf, GameProfile profile) {
1544
1554
MinecraftTypes .writeList (buf , profile .getProperties (), MinecraftTypes ::writeProperty );
1545
1555
}
1546
1556
1557
+ public static ResolvableProfile readResolvableProfile (ByteBuf buf ) {
1558
+ return buf .readBoolean ()
1559
+ ? new ResolvableProfile (MinecraftTypes .readStaticGameProfile (buf ), false )
1560
+ : new ResolvableProfile (MinecraftTypes .readDynamicGameProfile (buf ), true );
1561
+ }
1562
+
1563
+ public static void writeResolvableProfile (ByteBuf buf , ResolvableProfile profile ) {
1564
+ buf .writeBoolean (!profile .isDynamic ());
1565
+ if (!profile .isDynamic ()) {
1566
+ MinecraftTypes .writeStaticGameProfile (buf , profile .getProfile ());
1567
+ } else {
1568
+ MinecraftTypes .writeDynamicGameProfile (buf , profile .getProfile ());
1569
+ }
1570
+ }
1571
+
1572
+ public static MannequinProfile .CustomProfile readCustomProfile (ByteBuf buf ) {
1573
+ Key texture = MinecraftTypes .readResourceLocation (buf );
1574
+ Key capeTexture = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1575
+ Key elytraTexture = MinecraftTypes .readNullable (buf , MinecraftTypes ::readResourceLocation );
1576
+ GameProfile .TextureModel model = buf .readBoolean () ? GameProfile .TextureModel .SLIM : GameProfile .TextureModel .WIDE ;
1577
+ return new MannequinProfile .CustomProfile (texture , capeTexture , elytraTexture , model );
1578
+ }
1579
+
1580
+ public static void writeCustomProfile (ByteBuf buf , MannequinProfile .CustomProfile profile ) {
1581
+ MinecraftTypes .writeResourceLocation (buf , profile .getTexture ());
1582
+ MinecraftTypes .writeNullable (buf , profile .getCapeTexture (), MinecraftTypes ::writeResourceLocation );
1583
+ MinecraftTypes .writeNullable (buf , profile .getElytraTexture (), MinecraftTypes ::writeResourceLocation );
1584
+ buf .writeBoolean (profile .getModel () == GameProfile .TextureModel .SLIM );
1585
+ }
1586
+
1587
+ public static MannequinProfile readMannequinProfile (ByteBuf buf ) {
1588
+ return buf .readBoolean ()
1589
+ ? new MannequinProfile (MinecraftTypes .readCustomProfile (buf ), null )
1590
+ : new MannequinProfile (null , MinecraftTypes .readResolvableProfile (buf ));
1591
+ }
1592
+
1593
+ public static void writeMannequinProfile (ByteBuf buf , MannequinProfile profile ) {
1594
+ buf .writeBoolean (profile .getCustomProfile () != null );
1595
+ if (profile .getCustomProfile () != null ) {
1596
+ MinecraftTypes .writeCustomProfile (buf , profile .getCustomProfile ());
1597
+ } else {
1598
+ MinecraftTypes .writeResolvableProfile (buf , profile .getProfile ());
1599
+ }
1600
+ }
1601
+
1547
1602
public static GameProfile .Property readProperty (ByteBuf buf ) {
1548
1603
String name = MinecraftTypes .readString (buf );
1549
1604
String value = MinecraftTypes .readString (buf );
0 commit comments