mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-07-19 13:26:01 +00:00
O-o .o-o. o-O
This commit is contained in:
+5
-5
@@ -121,7 +121,7 @@ public final class ModdedForcedDatapack {
|
||||
|
||||
File packFolder = packDirectory.toFile();
|
||||
KList<File> folders = new KList<>();
|
||||
folders.add(packFolder.getParentFile());
|
||||
folders.add(packFolder);
|
||||
KSet<String> seenBiomes = new KSet<>();
|
||||
IDataFixer fixer = DataVersion.getLatest().get();
|
||||
|
||||
@@ -185,8 +185,8 @@ public final class ModdedForcedDatapack {
|
||||
private static void writeWorldPreset(KList<File> folders, IrisDimension dimension, String packName, String dimensionKey, String presetKey) throws IOException {
|
||||
String dimensionRef = dimensionKey.equals(packName) ? packName : packName + ":" + dimensionKey;
|
||||
String json = worldPresetJson(dimensionRef, dimensionTypeRef(dimension));
|
||||
for (File parent : folders) {
|
||||
Path output = parent.toPath().resolve(PACK_FOLDER).resolve("data").resolve("irisworldgen").resolve("worldgen").resolve("world_preset").resolve(presetKey + ".json");
|
||||
for (File datapackRoot : folders) {
|
||||
Path output = datapackRoot.toPath().resolve("data").resolve("irisworldgen").resolve("worldgen").resolve("world_preset").resolve(presetKey + ".json");
|
||||
Files.createDirectories(output.getParent());
|
||||
Files.writeString(output, json, StandardCharsets.UTF_8);
|
||||
}
|
||||
@@ -257,8 +257,8 @@ public final class ModdedForcedDatapack {
|
||||
IrisDimensionType type = dimension.getDimensionType();
|
||||
String json = type.toJson(fixer);
|
||||
String typeKey = dimension.getDimensionTypeKey();
|
||||
for (File parent : folders) {
|
||||
Path output = parent.toPath().resolve(PACK_FOLDER).resolve("data").resolve("irisworldgen").resolve("dimension_type").resolve(typeKey + ".json");
|
||||
for (File datapackRoot : folders) {
|
||||
Path output = datapackRoot.toPath().resolve("data").resolve("irisworldgen").resolve("dimension_type").resolve(typeKey + ".json");
|
||||
Files.createDirectories(output.getParent());
|
||||
Files.writeString(output, json, StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ public final class ModdedPackInstaller {
|
||||
|
||||
File packs = configDir.resolve("irisworldgen").resolve("packs").toFile();
|
||||
try {
|
||||
if (PackDownloader.isDefaultOverworld(pack)) {
|
||||
return PackDownloader.downloadDefaultOverworld(packs, true, feedback) != null;
|
||||
}
|
||||
return PackDownloader.download(packs, "IrisDimensions/" + pack, branch, true, false, feedback) != null;
|
||||
} catch (IOException error) {
|
||||
LOGGER.error("Iris pack download failed for IrisDimensions/{} ({})", pack, branch, error);
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
package art.arcane.iris.modded;
|
||||
|
||||
import art.arcane.iris.core.pack.PackDownloader;
|
||||
import art.arcane.iris.core.pack.PackValidationRegistry;
|
||||
import art.arcane.iris.core.pack.PackValidationResult;
|
||||
import art.arcane.iris.core.pack.PackValidator;
|
||||
@@ -131,7 +132,8 @@ public final class ModdedStartup {
|
||||
if (new File(packFolder, "dimensions/" + pack + ".json").isFile()) {
|
||||
return;
|
||||
}
|
||||
LOGGER.info("Iris default pack '{}' missing; downloading IrisDimensions/{} (master)", pack, pack);
|
||||
String source = PackDownloader.isDefaultOverworld(pack) ? "beta release" : "master branch";
|
||||
LOGGER.info("Iris default pack '{}' missing; downloading IrisDimensions/{} ({})", pack, pack, source);
|
||||
boolean installed = ModdedPackInstaller.install(configDir, pack, "master", (String line) -> LOGGER.info("Iris: {}", line));
|
||||
if (!installed) {
|
||||
LOGGER.warn("Iris default pack '{}' could not be downloaded; install it with /iris download {}", pack, pack);
|
||||
|
||||
+6
-4
@@ -21,6 +21,7 @@ package art.arcane.iris.modded.command;
|
||||
import art.arcane.iris.core.IrisSettings;
|
||||
import art.arcane.iris.core.gui.GuiHost;
|
||||
import art.arcane.iris.core.loader.IrisRegistrant;
|
||||
import art.arcane.iris.core.pack.PackDownloader;
|
||||
import art.arcane.iris.engine.framework.Engine;
|
||||
import art.arcane.iris.engine.framework.IrisStructureLocator;
|
||||
import art.arcane.iris.engine.framework.Locator;
|
||||
@@ -983,15 +984,16 @@ public final class IrisModdedCommands {
|
||||
|
||||
private static int download(CommandSourceStack source, String pack, String branch) {
|
||||
MinecraftServer server = source.getServer();
|
||||
String effectiveBranch = pack.equals("overworld") ? "master" : branch;
|
||||
ok(source, "Downloading IrisDimensions/" + pack + " (branch " + effectiveBranch + ")...");
|
||||
boolean defaultOverworld = PackDownloader.isDefaultOverworld(pack);
|
||||
String downloadSource = defaultOverworld ? "beta release" : "branch " + branch;
|
||||
ok(source, "Downloading IrisDimensions/" + pack + " (" + downloadSource + ")...");
|
||||
Thread thread = new Thread(() -> {
|
||||
boolean installed = ModdedPackInstaller.install(ModdedEngineBootstrap.loader().configDir(), pack, effectiveBranch,
|
||||
boolean installed = ModdedPackInstaller.install(ModdedEngineBootstrap.loader().configDir(), pack, branch,
|
||||
(String message) -> server.execute(() -> ok(source, message)));
|
||||
if (installed) {
|
||||
server.execute(() -> ok(source, "Pack '" + pack + "' installed. Its dimension types and custom biomes join the forced Iris datapack on the next server restart; worlds created before restarting run with fallback heights until then."));
|
||||
} else {
|
||||
server.execute(() -> fail(source, "Pack download failed for " + pack + "/" + effectiveBranch + " (see console)."));
|
||||
server.execute(() -> fail(source, "Pack download failed for " + pack + " (" + downloadSource + "; see console)."));
|
||||
}
|
||||
}, "Iris Pack Download");
|
||||
thread.setDaemon(true);
|
||||
|
||||
Reference in New Issue
Block a user