PrivateconstructorStaticgetRetrieves a dimension type using a string-based identifier. Works with both vanilla dimensions and custom dimensions. Custom dimensions cannot be retrieved until after the system startup event has completed.
early-execution-allowed - This function can be called in early-execution mode.
import { DimensionTypes, Player, system } from "@minecraft/server";
// Run `/scriptevent example:getoverworldtype` in chat to inspect the overworld dimension type.
system.afterEvents.scriptEventReceive.subscribe(({ id, sourceEntity }) => {
if (id !== "example:getoverworldtype" || !(sourceEntity instanceof Player)) return;
const dimensionType = DimensionTypes.get("minecraft:overworld");
if (!dimensionType) return;
sourceEntity.sendMessage(`Found dimension type: ${dimensionType.typeId}`);
});
StaticgetRetrieves an array of all dimension types. Includes both vanilla dimensions and custom dimensions. Custom dimensions are not included until after the system startup event has completed.
early-execution-allowed - This function can be called in early-execution mode.
Used for accessing all available dimension types. Currently only works with Vanilla dimensions.
Source