API

Dimensions

Worlds of your own, with their own sky, terrain and biomes. Players and creatures travel there by teleporting.

Declaring a dimension

It takes a kind and a terrain:

content/dimensions.craftCraftScript
dimension "ruby_realm" { kind: "overworld", terrain: "normal", biome: "ruby_meadow" }
dimension "flatland" { terrain: "flat" }
Property Values
kind its sky, light and rules: overworld, nether or end
terrain its shape, see below
biome optional: one biome everywhere, from the mod ("ruby_meadow") or from the game ("minecraft:cherry_grove"). Without it, the usual biomes of that terrain

Terrain

Terrain Shape
normal hills, caves and oceans, like the overworld
flat flat: bedrock, dirt and grass
nether a closed cavern world with lava seas
islands floating islands in the void

Reshaping the game's dimensions

The overworld, the Nether and the End can be changed too, without a dimension of your own. A mod can give the land of one of them a shape written in code (terrain "minecraft:the_end" { … }), and pick which biome goes where in the End (biome_map "minecraft:the_end" { … }). Only one mod may shape each dimension, and only one may pick its biomes. Both are explained on the Generation by code page.

Travelling

Players and creatures travel by teleporting to a location in the dimension. Its world is found by its id, <mod id>:<name>. The destination chunk is loaded on arrival.

The same works from an event, for example when using an item. A good example is a /realm command that sends the player there and back:

commands/realm.craftCraftScript
command realm describe "Travel to the Ruby Realm and back" {
    if player == null { return "Players only" }
    let realm = world("rubies:ruby_realm")
    if player.world.id == realm.id {
        player.teleport(world().block_at(0, 100, 0).location)
        return "Back home"
    }
    player.teleport(realm.block_at(0, 100, 0).location)
    return "Welcome to the Ruby Realm"
}

In Kotlin

content/Dimensions.ktKotlin
dimension("ruby_realm") {
    kind = DimensionKind.OVERWORLD
    terrain = Terrain.NORMAL
    biome = "ruby_meadow"
}

dimension("flatland") { terrain = Terrain.FLAT }

Travel with entity.teleport(location), using a location in that world.