-
Notifications
You must be signed in to change notification settings - Fork 7
Dimension Registration
Monika Carpenter edited this page Sep 8, 2023
·
5 revisions
In limlib, registering a dimension has never been easier! First, get familiar with the Registrar. Then come back.
To create a new dimension, you have to register a LimlibWorld
inside your registrar class. Which might look something like this:
public class MyRegistrar implements LimlibRegistrar {
public static final LimlibWorld MY_WORLD =
new LimlibWorld(
() -> new DimensionType(...),
(registry) ->
new DimensionOptions(
registry.get(RegistryKeys.DIMENSION_TYPE)
.getHolder(RegistryKey
.of(RegistryKeys.DIMENSION_TYPE, new Identifier("modid:myworld")))
.get(),
new MyChunkGenerator(
new FixedBiomeSource(registry
.get(RegistryKeys.BIOME)
.getHolder(MyBiomes.MY_BIOME)
.get())
)));
@Override
public void registerHooks() {
...
LimlibWorld.LIMLIB_WORLD.register(
RegistryKey.of(LimlibWorld.LIMLIB_WORLD_KEY, new Identifier("modid:myworld")),
MY_WORLD,
Lifecycle.stable()
)
}
}
Of course edit these to your own specifications, your own dimension type, biome source, chunk generator etc.
Limlib has some extra features that come along with dimension registration.
Sound Effects include reverb, distortion, and mainly dimension wide music.
public static final SoundEffects MY_SOUND_EFFECTS = new SoundEffects(
Optional.of(
new StaticReverbEffect.Builder()
.setDecayTime(20.0F)
.build()),
Optional.empty(),
Optional.of(new MusicSound(MySoundEvents.MY_MUSIC, 3000, 8000, true)));
A hook to render a custom skybox
public static final Skybox MY_SKYBOX = new TexturedSkybox(new Identifier("modid:textures/sky/my_skybox"));
Vanillas builtin dimension visual effects; fog color, cloud height, bright or dark lighting, etc
public static final DimensionEffects MY_DIMENSION_EFFECTS = new StaticDimensionEffects(
/* Cloud Height, empty for No Clouds */ Optional.empty(),
/* Alternate Sky Color */ false,
/* Sky Type; NONE, NORMAL, END */ "NONE",
/* Brighten Lighting */ true,
/* Darkened */ false,
/* Thick Fog */ false,
/* Sky Shading */ 1.0F);
A post processing shader effect
public static final PostEffect MY_POST_EFFECT = new StaticPostEffect(new Identifier("modid:my_post_effect"));
You have to register these things as well, inside of a hook.
public class MyRegistrar implements LimlibRegistrar {
...
@Override
public void registerHooks() {
...
LimlibRegistryHooks.hook(SoundEffects.SOUND_EFFECTS_KEY,
(infoLookup, registryKey, registry) -> registry.register(
RegistryKey.of(SoundEffects.SOUND_EFFECTS_KEY, new Identifier("modid:mysoundeffects")),
MY_SOUND_EFFECTS,
Lifecycle.stable()));
LimlibRegistryHooks.hook(Skybox.SKYBOX_KEY,
(infoLookup, registryKey, registry) -> registry.register(
RegistryKey.of(Skybox.SKYBOX_KEY, new Identifier("modid:myskybox")),
MY_SKYBOX,
Lifecycle.stable()));
LimlibRegistryHooks.hook(DimensionEffects.DIMENSION_EFFECTS_KEY,
(infoLookup, registryKey, registry) -> registry.register(
RegistryKey.of(DimensionEffects.DIMENSION_EFFECTS_KEY, new Identifier("modid:mydimensioneffects")),
MY_DIMENSION_EFFECTS,
Lifecycle.stable()));
LimlibRegistryHooks.hook(PostEffect.POST_EFFECT_KEY,
(infoLookup, registryKey, registry) -> registry.register(
RegistryKey.of(PostEffect.POST_EFFECT_KEY, new Identifier("modid:myposteffect")),
MY_POST_EFFECT,
Lifecycle.stable()));
}
}