hytopia 0.11.1 → 0.11.3

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.
@@ -130,7 +130,7 @@ startServer(world => {
130
130
  */
131
131
 
132
132
  new Audio({
133
- uri: 'audio/music/hytopia-main.mp3',
133
+ uri: 'audio/music/hytopia-main-theme.mp3',
134
134
  loop: true,
135
135
  volume: 0.1,
136
136
  }).play(world);
@@ -0,0 +1,21 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [BlockTextureMetadata](./server.blocktexturemetadata.md)
4
+
5
+ ## BlockTextureMetadata type
6
+
7
+ Block texture metadata including UVs and rendering hints.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export type BlockTextureMetadata = {
13
+ u0: number;
14
+ v0: number;
15
+ u1: number;
16
+ v1: number;
17
+ averageRGB: [number, number, number];
18
+ isTransparent: boolean;
19
+ needsAlphaTest: boolean;
20
+ };
21
+ ```
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [BlockTextureRegistry](./server.blocktextureregistry.md) &gt; [generateEveryStart](./server.blocktextureregistry.generateeverystart.md)
4
+
5
+ ## BlockTextureRegistry.generateEveryStart property
6
+
7
+ Whether to always generate the atlas on server start.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ generateEveryStart: boolean;
13
+ ```
@@ -0,0 +1,56 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [BlockTextureRegistry](./server.blocktextureregistry.md) &gt; [getBlockTextureMetadata](./server.blocktextureregistry.getblocktexturemetadata.md)
4
+
5
+ ## BlockTextureRegistry.getBlockTextureMetadata() method
6
+
7
+ Retrieves metadata for a block texture. Returns array for cubemaps (6 faces) or standard textures (1 face).
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ getBlockTextureMetadata(textureUri: string): BlockTextureMetadata[] | undefined;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ textureUri
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The URI of the texture (e.g., 'blocks/stone.png' or 'blocks/grass').
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ [BlockTextureMetadata](./server.blocktexturemetadata.md)<!-- -->\[\] \| undefined
54
+
55
+ Array of texture metadata, or undefined if not found.
56
+
@@ -0,0 +1,56 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [BlockTextureRegistry](./server.blocktextureregistry.md) &gt; [hasBlockTexture](./server.blocktextureregistry.hasblocktexture.md)
4
+
5
+ ## BlockTextureRegistry.hasBlockTexture() method
6
+
7
+ Checks if a block texture is registered in the atlas.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ hasBlockTexture(textureUri: string): boolean;
13
+ ```
14
+
15
+ ## Parameters
16
+
17
+ <table><thead><tr><th>
18
+
19
+ Parameter
20
+
21
+
22
+ </th><th>
23
+
24
+ Type
25
+
26
+
27
+ </th><th>
28
+
29
+ Description
30
+
31
+
32
+ </th></tr></thead>
33
+ <tbody><tr><td>
34
+
35
+ textureUri
36
+
37
+
38
+ </td><td>
39
+
40
+ string
41
+
42
+
43
+ </td><td>
44
+
45
+ The URI of the texture (e.g., 'blocks/stone.png' or 'blocks/grass' for cubemaps).
46
+
47
+
48
+ </td></tr>
49
+ </tbody></table>
50
+
51
+ **Returns:**
52
+
53
+ boolean
54
+
55
+ Whether the texture is registered.
56
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [BlockTextureRegistry](./server.blocktextureregistry.md) &gt; [instance](./server.blocktextureregistry.instance.md)
4
+
5
+ ## BlockTextureRegistry.instance property
6
+
7
+ The global BlockTextureRegistry instance as a singleton.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ static readonly instance: BlockTextureRegistry;
13
+ ```
@@ -0,0 +1,145 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [BlockTextureRegistry](./server.blocktextureregistry.md)
4
+
5
+ ## BlockTextureRegistry class
6
+
7
+ Manages block textures and block texture atlas generation of the game.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ export default class BlockTextureRegistry
13
+ ```
14
+
15
+ ## Remarks
16
+
17
+ The BlockTextureRegistry is created internally as a global singletone accessible with the static property `BlockTextureRegistry.instance`<!-- -->.
18
+
19
+ The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BlockTextureRegistry` class.
20
+
21
+ ## Example
22
+
23
+
24
+ ```typescript
25
+ import { BlockTextureRegistry } from 'hytopia';
26
+
27
+ const blockTextureRegistry = BlockTextureRegistry.instance;
28
+ const metadata = blockTextureRegistry.getBlockTextureMetadata('blocks/stone.png');
29
+ ```
30
+
31
+ ## Properties
32
+
33
+ <table><thead><tr><th>
34
+
35
+ Property
36
+
37
+
38
+ </th><th>
39
+
40
+ Modifiers
41
+
42
+
43
+ </th><th>
44
+
45
+ Type
46
+
47
+
48
+ </th><th>
49
+
50
+ Description
51
+
52
+
53
+ </th></tr></thead>
54
+ <tbody><tr><td>
55
+
56
+ [generateEveryStart](./server.blocktextureregistry.generateeverystart.md)
57
+
58
+
59
+ </td><td>
60
+
61
+
62
+ </td><td>
63
+
64
+ boolean
65
+
66
+
67
+ </td><td>
68
+
69
+ Whether to always generate the atlas on server start.
70
+
71
+
72
+ </td></tr>
73
+ <tr><td>
74
+
75
+ [instance](./server.blocktextureregistry.instance.md)
76
+
77
+
78
+ </td><td>
79
+
80
+ `static`
81
+
82
+ `readonly`
83
+
84
+
85
+ </td><td>
86
+
87
+ [BlockTextureRegistry](./server.blocktextureregistry.md)
88
+
89
+
90
+ </td><td>
91
+
92
+ The global BlockTextureRegistry instance as a singleton.
93
+
94
+
95
+ </td></tr>
96
+ </tbody></table>
97
+
98
+ ## Methods
99
+
100
+ <table><thead><tr><th>
101
+
102
+ Method
103
+
104
+
105
+ </th><th>
106
+
107
+ Modifiers
108
+
109
+
110
+ </th><th>
111
+
112
+ Description
113
+
114
+
115
+ </th></tr></thead>
116
+ <tbody><tr><td>
117
+
118
+ [getBlockTextureMetadata(textureUri)](./server.blocktextureregistry.getblocktexturemetadata.md)
119
+
120
+
121
+ </td><td>
122
+
123
+
124
+ </td><td>
125
+
126
+ Retrieves metadata for a block texture. Returns array for cubemaps (6 faces) or standard textures (1 face).
127
+
128
+
129
+ </td></tr>
130
+ <tr><td>
131
+
132
+ [hasBlockTexture(textureUri)](./server.blocktextureregistry.hasblocktexture.md)
133
+
134
+
135
+ </td><td>
136
+
137
+
138
+ </td><td>
139
+
140
+ Checks if a block texture is registered in the atlas.
141
+
142
+
143
+ </td></tr>
144
+ </tbody></table>
145
+
@@ -0,0 +1,13 @@
1
+ <!-- Do not edit this file. It is automatically generated by API Documenter. -->
2
+
3
+ [Home](./index.md) &gt; [server](./server.md) &gt; [GameServer](./server.gameserver.md) &gt; [blockTextureRegistry](./server.gameserver.blocktextureregistry.md)
4
+
5
+ ## GameServer.blockTextureRegistry property
6
+
7
+ The block texture registry for the game server.
8
+
9
+ **Signature:**
10
+
11
+ ```typescript
12
+ get blockTextureRegistry(): BlockTextureRegistry;
13
+ ```
@@ -43,6 +43,27 @@ Description
43
43
  </th></tr></thead>
44
44
  <tbody><tr><td>
45
45
 
46
+ [blockTextureRegistry](./server.gameserver.blocktextureregistry.md)
47
+
48
+
49
+ </td><td>
50
+
51
+ `readonly`
52
+
53
+
54
+ </td><td>
55
+
56
+ [BlockTextureRegistry](./server.blocktextureregistry.md)
57
+
58
+
59
+ </td><td>
60
+
61
+ The block texture registry for the game server.
62
+
63
+
64
+ </td></tr>
65
+ <tr><td>
66
+
46
67
  [instance](./server.gameserver.instance.md)
47
68
 
48
69
 
package/docs/server.md CHANGED
@@ -49,6 +49,17 @@ Manages audio instances in a world.
49
49
  Represents a block in a world.
50
50
 
51
51
 
52
+ </td></tr>
53
+ <tr><td>
54
+
55
+ [BlockTextureRegistry](./server.blocktextureregistry.md)
56
+
57
+
58
+ </td><td>
59
+
60
+ Manages block textures and block texture atlas generation of the game.
61
+
62
+
52
63
  </td></tr>
53
64
  <tr><td>
54
65
 
@@ -1539,6 +1550,17 @@ Description
1539
1550
  </th></tr></thead>
1540
1551
  <tbody><tr><td>
1541
1552
 
1553
+ [BlockTextureMetadata](./server.blocktexturemetadata.md)
1554
+
1555
+
1556
+ </td><td>
1557
+
1558
+ Block texture metadata including UVs and rendering hints.
1559
+
1560
+
1561
+ </td></tr>
1562
+ <tr><td>
1563
+
1542
1564
  [ColliderOptions](./server.collideroptions.md)
1543
1565
 
1544
1566
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hytopia",
3
- "version": "0.11.1",
3
+ "version": "0.11.3",
4
4
  "description": "The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.",
5
5
  "type": "module",
6
6
  "main": "./server.mjs",
package/server.api.json CHANGED
@@ -4869,6 +4869,213 @@
4869
4869
  }
4870
4870
  ]
