mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-30 01:34:04 +00:00
Hotload edited biomes and flag the pending restart
Loaded biome definitions stay until restart
This commit is contained in:
1 parent
53376816d7
commit
82b2b3403e
20 files changed
+651
-56
No files matched your search
+22
-3
@@ -28,6 +28,8 @@ import art.arcane.iris.modded.ModdedSavedTerrainCapture;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import art.arcane.iris.generation.runtime.EnginePlatformHooks;
|
||||
import art.arcane.iris.generation.runtime.StudioRestartRequirement;
|
||||
import art.arcane.iris.world.history.RegistryRestartRequiredException;
|
||||
import art.arcane.iris.generation.mantle.CustomBlockOwnership;
|
||||
import art.arcane.iris.modded.api.ModdedCustomContentRegistry;
|
||||
import art.arcane.volmlib.nativelib.terrain.NativeBlockPoint;
|
||||
@@ -366,7 +368,7 @@ public final class ModdedStudioHotloadService implements ModdedTickableService,
|
||||
watch.engine = engine;
|
||||
watch.folder = new ReactiveFolder(
|
||||
engine.getData().getDataFolder(),
|
||||
(KList<File> created, KList<File> changed, KList<File> deleted) -> hotload(dimensionId, engine),
|
||||
(KList<File> created, KList<File> changed, KList<File> deleted) -> hotloadFromWatcher(dimensionId, engine),
|
||||
new KList<>(".iob", ".json"),
|
||||
new KList<>(".iris"),
|
||||
new KList<>());
|
||||
@@ -388,13 +390,30 @@ public final class ModdedStudioHotloadService implements ModdedTickableService,
|
||||
throw new IllegalStateException("The Studio world is closing or closed.");
|
||||
}
|
||||
engine.hotloadSilently();
|
||||
ModdedIrisLog.info("Iris studio hotload {} pack={} {}ms", dimensionId, engine.getDimension().getLoadKey(), System.currentTimeMillis() - start);
|
||||
ModdedIrisLog.info("Iris studio hotload {} pack={} {}ms{}", dimensionId, engine.getDimension().getLoadKey(),
|
||||
System.currentTimeMillis() - start, restartSuffix(engine.getStudioRestartRequirement()));
|
||||
} catch (Throwable e) {
|
||||
ModdedIrisLog.error("Iris studio hotload failed for {}", dimensionId, e);
|
||||
if (!RegistryRestartRequiredException.inCauseChain(e)) {
|
||||
ModdedIrisLog.error("Iris studio hotload failed for {}", dimensionId, e);
|
||||
}
|
||||
throw new IllegalStateException("Iris studio hotload failed for " + dimensionId, e);
|
||||
}
|
||||
}
|
||||
|
||||
private void hotloadFromWatcher(String dimensionId, Engine engine) {
|
||||
try {
|
||||
hotload(dimensionId, engine);
|
||||
} catch (IllegalStateException failure) {
|
||||
if (!RegistryRestartRequiredException.inCauseChain(failure)) {
|
||||
throw failure;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static String restartSuffix(StudioRestartRequirement requirement) {
|
||||
return requirement.isPending() ? " restart needed: " + requirement.biomeSummary() : "";
|
||||
}
|
||||
|
||||
static boolean hasDatapackImports(Iterable<IrisDimension> dimensions) {
|
||||
if (dimensions == null) {
|
||||
return false;
|
||||
|
||||
+2
@@ -1,6 +1,7 @@
|
||||
package art.arcane.iris.modded.service;
|
||||
|
||||
import art.arcane.iris.generation.runtime.Engine;
|
||||
import art.arcane.iris.generation.runtime.StudioRestartRequirement;
|
||||
import art.arcane.iris.generation.terrain.IrisDimension;
|
||||
import art.arcane.iris.modded.ModdedScheduler;
|
||||
import art.arcane.volmlib.util.collection.KList;
|
||||
@@ -218,6 +219,7 @@ public class ModdedStudioHotloadServiceTest {
|
||||
Engine engine = mock(Engine.class);
|
||||
when(engine.isStudio()).thenReturn(true);
|
||||
when(engine.getDimension()).thenReturn(new IrisDimension());
|
||||
when(engine.getStudioRestartRequirement()).thenReturn(StudioRestartRequirement.none());
|
||||
return engine;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user