API reference / @jsprismarine/prismarine / BlockStateSchemas
Class: BlockStateSchemas
Defined in: prismarine/src/block/state/BlockStateSchema.ts:177
Every block schema this process knows: the shipped catalog, plus whatever was registered over it.
Reading a block is not per-server state and is deliberately not owned by one. A runtime id is the FNV-1a hash of a block's own name and state, so the id a chunk holds names one state and one state only, whichever server wrote it. A second server in the process can add names, and that cannot change what the first one's blocks mean.
BlockStateSchemas.register replacing a shipped name is the exception, and the only reason BlockStateSchemas.reset still exists. Packs are where overriding a vanilla block belongs, and the override path goes when this catalog loses its static caches; see section 10 of the plan.
Constructors
Constructor
new BlockStateSchemas():
BlockStateSchemas
Returns
BlockStateSchemas
Methods
get()
staticget(name):BlockStateSchema|null
Defined in: prismarine/src/block/state/BlockStateSchema.ts:193
Parameters
name
string
Returns
BlockStateSchema | null
getCustomSchemas()
staticgetCustomSchemas():BlockStateSchema[]
Defined in: prismarine/src/block/state/BlockStateSchema.ts:208
Blocks outside the minecraft: namespace, which have to be declared to the client.
Returns
getRevision()
staticgetRevision():number
Defined in: prismarine/src/block/state/BlockStateSchema.ts:189
The number to key a derived index on, so it rebuilds when the catalog changes.
Returns
number
names()
staticnames():string[]
Defined in: prismarine/src/block/state/BlockStateSchema.ts:219
Every block name this process knows.
The dedupe is skipped when nothing has registered, which is every server that has no plugin blocks: building a 1477-entry Set costs four times what listing the keys does, and this list is read directly when the schema catalog is needed.
Returns
string[]
register()
staticregister(schema):void
Defined in: prismarine/src/block/state/BlockStateSchema.ts:202
Registers or replaces a schema, which is how a plugin contributes a block. Overriding a vanilla name is allowed on purpose: it is the intended way to change what a vanilla block accepts.
Parameters
schema
Returns
void
reset()
staticreset():void
Defined in: prismarine/src/block/state/BlockStateSchema.ts:226
Drops every registration, leaving the shipped catalog. Used by tests.
Returns
void