Represents a min/max structure for expressing a potential
range of numbers.
Example: dimensionHeightRange.js
import { Player, system, world } from"@minecraft/server";
// Get all dimensions constoverworld = world.getDimension("overworld"); constnether = world.getDimension("nether"); constend = world.getDimension("the end");
// If user sends a scriptevent command with id test:height_range, it prints the height of each dimension in a world. system.afterEvents.scriptEventReceive.subscribe((event) => { if (event.id === "test:height_range") { // Gets the height range of every dimension constoverworldHeight = overworld.heightRange; constnetherHeight = nether.heightRange; constendHeight = end.heightRange;
// Sends the message to player who sent the command if (event.sourceEntityinstanceofPlayer) { event.sourceEntity.sendMessage( `Overworld height: ${overworldHeight.min} to ${ overworldHeight.max } (Height: ${overworldHeight.max-overworldHeight.min} blocks)` ); event.sourceEntity.sendMessage( `Nether height: ${netherHeight.min} to ${ netherHeight.max } (Height: ${netherHeight.max-netherHeight.min} blocks)` ); event.sourceEntity.sendMessage( `End height: ${endHeight.min} to ${endHeight.max} (Height: ${ endHeight.max-endHeight.min } blocks)` ); } } });
Represents a min/max structure for expressing a potential range of numbers.
Example: dimensionHeightRange.js