Dimension Registry
The DimensionRegistry is the main API for registering and modifying dimension types in the Minecraft registry.
It provides methods for adding new dimension types as well as modifying existing ones.
Dimension types can be registered with this interface at any point, except the bootstrap phase.
Generally, dimension types are registered and modified using the shorthand methods on the Dimension class,
but you can also use the DimensionRegistry directly if you need more control over the registration process.
Example Usage
Section titled “Example Usage”import dev.wyck.model.level.dimension.Dimension;
import dev.wyck.keys.ResourceKey;
import dev.wyck.wrapper.level.dimension.Skybox;
import org.bukkit.plugin.java.JavaPlugin;
public class ExamplePlugin extends JavaPlugin {
@Override
public void onEnable() {
Dimension dimension = Dimension.builder()
.resourceKey(ResourceKey.of("test", "customdimension"))
.coordinateScale(4.0D)
.minY(-64)
.height(384)
.skybox(Skybox.OVERWORLD)
.register(); // Shorthand — builds and registers the dimension type
}
} import dev.wyck.model.level.dimension.Dimension;
import dev.wyck.registry.DimensionRegistry;
import dev.wyck.keys.ResourceKey;
import dev.wyck.wrapper.level.dimension.Skybox;
import org.bukkit.plugin.java.JavaPlugin;
public class ExamplePlugin extends JavaPlugin {
@Override
public void onEnable() {
Dimension dimension = Dimension.builder()
.resourceKey(ResourceKey.of("test", "customdimension"))
.coordinateScale(4.0D)
.minY(-64)
.height(384)
.skybox(Skybox.OVERWORLD)
.build();
DimensionRegistry registry = DimensionRegistry.registry();
registry.register(dimension);
}
} Modifying Dimension Types
Section titled “Modifying Dimension Types”Wyck supports modifying existing dimension types after they’ve been registered.
This means that you can change the environment and gameplay rules of a dimension on the fly,
either by rebuilding a Dimension with
toBuilder() and calling
modify(), or by targeting an existing key with
modify(ResourceKey, Dimension).
Dimension modified = existing.toBuilder()
.ambientLight(0.5F)
.hasCeiling(true)
.modify(); // Rebuilds and applies the changes in place DimensionRegistry registry = DimensionRegistry.registry();
registry.modify(ResourceKey.of("test", "customdimension"), newData);