Donnie Alexander

make a mod that creates a 2nd copy of the overworld accessible through a command (/ovrwld2 [ovrwld2-leave to go back to worldspawn])

Kodari AI
KodariTue at 1:20 am 3
OverworldDuplicator
Adds a command-based system that creates and manages a second copy of the overworld dimension. Players use /ovrwld2 to teleport to the duplicate dimension, which generates fresh terrain identical to the overworld. The /ovrwld2-leave command returns players to their original overworld worldspawn. The mod handles dimension registration, world generation copying, and teleportation logic, ensuring seamless travel between the two overworld instances while maintaining separate player inventories and progress.
  • Generate a separate dimension with the Overworld’s terrain settings.

  • Add /ovrwld2 to enter and /ovrwld2-leave to return to world spawn.

Created a separate Overworld dimension:

  • /ovrwld2 enters it.

  • /ovrwld2-leave returns you to the original world spawn.

It generates using Overworld settings, but is independent: existing builds and changes aren’t copied across.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
5 111
src/main/java/com/kodari/overworld2/Overworld2.java
package com.kodari.overworld2;

import net.minecraft.commands.Commands;
import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.levelgen.Heightmap;
import net.neoforged.bus.api.SubscribeEvent;
import net.neoforged.fml.common.EventBusSubscriber;
import net.neoforged.fml.common.Mod;
import net.neoforged.neoforge.event.RegisterCommandsEvent;

@Mod(Overworld2.MOD_ID)
@EventBusSubscriber(modid = Overworld2.MOD_ID)
public class Overworld2 {
    public static final String MOD_ID = "overworld2";
    private static final ResourceKey<Level> SECOND_OVERWORLD = ResourceKey.create(
            Registries.DIMENSION, ResourceLocation.fromNamespaceAndPath(MOD_ID, "overworld2"));

    @SubscribeEvent
    public static void registerCommands(RegisterCommandsEvent event) {
        event.getDispatcher().register(Commands.literal("ovrwld2").executes(context -> {
            ServerPlayer player = context.getSource().getPlayerOrException();
            ServerLevel destination = context.getSource().getServer().getLevel(SECOND_OVERWORLD);
            if (destination == null) {
                context.getSource().sendFailure(Component.literal("The second Overworld is not available."));
                return 0;
            }
            BlockPos spawn = context.getSource().getServer().overworld().getSharedSpawnPos();
            int y = destination.getHeight(Heightmap.Types.MOTION_BLOCKING_NO_LEAVES, spawn.getX(), spawn.getZ());
            player.teleportTo(destination, spawn.getX() + 0.5, y, spawn.getZ() + 0.5,
                    player.getYRot(), player.getXRot());
            return 1;
        }));
        event.getDispatcher().register(Commands.literal("ovrwld2-leave").executes(context -> {
            ServerPlayer player = context.getSource().getPlayerOrException();
            ServerLevel overworld = context.getSource().getServer().overworld();
            BlockPos spawn = overworld.getSharedSpawnPos();
            player.teleportTo(overworld, spawn.getX() + 0.5, spawn.getY(), spawn.getZ() + 0.5,
                    player.getYRot(), player.getXRot());
            return 1;
        }));
    }
}