@serenityjs/protocol 0.2.2-beta-20240428205839 → 0.2.2-beta-20240430005134

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.d.ts +300 -19
  2. package/dist/index.js +1268 -780
  3. package/package.json +6 -6
package/dist/index.d.ts CHANGED
@@ -229,7 +229,7 @@ declare enum MoveMode {
229
229
  Rotation = 3
230
230
  }
231
231
 
232
- declare enum RecordAction {
232
+ declare enum PlayerListAction {
233
233
  Add = 0,
234
234
  Remove = 1
235
235
  }
@@ -1589,7 +1589,8 @@ declare class Vector3f extends DataType {
1589
1589
  *
1590
1590
  * @returns The 3D vector with the coordinates floored.
1591
1591
  */
1592
- floor(): this;
1592
+ floor(): Vector3f;
1593
+ subtract(other: Vector3f): Vector3f;
1593
1594
  /**
1594
1595
  * Reads a 3D vector from the stream.
1595
1596
  *
@@ -1674,20 +1675,300 @@ declare class TeleportCause extends DataType {
1674
1675
  static write(stream: BinaryStream, value: TeleportCause, endian: Endianness, mode: MoveMode): void;
1675
1676
  }
1676
1677
 
1677
- declare class Records extends DataType {
1678
- buildPlatform?: number;
1679
- entityUniqueId?: bigint;
1680
- isHost?: boolean;
1681
- isTeacher?: boolean;
1682
- isSubclient?: boolean;
1683
- platformChatId?: string;
1684
- skin?: Buffer$1;
1685
- username?: string;
1686
- uuid: string;
1687
- xuid?: string;
1688
- constructor(uuid: string, buildPlatform?: number, entityUniqueId?: bigint, isHost?: boolean, isTeacher?: boolean, isSubclient?: boolean, platformChatId?: string, skin?: Buffer$1, username?: string, xuid?: string);
1689
- static read(stream: BinaryStream, endian: Endianness, action: RecordAction): Array<Records>;
1690
- static write(stream: BinaryStream, value: Array<Records>, endian: Endianness, action: RecordAction): void;
1678
+ /**
1679
+ * Represents a skin related image.
1680
+ */
1681
+ declare class SkinImage extends DataType {
1682
+ /**
1683
+ * The width of the image.
1684
+ */
1685
+ readonly width: number;
1686
+ /**
1687
+ * The height of the image.
1688
+ */
1689
+ readonly height: number;
1690
+ /**
1691
+ * The data of the image.
1692
+ */
1693
+ readonly data: string;
1694
+ /**
1695
+ * Creates a new skin image.
1696
+ *
1697
+ * @param width The width of the image.
1698
+ * @param height The height of the image.
1699
+ * @param data The data of the image.
1700
+ */
1701
+ constructor(width: number, height: number, data: string);
1702
+ static read(stream: BinaryStream): SkinImage;
1703
+ static write(stream: BinaryStream, image: SkinImage): void;
1704
+ }
1705
+
1706
+ /**
1707
+ * Represents an animation of a skin.
1708
+ */
1709
+ declare class SkinAnimation extends DataType {
1710
+ /**
1711
+ * The image of the animation.
1712
+ */
1713
+ readonly image: SkinImage;
1714
+ /**
1715
+ * The type of the animation.
1716
+ */
1717
+ readonly type: number;
1718
+ /**
1719
+ * The amount of frames of the animation.
1720
+ */
1721
+ readonly frames: number;
1722
+ /**
1723
+ * The type of the expression of the animation.
1724
+ */
1725
+ readonly expression: number;
1726
+ /**
1727
+ * Creates a new skin animation.
1728
+ *
1729
+ * @param image The image of the animation.
1730
+ * @param type The type of the animation.
1731
+ * @param frames The amount of frames of the animation.
1732
+ * @param expression The type of the expression of the animation.
1733
+ */
1734
+ constructor(image: SkinImage, type: number, frames: number, expression: number);
1735
+ static read(stream: BinaryStream): SkinAnimation;
1736
+ static write(stream: BinaryStream, animation: SkinAnimation): void;
1737
+ }
1738
+
1739
+ /**
1740
+ * Represents a piece of a persona skin.
1741
+ */
1742
+ declare class SkinPersonaPiece extends DataType {
1743
+ /**
1744
+ * The identifier of the piece.
1745
+ */
1746
+ readonly identifier: string;
1747
+ /**
1748
+ * The type of the piece.
1749
+ */
1750
+ readonly type: string;
1751
+ /**
1752
+ * The pack identifier of the piece.
1753
+ */
1754
+ readonly packIdentifier: string;
1755
+ /**
1756
+ * The is default state of the piece.
1757
+ */
1758
+ readonly isDefault: boolean;
1759
+ /**
1760
+ * The product identifier of the piece.
1761
+ */
1762
+ readonly productIdentifier: string;
1763
+ /**
1764
+ * Creates a new piece of a persona skin.
1765
+ *
1766
+ * @param identifier The identifier of the piece.
1767
+ * @param type The type of the piece.
1768
+ * @param packIdentifier The pack identifier of the piece.
1769
+ * @param isDefault The is default state of the piece.
1770
+ * @param productIdentifier The product identifier of the piece.
1771
+ */
1772
+ constructor(identifier: string, type: string, packIdentifier: string, isDefault: boolean, productIdentifier: string);
1773
+ static read(stream: BinaryStream): SkinPersonaPiece;
1774
+ static write(stream: BinaryStream, piece: SkinPersonaPiece): void;
1775
+ }
1776
+
1777
+ /**
1778
+ * Represents a tint piece of a persona skin.
1779
+ */
1780
+ declare class SkinPersonaTintPiece extends DataType {
1781
+ /**
1782
+ * The identifier of the tint piece.
1783
+ */
1784
+ readonly type: string;
1785
+ /**
1786
+ * The colors of the tint piece.
1787
+ */
1788
+ readonly colors: Array<string>;
1789
+ /**
1790
+ * Creates a new tint piece of a persona skin.
1791
+ *
1792
+ * @param type The identifier of the tint piece.
1793
+ * @param colors The colors of the tint piece.
1794
+ */
1795
+ constructor(type: string, colors: Array<string>);
1796
+ static read(stream: BinaryStream): SkinPersonaTintPiece;
1797
+ static write(stream: BinaryStream, tintPiece: SkinPersonaTintPiece): void;
1798
+ }
1799
+
1800
+ /**
1801
+ * Represents a skin.
1802
+ */
1803
+ declare class SerializedSkin extends DataType {
1804
+ /**
1805
+ * The identifier of the skin.
1806
+ */
1807
+ readonly identifier: string;
1808
+ /**
1809
+ * The playfab identifier of the skin.
1810
+ */
1811
+ readonly playFabIdentifier: string;
1812
+ /**
1813
+ * The resource patch of the skin.
1814
+ */
1815
+ readonly resourcePatch: string;
1816
+ /**
1817
+ * The skin image.
1818
+ */
1819
+ readonly skinImage: SkinImage;
1820
+ /**
1821
+ * The animations of the skin.
1822
+ */
1823
+ readonly animations: Array<SkinAnimation>;
1824
+ /**
1825
+ * The cape image.
1826
+ */
1827
+ readonly capeImage: SkinImage;
1828
+ /**
1829
+ * The geometry data of the skin.
1830
+ */
1831
+ readonly geometryData: string;
1832
+ /**
1833
+ * The geometry version of the skin.
1834
+ */
1835
+ readonly geometryVersion: string;
1836
+ /**
1837
+ * The animation data of the skin.
1838
+ */
1839
+ readonly animationData: string;
1840
+ /**
1841
+ * The animation engine of the skin.
1842
+ */
1843
+ readonly capeIdentifier: string;
1844
+ /**
1845
+ * The full identifier of the skin.
1846
+ */
1847
+ readonly fullIdentifier: string;
1848
+ /**
1849
+ * The arm size of the skin.
1850
+ */
1851
+ readonly armSize: string;
1852
+ /**
1853
+ * The skin color of the skin.
1854
+ */
1855
+ readonly skinColor: string;
1856
+ /**
1857
+ * The persona pieces of the skin.
1858
+ */
1859
+ readonly personaPieces: Array<SkinPersonaPiece>;
1860
+ /**
1861
+ * The tint pieces of the skin.
1862
+ */
1863
+ readonly tintPieces: Array<SkinPersonaTintPiece>;
1864
+ /**
1865
+ * If the skin is premium.
1866
+ */
1867
+ readonly isPremium: boolean;
1868
+ /**
1869
+ * If the skin is persona.
1870
+ */
1871
+ readonly isPersona: boolean;
1872
+ /**
1873
+ * If there is a persona cape on classic skin.
1874
+ */
1875
+ readonly isPersonaCapeOnClassic: boolean;
1876
+ /**
1877
+ * If the skin is used by its primary user.
1878
+ */
1879
+ readonly isPrimaryUser: boolean;
1880
+ /**
1881
+ * If the skin will override the player appearance.
1882
+ */
1883
+ readonly overridingPlayerAppearance: boolean;
1884
+ /**
1885
+ * Creates a new serialized skin.
1886
+ *
1887
+ * @param identifier The identifier of the skin.
1888
+ * @param playFabIdentifier The playfab identifier of the skin.
1889
+ * @param resourcePatch The resource patch of the skin.
1890
+ * @param skinImage The skin image.
1891
+ * @param animations The animations of the skin.
1892
+ * @param capeImage The cape image.
1893
+ * @param geometryData The geometry data of the skin.
1894
+ * @param geometryVersion The geometry version of the skin.
1895
+ * @param animationData The animation data of the skin.
1896
+ * @param capeIdentifier The cape identifier of the skin.
1897
+ * @param fullIdentifier The full identifier of the skin.
1898
+ * @param armSize The arm size of the skin.
1899
+ * @param skin
1900
+ * @param personaPieces The persona pieces of the skin.
1901
+ * @param tintPieces The tint pieces of the skin.
1902
+ * @param isPremium If the skin is premium.
1903
+ * @param isPersona If the skin is persona.
1904
+ * @param isPersonaCapeOnClassic If there is a persona cape on classic skin.
1905
+ * @param isPrimaryUser If the skin is used by its primary user.
1906
+ * @param overridingPlayerAppearance If the skin will override the player appearance.
1907
+ * @returns A new serialized skin.
1908
+ */
1909
+ constructor(identifier: string, playFabIdentifier: string, resourcePatch: string, skinImage: SkinImage, animations: Array<SkinAnimation>, capeImage: SkinImage, geometryData: string, geometryVersion: string, animationData: string, capeIdentifier: string, fullIdentifier: string, armSize: string, skinColor: string, personaPieces: Array<SkinPersonaPiece>, tintPieces: Array<SkinPersonaTintPiece>, isPremium: boolean, isPersona: boolean, isPersonaCapeOnClassic: boolean, isPrimaryUser: boolean, overridingPlayerAppearance: boolean);
1910
+ static read(stream: BinaryStream): SerializedSkin;
1911
+ static write(stream: BinaryStream, skin: SerializedSkin): void;
1912
+ }
1913
+
1914
+ declare class PlayerListRecord extends DataType {
1915
+ /**
1916
+ * The uuid of the player.
1917
+ */
1918
+ readonly uuid: string;
1919
+ /**
1920
+ * The unique actor id of the player.
1921
+ */
1922
+ readonly uniqueId: bigint | null;
1923
+ /**
1924
+ * The username of the player.
1925
+ */
1926
+ readonly username: string | null;
1927
+ /**
1928
+ * The xbox user id of the player.
1929
+ */
1930
+ readonly xuid: string | null;
1931
+ /**
1932
+ * The platform chat identifier of the player.
1933
+ */
1934
+ readonly platformChatIdentifier: string | null;
1935
+ /**
1936
+ * The platform build of the player.
1937
+ */
1938
+ readonly platformBuild: number | null;
1939
+ /**
1940
+ * The skin of the player.
1941
+ */
1942
+ readonly skin: SerializedSkin | null;
1943
+ /**
1944
+ * Whether the player is a teacher.
1945
+ */
1946
+ readonly isTeacher: boolean | null;
1947
+ /**
1948
+ * Whether the player is a host.
1949
+ */
1950
+ readonly isHost: boolean | null;
1951
+ /**
1952
+ * Whether the player is a visitor.
1953
+ */
1954
+ readonly isVisitor: boolean | null;
1955
+ /**
1956
+ * Creates a new player record.
1957
+ *
1958
+ * @param uuid The uuid of the player.
1959
+ * @param uniqueId The unique actor id of the player.
1960
+ * @param username The username of the player.
1961
+ * @param xuid The xbox user id of the player.
1962
+ * @param platformChatIdentifier The platform chat identifier of the player.
1963
+ * @param platformBuild The platform build of the player.
1964
+ * @param skin The skin of the player.
1965
+ * @param isTeacher Whether the player is a teacher.
1966
+ * @param isHost Whether the player is a host.
1967
+ * @param isVisitor Whether the player is a visitor.
1968
+ */
1969
+ constructor(uuid: string, uniqueId?: bigint | null, username?: string | null, xuid?: string | null, platformChatIdentifier?: string | null, platformBuild?: number | null, skin?: SerializedSkin | null, isTeacher?: boolean | null, isHost?: boolean | null, isVisitor?: boolean | null);
1970
+ static read(stream: BinaryStream, _endian: Endianness, action: PlayerListAction): Array<PlayerListRecord>;
1971
+ static write(stream: BinaryStream, records: Array<PlayerListRecord>, _endian: Endianness, action: PlayerListAction): void;
1691
1972
  }
1692
1973
 
1693
1974
  interface AbilityFlag {
@@ -2773,8 +3054,8 @@ declare class PlayerHotbarPacket extends DataPacket {
2773
3054
  }
2774
3055
 
2775
3056
  declare class PlayerListPacket extends DataPacket {
2776
- action: RecordAction;
2777
- records: Array<Records>;
3057
+ action: PlayerListAction;
3058
+ records: Array<PlayerListRecord>;
2778
3059
  }
2779
3060
 
2780
3061
  declare class RemoveEntityPacket extends DataPacket {
@@ -3103,4 +3384,4 @@ declare const PROTOCOL_VERSION = 671;
3103
3384
  declare const MINECRAFT_VERSION = "1.20.80";
3104
3385
  declare const MINECRAFT_TICK_SPEED = 50;
3105
3386
 
3106
- export { AbilityLayerFlag, AbilityLayerType, AbilityLayers, AbilitySet, ActionIds, AddEntityPacket, AddItemActorPacket, AddPlayerPacket, AnimateAction, AnimateId, AnimatePacket, Attribute, AvailableCommandsPacket, BehaviorPackInfo, BiomeDefinitionListPacket, BlockCoordinates, BlockFace, BlockPickRequestPacket, BlockProperties, ChainedSubcommandValues, ChangeDimensionPacket, ChunkCoords, ChunkRadiusUpdatePacket, CommandOriginData, CommandOutputData, CommandOutputMessage, CommandOutputPacket, CommandParameterType, CommandPermissionLevel, CommandRequestPacket, Commands, ComplexInventoryTransaction, ComponentItem, CompressionMethod, ContainerClosePacket, ContainerId, ContainerName, ContainerOpenPacket, ContainerType, CreativeContentPacket, CreativeItems, DataPacket, DeviceOS, Difficulty, DimensionType, DisconnectPacket, DisconnectReason, DynamicEnums, EntityAttributes, EntityProperties, EnumConstraints, EnumValues, Enums, Experiments, Framer, GameRuleType, GameRules, Gamemode, InteractActions, InteractPacket, InteractPosition, InventoryAction, InventoryContentPacket, InventorySlotPacket, InventorySource, InventorySourceType, InventoryTransaction, InventoryTransactionPacket, ItemComponentPacket, ItemData, ItemInstanceUserData, ItemReleaseInventoryTransaction, ItemReleaseInventoryTransactionType, type ItemStackAction, ItemStackActionType, type ItemStackContainer, ItemStackRequestPacket, ItemStackRequests, ItemStackResponsePacket, ItemStackResponses, ItemStackStatus, ItemStacks, ItemUseInventoryTransaction, ItemUseInventoryTransactionType, ItemUseOnEntityInventoryTransaction, ItemUseOnEntityInventoryTransactionType, LegacyTransaction, LevelChunkPacket, LevelEvent, LevelEventPacket, LevelSoundEvent, LevelSoundEventPacket, Links, LoginPacket, LoginTokens, MINECRAFT_TICK_SPEED, MINECRAFT_VERSION, MetadataDictionary, MetadataFlags, MetadataKey, MetadataType, MobEquipmentPacket, ModalFormCanceled, ModalFormCanceledReason, ModalFormData, ModalFormRequestPacket, ModalFormResponsePacket, ModalFormType, MoveActorAbsolutePacket, MoveMode, MovePlayerPacket, NetworkChunkPublisherUpdatePacket, NetworkItemInstanceDescriptor, NetworkItemStackDescriptor, NetworkSettingsPacket, PROTOCOL_VERSION, PackLinks, PackType, Packet, PacketViolationWarningPacket, Packets, PermissionLevel, PlayStatus, PlayStatusPacket, PlayerActionPacket, PlayerAttributes, PlayerAuthInputPacket, PlayerHotbarPacket, PlayerListPacket, PostFixes, RecordAction, Records, RemoveEntityPacket, RequestChunkRadiusPacket, RequestNetworkSettingsPacket, ResourceIdVersions, ResourcePackChunkDataPacket, ResourcePackChunkRequestPacket, ResourcePackClientResponsePacket, ResourcePackDataInfoPacket, ResourcePackIds, ResourcePackResponse, ResourcePackStackPacket, ResourcePacksInfoPacket, RespawnPacket, RespawnState, Rotation, ScriptMessagePacket, SetActorMotionPacket, SetCommandsEnabledPacket, SetEntityDataPacket, SetLocalPlayerAsInitializedPacket, SetPlayerGameTypePacket, SetTimePacket, SetTitlePacket, StackRequestSlotInfo, StartGamePacket, Subcommands, TeleportCause, TextPacket, TextPacketType, TextParameters, TextSource, TexturePackInfo, TitleTypes, ToastRequestPacket, TransactionSourceType, UpdateAbilitiesPacket, UpdateAdventureSettingsPacket, UpdateAttributesPacket, UpdateBlockFlagsType, UpdateBlockLayerType, UpdateBlockPacket, VariableStringArray as VarStringArray, VarintArray, Vector2f, Vector3f, ViolationSeverity, ViolationType, getPacketId };
3387
+ export { AbilityLayerFlag, AbilityLayerType, AbilityLayers, AbilitySet, ActionIds, AddEntityPacket, AddItemActorPacket, AddPlayerPacket, AnimateAction, AnimateId, AnimatePacket, Attribute, AvailableCommandsPacket, BehaviorPackInfo, BiomeDefinitionListPacket, BlockCoordinates, BlockFace, BlockPickRequestPacket, BlockProperties, ChainedSubcommandValues, ChangeDimensionPacket, ChunkCoords, ChunkRadiusUpdatePacket, CommandOriginData, CommandOutputData, CommandOutputMessage, CommandOutputPacket, CommandParameterType, CommandPermissionLevel, CommandRequestPacket, Commands, ComplexInventoryTransaction, ComponentItem, CompressionMethod, ContainerClosePacket, ContainerId, ContainerName, ContainerOpenPacket, ContainerType, CreativeContentPacket, CreativeItems, DataPacket, DeviceOS, Difficulty, DimensionType, DisconnectPacket, DisconnectReason, DynamicEnums, EntityAttributes, EntityProperties, EnumConstraints, EnumValues, Enums, Experiments, Framer, GameRuleType, GameRules, Gamemode, InteractActions, InteractPacket, InteractPosition, InventoryAction, InventoryContentPacket, InventorySlotPacket, InventorySource, InventorySourceType, InventoryTransaction, InventoryTransactionPacket, ItemComponentPacket, ItemData, ItemInstanceUserData, ItemReleaseInventoryTransaction, ItemReleaseInventoryTransactionType, type ItemStackAction, ItemStackActionType, type ItemStackContainer, ItemStackRequestPacket, ItemStackRequests, ItemStackResponsePacket, ItemStackResponses, ItemStackStatus, ItemStacks, ItemUseInventoryTransaction, ItemUseInventoryTransactionType, ItemUseOnEntityInventoryTransaction, ItemUseOnEntityInventoryTransactionType, LegacyTransaction, LevelChunkPacket, LevelEvent, LevelEventPacket, LevelSoundEvent, LevelSoundEventPacket, Links, LoginPacket, LoginTokens, MINECRAFT_TICK_SPEED, MINECRAFT_VERSION, MetadataDictionary, MetadataFlags, MetadataKey, MetadataType, MobEquipmentPacket, ModalFormCanceled, ModalFormCanceledReason, ModalFormData, ModalFormRequestPacket, ModalFormResponsePacket, ModalFormType, MoveActorAbsolutePacket, MoveMode, MovePlayerPacket, NetworkChunkPublisherUpdatePacket, NetworkItemInstanceDescriptor, NetworkItemStackDescriptor, NetworkSettingsPacket, PROTOCOL_VERSION, PackLinks, PackType, Packet, PacketViolationWarningPacket, Packets, PermissionLevel, PlayStatus, PlayStatusPacket, PlayerActionPacket, PlayerAttributes, PlayerAuthInputPacket, PlayerHotbarPacket, PlayerListAction, PlayerListPacket, PlayerListRecord, PostFixes, RemoveEntityPacket, RequestChunkRadiusPacket, RequestNetworkSettingsPacket, ResourceIdVersions, ResourcePackChunkDataPacket, ResourcePackChunkRequestPacket, ResourcePackClientResponsePacket, ResourcePackDataInfoPacket, ResourcePackIds, ResourcePackResponse, ResourcePackStackPacket, ResourcePacksInfoPacket, RespawnPacket, RespawnState, Rotation, ScriptMessagePacket, SerializedSkin, SetActorMotionPacket, SetCommandsEnabledPacket, SetEntityDataPacket, SetLocalPlayerAsInitializedPacket, SetPlayerGameTypePacket, SetTimePacket, SetTitlePacket, SkinAnimation, SkinImage, SkinPersonaPiece, SkinPersonaTintPiece, StackRequestSlotInfo, StartGamePacket, Subcommands, TeleportCause, TextPacket, TextPacketType, TextParameters, TextSource, TexturePackInfo, TitleTypes, ToastRequestPacket, TransactionSourceType, UpdateAbilitiesPacket, UpdateAdventureSettingsPacket, UpdateAttributesPacket, UpdateBlockFlagsType, UpdateBlockLayerType, UpdateBlockPacket, VariableStringArray as VarStringArray, VarintArray, Vector2f, Vector3f, ViolationSeverity, ViolationType, getPacketId };