hytopia 0.11.1 → 0.11.2
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/boilerplate/index.ts +1 -1
- package/docs/server.blocktexturemetadata.md +21 -0
- package/docs/server.blocktextureregistry.generateeverystart.md +13 -0
- package/docs/server.blocktextureregistry.getblocktexturemetadata.md +56 -0
- package/docs/server.blocktextureregistry.hasblocktexture.md +56 -0
- package/docs/server.blocktextureregistry.instance.md +13 -0
- package/docs/server.blocktextureregistry.md +145 -0
- package/docs/server.gameserver.blocktextureregistry.md +13 -0
- package/docs/server.gameserver.md +21 -0
- package/docs/server.md +22 -0
- package/package.json +1 -1
- package/server.api.json +238 -0
- package/server.d.ts +63 -0
- package/server.mjs +162 -162
package/server.d.ts
CHANGED
|
@@ -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
|
/**
|
|
@@ -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. */
|