mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-12-30 20:39:21 +00:00
implement proper datapack reload+per world height
This commit is contained in:
@@ -747,6 +747,9 @@ public class Iris extends VolmitPlugin implements Listener {
|
||||
ff.mkdirs();
|
||||
service(StudioSVC.class).installIntoWorld(getSender(), dim.getLoadKey(), w.worldFolder());
|
||||
}
|
||||
if (!INMS.get().registerDimension(worldName, dim)) {
|
||||
throw new IllegalStateException("Unable to register dimension " + dim.getName());
|
||||
}
|
||||
|
||||
return new BukkitChunkGenerator(w, false, ff, dim.getLoadKey(), false);
|
||||
}
|
||||
|
||||
@@ -228,7 +228,7 @@ public class ServerConfigurator {
|
||||
Iris.info( "Hotloading all Datapacks!");
|
||||
if (INMS.get().supportsDataPacks()) {
|
||||
for (File folder : getDatapacksFolder()) {
|
||||
INMS.get().loadDatapack(folder);
|
||||
INMS.get().loadDatapack(folder, false);
|
||||
}
|
||||
Iris.info("Datapacks Hotloaded!");
|
||||
Iris.info(C.YELLOW + "============================================================================");
|
||||
|
||||
@@ -20,9 +20,11 @@ package com.volmit.iris.core.commands;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.ServerConfigurator;
|
||||
import com.volmit.iris.core.gui.NoiseExplorerGUI;
|
||||
import com.volmit.iris.core.gui.VisionGUI;
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.core.project.IrisProject;
|
||||
import com.volmit.iris.core.service.ConversionSVC;
|
||||
import com.volmit.iris.core.service.StudioSVC;
|
||||
@@ -279,13 +281,23 @@ public class CommandStudio implements DecreeExecutor {
|
||||
}
|
||||
|
||||
@Decree(description = "Hotload a studio", aliases = {"reload", "h"})
|
||||
public void hotload() {
|
||||
public void hotload(@Param(defaultValue = "false") boolean reloadDataPack) {
|
||||
if (!Iris.service(StudioSVC.class).isProjectOpen()) {
|
||||
sender().sendMessage(C.RED + "No studio world open!");
|
||||
return;
|
||||
}
|
||||
Iris.service(StudioSVC.class).getActiveProject().getActiveProvider().getEngine().hotload();
|
||||
var provider = Iris.service(StudioSVC.class).getActiveProject().getActiveProvider();
|
||||
provider.getEngine().hotload();
|
||||
sender().sendMessage(C.GREEN + "Hotloaded");
|
||||
if (reloadDataPack) {
|
||||
var world = provider.getTarget().getWorld().realWorld();
|
||||
if (world == null) {
|
||||
sender().sendMessage(C.RED + "Failed to reload datapacks.");
|
||||
return;
|
||||
}
|
||||
boolean success = INMS.get().loadDatapack(new File(world.getWorldFolder(), "datapacks"), true);
|
||||
sender().sendMessage(success ? C.GREEN + "Reloaded datapacks." : C.RED + "Failed to reload datapacks.");
|
||||
}
|
||||
}
|
||||
|
||||
@Decree(description = "Show loot if a chest were right here", origin = DecreeOrigin.PLAYER, sync = true)
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.core.nms;
|
||||
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.object.IrisDimension;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.mantle.Mantle;
|
||||
@@ -113,7 +114,11 @@ public interface INMSBinding {
|
||||
|
||||
Entity spawnEntity(Location location, EntityType type, CreatureSpawnEvent.SpawnReason reason);
|
||||
|
||||
boolean loadDatapack(File datapackFolder);
|
||||
boolean loadDatapack(File datapackFolder, boolean replace);
|
||||
|
||||
default boolean registerDimension(String name, IrisDimension dimension) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void injectBukkit();
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ public class NMSBinding1X implements INMSBinding {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean loadDatapack(File datapackFolder) {
|
||||
public boolean loadDatapack(File datapackFolder, boolean replace) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
package com.volmit.iris.core.tools;
|
||||
|
||||
import com.volmit.iris.core.loader.IrisData;
|
||||
import com.volmit.iris.core.nms.INMS;
|
||||
import com.volmit.iris.engine.object.*;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import org.bukkit.Bukkit;
|
||||
@@ -84,6 +85,9 @@ public class IrisWorldCreator {
|
||||
? dim.getLoader().getDataFolder() :
|
||||
new File(w.worldFolder(), "iris/pack"), dimensionName, smartVanillaHeight);
|
||||
|
||||
if (!INMS.get().registerDimension(name, dim)) {
|
||||
throw new IllegalStateException("Unable to register dimension " + dim.getName());
|
||||
}
|
||||
|
||||
return new WorldCreator(name)
|
||||
.environment(findEnvironment())
|
||||
|
||||
Reference in New Issue
Block a user