hytopia 0.11.1 → 0.12.0-prerelease-1

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.
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",
@@ -17685,15 +17892,6 @@
17685
17892
  "kind": "Content",
17686
17893
  "text": ", "
17687
17894
  },
17688
- {
17689
- "kind": "Reference",
17690
- "text": "SocketEventPayloads",
17691
- "canonicalReference": "server!~SocketEventPayloads:interface"
17692
- },
17693
- {
17694
- "kind": "Content",
17695
- "text": ", "
17696
- },
17697
17895
  {
17698
17896
  "kind": "Reference",
17699
17897
  "text": "LightEventPayloads",
@@ -17829,10 +18027,6 @@
17829
18027
  {
17830
18028
  "startIndex": 41,
17831
18029
  "endIndex": 42
17832
- },
17833
- {
17834
- "startIndex": 43,
17835
- "endIndex": 44
17836
18030
  }
17837
18031
  ]
17838
18032
  },
@@ -19709,6 +19903,37 @@
19709
19903
  "name": "GameServer",
19710
19904
  "preserveMemberOrder": false,
19711
19905
  "members": [
19906
+ {
19907
+ "kind": "Property",
19908
+ "canonicalReference": "server!GameServer#blockTextureRegistry:member",
19909
+ "docComment": "/**\n * The block texture registry for the game server.\n */\n",
19910
+ "excerptTokens": [
19911
+ {
19912
+ "kind": "Content",
19913
+ "text": "get blockTextureRegistry(): "
19914
+ },
19915
+ {
19916
+ "kind": "Reference",
19917
+ "text": "BlockTextureRegistry",
19918
+ "canonicalReference": "server!BlockTextureRegistry:class"
19919
+ },
19920
+ {
19921
+ "kind": "Content",
19922
+ "text": ";"
19923
+ }
19924
+ ],
19925
+ "isReadonly": true,
19926
+ "isOptional": false,
19927
+ "releaseTag": "Public",
19928
+ "name": "blockTextureRegistry",
19929
+ "propertyTypeTokenRange": {
19930
+ "startIndex": 1,
19931
+ "endIndex": 2
19932
+ },
19933
+ "isStatic": false,
19934
+ "isProtected": false,
19935
+ "isAbstract": false
19936
+ },
19712
19937
  {
19713
19938
  "kind": "Property",
19714
19939
  "canonicalReference": "server!GameServer.instance:member",
@@ -40443,29 +40668,6 @@
40443
40668
  ],
40444
40669
  "extendsTokenRanges": []
40445
40670
  },
40446
- {
40447
- "kind": "Variable",
40448
- "canonicalReference": "server!PORT:var",
40449
- "docComment": "/**\n * The port the server will run on. You can override this in your .env by setting PORT. When deployed in production to HYTOPIA servers, any .env value will be ignored and 8080 will be used.\n *\n * @public\n */\n",
40450
- "excerptTokens": [
40451
- {
40452
- "kind": "Content",
40453
- "text": "PORT: "
40454
- },
40455
- {
40456
- "kind": "Content",
40457
- "text": "string | 8080"
40458
- }
40459
- ],
40460
- "fileUrlPath": "src/networking/WebServer.ts",
40461
- "isReadonly": true,
40462
- "releaseTag": "Public",
40463
- "name": "PORT",
40464
- "variableTypeTokenRange": {
40465
- "startIndex": 1,
40466
- "endIndex": 2
40467
- }
40468
- },
40469
40671
  {
40470
40672
  "kind": "Class",
40471
40673
  "canonicalReference": "server!Quaternion:class",
package/server.d.ts CHANGED
@@ -2,7 +2,6 @@ import type { AnyPacket } from '@hytopia.com/server-protocol';
2
2
  import type { ErrorEvent as ErrorEvent_2 } from 'ws';
3
3
  import EventEmitter from 'eventemitter3';
4
4
  import http from 'http';
5
- import type { IncomingMessage } from 'http';
6
5
  import type { InputSchema } from '@hytopia.com/server-protocol';
7
6
  import type { LobbyMembershipDto } from '@hytopia.com/creative-lib/dist/impl/getSession';
8
7
  import protocol from '@hytopia.com/server-protocol';
@@ -11,6 +10,7 @@ import { SdpMatrix3 } from '@dimforge/rapier3d-simd-compat';
11
10
  import * as Sentry from '@sentry/node';
12
11
  import type { Socket } from 'net';
13
12
  import { WebSocket as WebSocket_2 } from 'ws';
13
+ import type { WebTransportSessionImpl } from '@fails-components/webtransport/dist/lib/types';
14
14
 
15
15
  /**
16
16
  * Represents a audio playback in a world.
@@ -563,6 +563,66 @@ export declare interface BlockEntityOptions extends BaseEntityOptions {
563
563
  blockHalfExtents?: Vector3Like;
564
564
  /** The texture uri of a entity if the entity is a block entity, if set rigidBodyOptions collider shape [0] must be a block */
565
565
  blockTextureUri?: string;
566
+ }
567
+
568
+ /** Block texture metadata including UVs and rendering hints. @public */
569
+ export declare type BlockTextureMetadata = {
570
+ u0: number;
571
+ v0: number;
572
+ u1: number;
573
+ v1: number;
574
+ averageRGB: [number, number, number];
575
+ isTransparent: boolean;
576
+ needsAlphaTest: boolean;
577
+ };
578
+
579
+ /**
580
+ * Manages block textures and block texture atlas generation of the game.
581
+ *
582
+ * @remarks
583
+ * The BlockTextureRegistry is created internally as a global
584
+ * singletone accessible with the static property
585
+ * `BlockTextureRegistry.instance`.
586
+ *
587
+ * @example
588
+ * ```typescript
589
+ * import { BlockTextureRegistry } from 'hytopia';
590
+ *
591
+ * const blockTextureRegistry = BlockTextureRegistry.instance;
592
+ * const metadata = blockTextureRegistry.getBlockTextureMetadata('blocks/stone.png');
593
+ * ```
594
+ *
595
+ * @public
596
+ */
597
+ export declare class BlockTextureRegistry {
598
+ /** The global BlockTextureRegistry instance as a singleton. */
599
+ static readonly instance: BlockTextureRegistry;
600
+ /** Whether to always generate the atlas on server start. */
601
+ generateEveryStart: boolean;
602
+
603
+
604
+ /**
605
+ * Checks if a block texture is registered in the atlas.
606
+ *
607
+ * @param textureUri - The URI of the texture (e.g., 'blocks/stone.png' or 'blocks/grass' for cubemaps).
608
+ * @returns Whether the texture is registered.
609
+ */
610
+ hasBlockTexture(textureUri: string): boolean;
611
+ /**
612
+ * Retrieves metadata for a block texture. Returns array for cubemaps (6 faces) or standard textures (1 face).
613
+ *
614
+ * @param textureUri - The URI of the texture (e.g., 'blocks/stone.png' or 'blocks/grass').
615
+ * @returns Array of texture metadata, or undefined if not found.
616
+ */
617
+ getBlockTextureMetadata(textureUri: string): BlockTextureMetadata[] | undefined;
618
+
619
+
620
+
621
+
622
+
623
+
624
+
625
+
566
626
  }
