User Tools

Site Tools


tutorial:dimensions

This is an old revision of the document!


Creating a Dimension [WIP]

Creating your own dimension is an advanced topic. This tutorial assumes you have already read through the previous tutorials on world generation, and have other basic knowledge such as how to create your own blocks.

Creating your DimensionType

The first thing you want to do is register your custom DimensionType. We are going to create a bee dimension.

  1. public class TutorialDimensions {
  2. public static final FabricDimensionType BEE = FabricDimensionType.builder()
  3. .defaultPlacer((oldEntity, destinationWorld, portalDir, horizontalOffset, verticalOffset) -> new BlockPattern.TeleportTarget(new Vec3d(destinationWorld.getTopPosition(Heightmap.Type.WORLD_SURFACE, BlockPos.ORIGIN)), oldEntity.getVelocity(), (int) oldEntity.yaw))
  4. .factory(BeeDimension::new)
  5. .skyLight(false)
  6. .buildAndRegister(new Identifier(TutorialMod.MOD_ID, "bee"));
  7.  
  8. public static void register() {
  9. // load the class
  10. }
  11. }
  1. public class TutorialMod implements ModInitializer {
  2. @Override
  3. public void onInitialize() {
  4. // ...
  5. TutorialDimensions.register();
  6. }
  7. }

The defaultPlacer determines the default placement when an entity is teleported into this dimension. Here we have made it so the entity spawns on the top block at 0, 0 when entering the dimension. If you want custom portal logic, this is the place to do it. See the EntityPlacer documentation for details.

The Dimension class [TODO]

Travelling between dimensions [TODO]

Creating a ChunkGenerator [TODO]

Creating a BiomeSource [TODO]

Creating a SurfaceBuilder [TODO]

tutorial/dimensions.1582298846.txt.gz · Last modified: 2020/02/21 15:27 by earthcomputer