Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

Add `/warp random` command

+13 -3
+1 -1
build.gradle
··· 1 1 plugins { 2 - id 'dev.architectury.loom' version '1.9-SNAPSHOT' apply false 2 + id 'dev.architectury.loom' version '1.10-SNAPSHOT' apply false 3 3 id 'architectury-plugin' version '3.4-SNAPSHOT' 4 4 id 'com.github.johnrengelman.shadow' version '8.1.1' apply false 5 5 id "io.github.pacifistmc.forgix" version "1.2.9-local.7"
+11 -1
common/src/main/java/net/lerariemann/infinity/registry/var/ModCommands.java
··· 5 5 import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; 6 6 import dev.architectury.event.events.common.CommandRegistrationEvent; 7 7 import dev.architectury.platform.Platform; 8 + import net.lerariemann.infinity.util.InfinityMethods; 8 9 import net.lerariemann.infinity.util.teleport.WarpLogic; 9 10 import net.minecraft.command.argument.DimensionArgumentType; 10 11 import net.minecraft.server.command.CommandManager; 11 12 import net.minecraft.text.Text; 12 13 import net.minecraft.util.Identifier; 14 + 15 + import java.util.Random; 13 16 14 17 import static net.minecraft.server.command.CommandManager.argument; 15 18 import static net.minecraft.server.command.CommandManager.literal; ··· 18 21 public static final DynamicCommandExceptionType MALFORM_IDENTIFIER_EXCEPTION = new DynamicCommandExceptionType( 19 22 id -> Text.stringifiedTranslatable("error.infinity.warp.malformed_identifier", id) 20 23 ); 21 - public static final DynamicCommandExceptionType TIMEBOMBED_EXCEPRION = new DynamicCommandExceptionType( 24 + public static final DynamicCommandExceptionType TIMEBOMBED_EXCEPTION = new DynamicCommandExceptionType( 22 25 id -> Text.stringifiedTranslatable("error.infinity.warp.timebombed", id) 23 26 ); 24 27 ··· 31 34 } 32 35 CommandRegistrationEvent.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal(warp) 33 36 .requires(source -> source.hasPermissionLevel(2)) 37 + .then( 38 + CommandManager.literal("random").executes((context -> { 39 + final long text = InfinityMethods.getRandomSeed(new Random()); 40 + WarpLogic.requestWarpById(context, text); 41 + return 1; 42 + })) 43 + ) 34 44 .then( 35 45 CommandManager.literal("existing").then( 36 46 argument("existing", DimensionArgumentType.dimension()).executes(context -> {
+1 -1
common/src/main/java/net/lerariemann/infinity/util/teleport/WarpLogic.java
··· 47 47 if (w == null) 48 48 throw ModCommands.MALFORM_IDENTIFIER_EXCEPTION.create(value); 49 49 else if (InfinityMethods.isTimebombed(w)) 50 - throw ModCommands.TIMEBOMBED_EXCEPRION.create(value); 50 + throw ModCommands.TIMEBOMBED_EXCEPTION.create(value); 51 51 else requestWarp(context.getSource().getPlayer(), value, true); 52 52 } 53 53 /**