|
1 | 1 | package dev.compactmods.machines.command; |
2 | 2 |
|
3 | 3 | import java.io.IOException; |
4 | | -import java.io.InputStreamReader; |
5 | 4 | import java.nio.file.Files; |
6 | 5 | import java.time.ZonedDateTime; |
7 | 6 | import java.time.format.DateTimeFormatter; |
8 | 7 | import java.util.concurrent.Executor; |
9 | 8 | import com.google.common.collect.ImmutableList; |
10 | | -import com.google.gson.Gson; |
11 | | -import com.google.gson.JsonObject; |
12 | 9 | import com.mojang.brigadier.builder.ArgumentBuilder; |
13 | 10 | import com.mojang.brigadier.context.CommandContext; |
14 | 11 | import com.mojang.brigadier.exceptions.CommandSyntaxException; |
|
24 | 21 | import net.minecraft.resources.RegistryReadOps; |
25 | 22 | import net.minecraft.resources.RegistryResourceAccess; |
26 | 23 | import net.minecraft.resources.ResourceKey; |
27 | | -import net.minecraft.resources.ResourceLocation; |
28 | 24 | import net.minecraft.server.MinecraftServer; |
29 | 25 | import net.minecraft.server.level.ServerLevel; |
30 | 26 | import net.minecraft.server.level.progress.ChunkProgressListener; |
31 | | -import net.minecraft.server.packs.resources.Resource; |
32 | 27 | import net.minecraft.world.level.Level; |
33 | 28 | import net.minecraft.world.level.border.BorderChangeListener; |
34 | 29 | import net.minecraft.world.level.dimension.LevelStem; |
@@ -76,28 +71,13 @@ private static void createAndRegisterWorldAndDimension(final MinecraftServer ser |
76 | 71 |
|
77 | 72 | final var serverResources = server.getResourceManager(); |
78 | 73 |
|
79 | | - Resource dimFile = null; |
80 | | - try { |
81 | | - dimFile = serverResources.getResource(new ResourceLocation(CompactMachines.MOD_ID, "dimension/compact_world.json")); |
82 | | - } catch (IOException e) { |
83 | | - CompactMachines.LOGGER.error("Failed to register dimension from datapack settings.", e); |
84 | | - } |
85 | | - |
86 | | - if (dimFile == null) { |
87 | | - return; |
88 | | - } |
89 | | - |
90 | 74 | // only back up level.dat in production |
91 | 75 | if (FMLEnvironment.production && !doLevelFileBackup(server)) return; |
92 | 76 |
|
93 | | - var g = new Gson(); |
94 | | - final var jsonDim = g.fromJson(new InputStreamReader(dimFile.getInputStream()), JsonObject.class); |
95 | | - |
96 | 77 | var reg = server.registryAccess(); |
97 | 78 | var cmDimType = reg.registryOrThrow(Registry.DIMENSION_TYPE_REGISTRY) |
98 | 79 | .get(Registration.COMPACT_DIMENSION_DIM_TYPE); |
99 | 80 |
|
100 | | - // TODO - Figure out how to either re-read dimension info from data structure, or kick the level.dat into behaving |
101 | 81 | var ops = RegistryReadOps.create(JsonOps.INSTANCE, serverResources, reg); |
102 | 82 |
|
103 | 83 | var resourceAccess = RegistryResourceAccess.forResourceManager(serverResources); |
|
0 commit comments