UNPKG

hytopia

Version:

The HYTOPIA SDK makes it easy for developers to create massively multiplayer games using JavaScript or TypeScript.

131 lines (60 loc) 2 kB
<!-- Do not edit this file. It is automatically generated by API Documenter. --> [Home](./index.md) &gt; [server](./server.md) &gt; [Block](./server.block.md) ## Block class Represents a block in a world. When to use: reading block data from queries like raycasts or chunk lookups. Do NOT use for: creating or placing blocks directly; use `ChunkLattice.setBlock`<!-- -->. **Signature:** ```typescript export default class Block ``` ## Remarks Instances are created internally and surfaced by API methods. Block coordinates are \*\*world coordinates\*\* (global block grid), not local chunk coordinates. \*\*Category:\*\* Blocks The constructor for this class is marked as internal. Third-party code should not call the constructor directly or create subclasses that extend the `Block` class. ## Properties <table><thead><tr><th> Property </th><th> Modifiers </th><th> Type </th><th> Description </th></tr></thead> <tbody><tr><td> [blockType](./server.block.blocktype.md) </td><td> `readonly` </td><td> [BlockType](./server.blocktype.md) </td><td> The block type of the block. \*\*Category:\*\* Blocks </td></tr> <tr><td> [globalCoordinate](./server.block.globalcoordinate.md) </td><td> `readonly` </td><td> [Vector3Like](./server.vector3like.md) </td><td> The global coordinate of the block. \*\*Category:\*\* Blocks </td></tr> </tbody></table> ## Methods <table><thead><tr><th> Method </th><th> Modifiers </th><th> Description </th></tr></thead> <tbody><tr><td> [getNeighborGlobalCoordinateFromHitPoint(hitPoint)](./server.block.getneighborglobalcoordinatefromhitpoint.md) </td><td> </td><td> Gets the most adjacent neighbor global coordinate of this block based on a relative hit point, typically from a raycast. Use for: placing a new block on the face that was hit. </td></tr> </tbody></table>