Removed WorldPreset Preload
This commit is contained in:
parent
b4f9fdf95f
commit
1ccb1af517
3 changed files with 0 additions and 95 deletions
|
@ -78,97 +78,6 @@ public class WorldGenUtil {
|
|||
);
|
||||
}
|
||||
|
||||
// @ApiStatus.Internal
|
||||
//TODO: 1.19.3 Disabled for now
|
||||
// public static Pair<WorldDimensions, RegistryAccess.Frozen> defaultWorldDataSupplier(
|
||||
// RegistryOps<JsonElement> loaderOps,
|
||||
// RegistryAccess.Frozen frozen
|
||||
// ) {
|
||||
// WorldDimensions defaultGen = createDefaultWorldFromPreset(frozen);
|
||||
// RegistryOps<JsonElement> registryOps = RegistryOps.create(JsonOps.INSTANCE, frozen);
|
||||
//
|
||||
// WorldDimensions worldGenSettings = WorldDimensions.CODEC
|
||||
// .codec().parse(registryOps, defaultGen)
|
||||
// .flatMap(json -> WorldDimensions.CODEC.codec().parse(
|
||||
// loaderOps,
|
||||
// json
|
||||
// ))
|
||||
// .getOrThrow(
|
||||
// false,
|
||||
// Util.prefix(
|
||||
// "Error parsing worldgen settings after loading data packs: ",
|
||||
// WorldsTogether.LOGGER::error
|
||||
// )
|
||||
// );
|
||||
//// WorldGenSettings worldGenSettings = createDefaultWorldFromPreset(frozen);
|
||||
// return Pair.of(worldGenSettings, frozen);
|
||||
// }
|
||||
|
||||
// private static final Map<ResourceKey<WorldPreset>, Map<ResourceKey<LevelStem>, LevelStem>> WORLD_PRESET_MAP = new HashMap<>();
|
||||
//
|
||||
// @ApiStatus.Internal
|
||||
// public static Map<ResourceKey<LevelStem>, LevelStem> getDimensionsWithModData(ResourceKey<WorldPreset> preset) {
|
||||
// var data = WORLD_PRESET_MAP.get(preset);
|
||||
// if (data == null) return new HashMap<>();
|
||||
// return data;
|
||||
// }
|
||||
|
||||
@ApiStatus.Internal
|
||||
public static Holder<WorldPreset> reloadWithModData(Holder<WorldPreset> preset) {
|
||||
// if (preset.value() instanceof WorldPresetAccessor acc) {
|
||||
// var data = WORLD_PRESET_MAP.get(preset.unwrapKey().orElseThrow());
|
||||
// if (data != null) {
|
||||
// acc.bcl_setDimensions(data);
|
||||
// }
|
||||
// }
|
||||
return preset;
|
||||
}
|
||||
|
||||
public static void clearPreloadedWorldPresets() {
|
||||
// WORLD_PRESET_MAP.clear();
|
||||
}
|
||||
|
||||
// public static void preloadWorldPresets(ResourceManager resourceManager, RegistryAccess.Writable writable) {
|
||||
// clearPreloadedWorldPresets();
|
||||
// Registry<WorldPreset> registry = writable.registryOrThrow(Registry.WORLD_PRESET_REGISTRY);
|
||||
// //for (ResourceKey<WorldPreset> key : registry.registryKeySet())
|
||||
// ResourceKey<WorldPreset> key = net.minecraft.world.level.levelgen.presets.WorldPresets.NORMAL;
|
||||
// {
|
||||
// RegistryOps<JsonElement> loaderOps = RegistryOps.createAndLoad(
|
||||
// JsonOps.INSTANCE, writable, resourceManager
|
||||
// );
|
||||
// Holder<WorldPreset> in = registry.getHolderOrThrow(key);
|
||||
// if (in.unwrapKey().isPresent()) {
|
||||
// RegistryOps<JsonElement> registryOps = RegistryOps.create(JsonOps.INSTANCE, writable);
|
||||
// WorldGenSettings settings = WorldGenUtil.createWorldFromPreset(
|
||||
// in.unwrapKey().orElseThrow(),
|
||||
// writable,
|
||||
// RandomSource.create().nextLong(),
|
||||
// true,
|
||||
// false
|
||||
// );
|
||||
// WorldGenSettings worldGenSettings = WorldGenSettings.CODEC
|
||||
// .encodeStart(registryOps, settings)
|
||||
// .flatMap(json -> WorldGenSettings.CODEC.parse(
|
||||
// loaderOps,
|
||||
// json
|
||||
// ))
|
||||
// .getOrThrow(
|
||||
// false,
|
||||
// Util.prefix(
|
||||
// "Error parsing world preset settings after loading data packs: ",
|
||||
// WorldsTogether.LOGGER::error
|
||||
// )
|
||||
// );
|
||||
// ImmutableMap.Builder<ResourceKey<LevelStem>, LevelStem> map = ImmutableMap.builder();
|
||||
// for (Map.Entry<ResourceKey<LevelStem>, LevelStem> entry : worldGenSettings.dimensions().entrySet()) {
|
||||
// map.put(entry.getKey(), entry.getValue());
|
||||
// }
|
||||
// WORLD_PRESET_MAP.put(key, map.build());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
public static WorldDimensions createDefaultWorldFromPreset(RegistryAccess registryAccess, long seed) {
|
||||
return createDefaultWorldFromPreset(registryAccess, seed, true, false);
|
||||
}
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package org.betterx.worlds.together.mixin.client;
|
||||
|
||||
import org.betterx.worlds.together.levelgen.WorldGenUtil;
|
||||
import org.betterx.worlds.together.worldPreset.WorldGenSettingsComponentAccessor;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldCreationContext;
|
||||
|
@ -72,7 +71,6 @@ public abstract class WorldGenSettingsComponentMixin implements WorldGenSettings
|
|||
custom.addAll(list
|
||||
.stream()
|
||||
.filter(vanilla)
|
||||
.map(WorldGenUtil::reloadWithModData)
|
||||
.toList());
|
||||
|
||||
return custom;
|
||||
|
|
|
@ -219,7 +219,6 @@ public class WorldBootstrap {
|
|||
String levelID,
|
||||
LevelStorageSource levelSource
|
||||
) {
|
||||
WorldGenUtil.clearPreloadedWorldPresets();
|
||||
try {
|
||||
var levelStorageAccess = levelSource.createAccess(levelID);
|
||||
WorldBootstrap.setupWorld(
|
||||
|
@ -299,7 +298,6 @@ public class WorldBootstrap {
|
|||
|
||||
public static void finishedWorldLoad() {
|
||||
WorldEventsImpl.ON_WORLD_LOAD.emit(OnWorldLoad::onLoad);
|
||||
WorldGenUtil.clearPreloadedWorldPresets();
|
||||
}
|
||||
|
||||
public static void finalizeWorldGenSettings(Registry<LevelStem> dimensionRegistry) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue