API reference / @jsprismarine/prismarine / world/portal/rules
world/portal/rules
Interfaces
DimensionTravelRule
Defined in: packages/prismarine/src/world/portal/rules.ts:37
What one dimension type allows a traveler to do.
Properties
allowsNetherPortal
readonlyallowsNetherPortal:boolean
Defined in: packages/prismarine/src/world/portal/rules.ts:47
Whether a nether portal can exist here: Java's BaseFireBlock.inPortalDimension, which is true for the Overworld and the Nether only. Nothing creates a portal where this is false.
Java See
BaseFireBlock.inPortalDimension
portalSearchRadius
readonlyportalSearchRadius:number
Defined in: packages/prismarine/src/world/portal/rules.ts:39
Radius of the search for an existing portal around the scaled target, in blocks.
PortalRule
Defined in: packages/prismarine/src/world/portal/rules.ts:84
What a portal block does to whoever stands in it.
Properties
delayTicks
readonlydelayTicks:object
Defined in: packages/prismarine/src/world/portal/rules.ts:103
Ticks a player stands in the portal before the trip, by game mode. Java's players_nether_portal_default_delay (80) and players_nether_portal_creative_delay (0) game rules; EndPortalBlock keeps Portal.getPortalTransitionTime's default of 0. Everything that is not a player goes through on the first tick either way.
creative
readonlycreative:number
survival
readonlysurvival:number
frame
readonlyframe: readonlystring[]
Defined in: packages/prismarine/src/world/portal/rules.ts:92
The blocks the portal's frame is made of.
kind
readonlykind:"end"|"nether"|"gateway"
Defined in: packages/prismarine/src/world/portal/rules.ts:90
A nether portal links two dimensions by scaled position and an end portal has fixed ends. An end gateway moves its traveler within its own dimension, to the exit its block entity records, so it links nothing.
links
readonlylinks:Readonly<Record<string,string>>
Defined in: packages/prismarine/src/world/portal/rules.ts:96
The Java dimension type id a trip from each dimension type arrives in.
portal
readonlyportal: readonlystring[]
Defined in: packages/prismarine/src/world/portal/rules.ts:94
Every block identifier that reads as this portal.
Variables
DIMENSION_TRAVEL
constDIMENSION_TRAVEL:Readonly<Record<string,DimensionTravelRule>>
Defined in: packages/prismarine/src/world/portal/rules.ts:57
The travel rule of each vanilla dimension type, keyed by Java dimension_type id.
The coordinate scale is not here: it is DimensionType.java.coordinateScale, read from the dimension's own document. Nor is which block holds a spawn: RespawnPoint.ts reads Java's bed_works and respawn_anchor_works attributes off the same document.
END_GATEWAY
constEND_GATEWAY:string
Defined in: packages/prismarine/src/world/portal/rules.ts:81
The end gateway block Bedrock writes, which is the first name in the shared list.
END_GATEWAY_BLOCKS
constEND_GATEWAY_BLOCKS: readonlystring[]
Defined in: packages/prismarine/src/world/portal/rules.ts:78
Every identifier that reads as an end gateway block.
PORTALS
constPORTALS:Readonly<Record<string,PortalRule>>
Defined in: packages/prismarine/src/world/portal/rules.ts:116
The rule of each portal block, keyed by the Bedrock identifier of its first spelling.
The links are Java's NetherPortalBlock.getPortalDestination (Overworld and Nether swap) and EndPortalBlock.getPortalDestination (into the End from anywhere else, out of it to the Overworld). A nether portal in the End cannot be lit, but one a command placed leads to the Overworld, which is the Bedrock behavior and the only sensible one.
Java Source
NetherPortalBlock.getPortalDestination
PORTAL_SEARCH_RADIUS
constPORTAL_SEARCH_RADIUS:128=128
Defined in: packages/prismarine/src/world/portal/rules.ts:34
How far from the scaled target an existing portal is looked for, in blocks.
Java's PortalForcer.findClosestPortalPosition uses sipush 128 in the Nether and bipush 16 in the Overworld. Bedrock searches a 128 block radius in both (wiki, "the point of interest can be within a 256x256 square block area (128-block radius) in both the Overworld and Nether"), and that is the number this server uses.
Java Source
PortalForcer.findClosestPortalPosition
Functions
isPortalBlock()
isPortalBlock(
block):boolean
Defined in: packages/prismarine/src/world/portal/rules.ts:159
Whether a block identifier is one of the portal blocks in PORTALS.
Parameters
block
string
Returns
boolean
portalRuleOf()
portalRuleOf(
block):PortalRule|undefined
Defined in: packages/prismarine/src/world/portal/rules.ts:152
The rule of a portal block by any of its identifiers, or undefined for a block that is no portal.
Parameters
block
string
Returns
PortalRule | undefined
travelRuleOf()
travelRuleOf(
dimension):DimensionTravelRule|undefined
Defined in: packages/prismarine/src/world/portal/rules.ts:74
The travel rule of a dimension, or undefined for a type the table does not know.
Parameters
dimension
Returns
DimensionTravelRule | undefined