4871
4871
  },
4872
+ {
4873
+ "kind": "TypeAlias",
4874
+ "canonicalReference": "server!BlockTextureMetadata:type",
4875
+ "docComment": "/**\n * Block texture metadata including UVs and rendering hints.\n *\n * @public\n */\n",
4876
+ "excerptTokens": [
4877
+ {
4878
+ "kind": "Content",
4879
+ "text": "export type BlockTextureMetadata = "
4880
+ },
4881
+ {
4882
+ "kind": "Content",
4883
+ "text": "{\n u0: number;\n v0: number;\n u1: number;\n v1: number;\n averageRGB: [number, number, number];\n isTransparent: boolean;\n needsAlphaTest: boolean;\n}"
4884
+ },
4885
+ {
4886
+ "kind": "Content",
4887
+ "text": ";"
4888
+ }
4889
+ ],
4890
+ "fileUrlPath": "src/textures/BlockTextureRegistry.ts",
4891
+ "releaseTag": "Public",
4892
+ "name": "BlockTextureMetadata",
4893
+ "typeTokenRange": {
4894
+ "startIndex": 1,
4895
+ "endIndex": 2
4896
+ }
4897
+ },
4898
+ {
4899
+ "kind": "Class",
4900
+ "canonicalReference": "server!BlockTextureRegistry:class",
4901
+ "docComment": "/**\n * Manages block textures and block texture atlas generation of the game.\n *\n * @remarks\n *\n * The BlockTextureRegistry is created internally as a global singletone accessible with the static property `BlockTextureRegistry.instance`.\n *\n * The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `BlockTextureRegistry` class.\n *\n * @example\n * ```typescript\n * import { BlockTextureRegistry } from 'hytopia';\n *\n * const blockTextureRegistry = BlockTextureRegistry.instance;\n * const metadata = blockTextureRegistry.getBlockTextureMetadata('blocks/stone.png');\n * ```\n *\n * @public\n */\n",
4902
+ "excerptTokens": [
4903
+ {
4904
+ "kind": "Content",
4905
+ "text": "export default class BlockTextureRegistry "
4906
+ }
4907
+ ],
4908
+ "fileUrlPath": "src/textures/BlockTextureRegistry.ts",
4909
+ "releaseTag": "Public",
4910
+ "isAbstract": false,
4911
+ "name": "BlockTextureRegistry",
4912
+ "preserveMemberOrder": false,
4913
+ "members": [
4914
+ {
4915
+ "kind": "Property",
4916
+ "canonicalReference": "server!BlockTextureRegistry#generateEveryStart:member",
4917
+ "docComment": "/**\n * Whether to always generate the atlas on server start.\n */\n",
4918
+ "excerptTokens": [
4919
+ {
4920
+ "kind": "Content",
4921
+ "text": "generateEveryStart: "
4922
+ },
4923
+ {
4924
+ "kind": "Content",
4925
+ "text": "boolean"
4926
+ },
4927
+ {
4928
+ "kind": "Content",
4929
+ "text": ";"
4930
+ }
4931
+ ],
4932
+ "isReadonly": false,
4933
+ "isOptional": false,
4934
+ "releaseTag": "Public",
4935
+ "name": "generateEveryStart",
4936
+ "propertyTypeTokenRange": {
4937
+ "startIndex": 1,
4938
+ "endIndex": 2
4939
+ },
4940
+ "isStatic": false,
4941
+ "isProtected": false,
4942
+ "isAbstract": false
4943
+ },
4944
+ {
4945
+ "kind": "Method",
4946
+ "canonicalReference": "server!BlockTextureRegistry#getBlockTextureMetadata:member(1)",
4947
+ "docComment": "/**\n * Retrieves metadata for a block texture. Returns array for cubemaps (6 faces) or standard textures (1 face).\n *\n * @param textureUri - The URI of the texture (e.g., 'blocks/stone.png' or 'blocks/grass').\n *\n * @returns Array of texture metadata, or undefined if not found.\n */\n",
4948
+ "excerptTokens": [
4949
+ {
4950
+ "kind": "Content",
4951
+ "text": "getBlockTextureMetadata(textureUri: "
4952
+ },
4953
+ {
4954
+ "kind": "Content",
4955
+ "text": "string"
4956
+ },
4957
+ {
4958
+ "kind": "Content",
4959
+ "text": "): "
4960
+ },
4961
+ {
4962
+ "kind": "Reference",
4963
+ "text": "BlockTextureMetadata",
4964
+ "canonicalReference": "server!BlockTextureMetadata:type"
4965
+ },
4966
+ {
4967
+ "kind": "Content",
4968
+ "text": "[] | undefined"
4969
+ },
4970
+ {
4971
+ "kind": "Content",
4972
+ "text": ";"
4973
+ }
4974
+ ],
4975
+ "isStatic": false,
4976
+ "returnTypeTokenRange": {
4977
+ "startIndex": 3,
4978
+ "endIndex": 5
4979
+ },
4980
+ "releaseTag": "Public",
4981
+ "isProtected": false,
4982
+ "overloadIndex": 1,
4983
+ "parameters": [
4984
+ {
4985
+ "parameterName": "textureUri",
4986
+ "parameterTypeTokenRange": {
4987
+ "startIndex": 1,
4988
+ "endIndex": 2
4989
+ },
4990
+ "isOptional": false
4991
+ }
4992
+ ],
4993
+ "isOptional": false,
4994
+ "isAbstract": false,
4995
+ "name": "getBlockTextureMetadata"
4996
+ },
4997
+ {
4998
+ "kind": "Method",
4999
+ "canonicalReference": "server!BlockTextureRegistry#hasBlockTexture:member(1)",
5000
+ "docComment": "/**\n * Checks if a block texture is registered in the atlas.\n *\n * @param textureUri - The URI of the texture (e.g., 'blocks/stone.png' or 'blocks/grass' for cubemaps).\n *\n * @returns Whether the texture is registered.\n */\n",
5001
+ "excerptTokens": [
5002
+ {
5003
+ "kind": "Content",
5004
+ "text": "hasBlockTexture(textureUri: "
5005
+ },
5006
+ {
5007
+ "kind": "Content",
5008
+ "text": "string"
5009
+ },
5010
+ {
5011
+ "kind": "Content",
5012
+ "text": "): "
5013
+ },
5014
+ {
5015
+ "kind": "Content",
5016
+ "text": "boolean"
5017
+ },
5018
+ {
5019
+ "kind": "Content",
5020
+ "text": ";"
5021
+ }
5022
+ ],
5023
+ "isStatic": false,
5024
+ "returnTypeTokenRange": {
5025
+ "startIndex": 3,
5026
+ "endIndex": 4
5027
+ },
5028
+ "releaseTag": "Public",
5029
+ "isProtected": false,
5030
+ "overloadIndex": 1,
5031
+ "parameters": [
5032
+ {
5033
+ "parameterName": "textureUri",
5034
+ "parameterTypeTokenRange": {
5035
+ "startIndex": 1,
5036
+ "endIndex": 2
5037
+ },
5038
+ "isOptional": false
5039
+ }
5040
+ ],
5041
+ "isOptional": false,
5042
+ "isAbstract": false,
5043
+ "name": "hasBlockTexture"
5044
+ },
5045
+ {
5046
+ "kind": "Property",
5047
+ "canonicalReference": "server!BlockTextureRegistry.instance:member",
5048
+ "docComment": "/**\n * The global BlockTextureRegistry instance as a singleton.\n */\n",
5049
+ "excerptTokens": [
5050
+ {
5051
+ "kind": "Content",
5052
+ "text": "static readonly instance: "
5053
+ },
5054
+ {
5055
+ "kind": "Reference",
5056
+ "text": "BlockTextureRegistry",
5057
+ "canonicalReference": "server!BlockTextureRegistry:class"
5058
+ },
5059
+ {
5060
+ "kind": "Content",
5061
+ "text": ";"
5062
+ }
5063
+ ],
5064
+ "isReadonly": true,
5065
+ "isOptional": false,
5066
+ "releaseTag": "Public",
5067
+ "name": "instance",
5068
+ "propertyTypeTokenRange": {
5069
+ "startIndex": 1,
5070
+ "endIndex": 2
5071
+ },
5072
+ "isStatic": true,
5073
+ "isProtected": false,
5074
+ "isAbstract": false
5075
+ }
5076
+ ],
5077
+ "implementsTokenRanges": []
5078
+ },
4872
5079
  {
4873
5080
  "kind": "Class",
4874
5081
  "canonicalReference": "server!BlockType:class",
@@ -19709,6 +19916,37 @@
19709
19916
  "name": "GameServer",
19710
19917
  "preserveMemberOrder": false,
19711
19918
  "members": [
19919
+ {
19920
+ "kind": "Property",
19921
+ "canonicalReference": "server!GameServer#blockTextureRegistry:member",
19922
+ "docComment": "/**\n * The block texture registry for the game server.\n */\n",
19923
+ "excerptTokens": [
19924
+ {
19925
+ "kind": "Content",
19926
+ "text": "get blockTextureRegistry(): "
19927
+ },
19928
+ {
19929
+ "kind": "Reference",
19930
+ "text": "BlockTextureRegistry",
19931
+ "canonicalReference": "server!BlockTextureRegistry:class"
19932
+ },
19933
+ {
19934
+ "kind": "Content",
19935
+ "text": ";"
19936
+ }
19937
+ ],
19938
+ "isReadonly": true,
19939
+ "isOptional": false,
19940
+ "releaseTag": "Public",
19941
+ "name": "blockTextureRegistry",
19942
+ "propertyTypeTokenRange": {
19943
+ "startIndex": 1,
19944
+ "endIndex": 2
19945
+ },
19946
+ "isStatic": false,
19947
+ "isProtected": false,
19948
+ "isAbstract": false
19949
+ },
19712
19950
  {
19713
19951
  "kind": "Property",
19714
19952
  "canonicalReference": "server!GameServer.instance:member",