567
627
 
568
628
  /**
@@ -2221,7 +2281,7 @@ export declare class ErrorHandler {
2221
2281
  *
2222
2282
  * @public
2223
2283
  */
2224
- export declare interface EventPayloads extends AudioEventPayloads, BaseEntityControllerEventPayloads, BlockTypeEventPayloads, BlockTypeRegistryEventPayloads, ChatEventPayloads, ChunkLatticeEventPayloads, ConnectionEventPayloads, EntityEventPayloads, GameServerEventPayloads, ParticleEmitterEventPayloads, PlayerCameraEventPayloads, PlayerEventPayloads, PlayerManagerEventPayloads, PlayerUIEventPayloads, SceneUIEventPayloads, SimulationEventPayloads, SocketEventPayloads, LightEventPayloads, WebServerEventPayloads, WorldEventPayloads, WorldLoopEventPayloads, WorldManagerEventPayloads {
2284
+ export declare interface EventPayloads extends AudioEventPayloads, BaseEntityControllerEventPayloads, BlockTypeEventPayloads, BlockTypeRegistryEventPayloads, ChatEventPayloads, ChunkLatticeEventPayloads, ConnectionEventPayloads, EntityEventPayloads, GameServerEventPayloads, ParticleEmitterEventPayloads, PlayerCameraEventPayloads, PlayerEventPayloads, PlayerManagerEventPayloads, PlayerUIEventPayloads, SceneUIEventPayloads, SimulationEventPayloads, LightEventPayloads, WebServerEventPayloads, WorldEventPayloads, WorldLoopEventPayloads, WorldManagerEventPayloads {
2225
2285
  }
2226
2286
 
2227
2287
  /**
@@ -2390,8 +2450,11 @@ export declare class GameServer {
2390
2450
 
2391
2451
 
2392
2452
 
2453
+
2393
2454
  /** The singleton instance of the game server. */
2394
2455
  static get instance(): GameServer;
2456
+ /** The block texture registry for the game server. */
2457
+ get blockTextureRegistry(): BlockTextureRegistry;
2395
2458
  /** The model manager for the game server. */
2396
2459
  get modelRegistry(): ModelRegistry;
2397
2460
  /** The player manager for the game server. */
@@ -5037,16 +5100,6 @@ export declare interface PlayerUIEventPayloads {
5037
5100
  };
5038
5101
  }
5039
5102
 
5040
- /**
5041
- * The port the server will run on. You can override
5042
- * this in your .env by setting PORT. When deployed in
5043
- * production to HYTOPIA servers, any .env value will
5044
- * be ignored and 8080 will be used.
5045
- *
5046
- * @public
5047
- */
5048
- export declare const PORT: string | 8080;
5049
-
5050
5103
  /**
5051
5104
  * Represents a quaternion.
5052
5105
  *