mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 10:12:53 +00:00
Patch core
This commit is contained in:
parent
ba2a398da3
commit
69cbb262ba
@ -19,9 +19,8 @@
|
||||
package com.volmit.iris.core;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisWorlds;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
||||
import com.volmit.iris.util.board.BoardManager;
|
||||
import com.volmit.iris.util.board.BoardProvider;
|
||||
@ -73,7 +72,7 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
||||
|
||||
|
||||
private boolean isIrisWorld(World w) {
|
||||
return IrisWorlds.isIrisWorld(w) && IrisWorlds.access(w).isStudio();
|
||||
return IrisToolbelt.isIrisWorld(w) && IrisToolbelt.access(w).isStudio();
|
||||
}
|
||||
|
||||
public void updatePlayer(Player p) {
|
||||
@ -102,7 +101,7 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
||||
return v;
|
||||
}
|
||||
|
||||
IrisAccess g = IrisWorlds.access(player.getWorld());
|
||||
Engine engine = IrisToolbelt.access(player.getWorld()).getEngine();
|
||||
|
||||
if (cl.flip()) {
|
||||
// TODO MEMORY
|
||||
@ -113,12 +112,6 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
||||
int y = player.getLocation().getBlockY();
|
||||
int z = player.getLocation().getBlockZ();
|
||||
|
||||
if (g.getCompound() == null) {
|
||||
v.add("Loading...");
|
||||
return v;
|
||||
}
|
||||
|
||||
Engine engine = g.getCompound().getEngineForHeight(y);
|
||||
if (ecl.flip()) {
|
||||
energyBar.setProgress(Math.min(1000D, engine.getWorldManager().getEnergy()) / 1000D);
|
||||
energyBar.setTitle("Spawner Energy: " + Form.f((int) Math.min(1000D, engine.getWorldManager().getEnergy())));
|
||||
@ -129,27 +122,24 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
||||
long memoryGuess = 0;
|
||||
int loadedObjects = 0;
|
||||
|
||||
for (int i = 0; i < g.getCompound().getSize(); i++) {
|
||||
parallaxRegions += g.getCompound().getEngine(i).getParallax().getRegionCount();
|
||||
parallaxChunks += g.getCompound().getEngine(i).getParallax().getChunkCount();
|
||||
loadedObjects += g.getCompound().getData().getObjectLoader().getSize();
|
||||
memoryGuess += g.getCompound().getData().getObjectLoader().getTotalStorage() * 225L;
|
||||
memoryGuess += parallaxChunks * 3500L;
|
||||
memoryGuess += parallaxRegions * 1700000L;
|
||||
}
|
||||
parallaxRegions +=engine.getParallax().getRegionCount();
|
||||
parallaxChunks += engine.getParallax().getChunkCount();
|
||||
loadedObjects += engine.getData().getObjectLoader().getSize();
|
||||
memoryGuess += engine.getData().getObjectLoader().getTotalStorage() * 225L;
|
||||
memoryGuess += parallaxChunks * 3500L;
|
||||
memoryGuess += parallaxRegions * 1700000L;
|
||||
|
||||
tp.put(0); // TODO: CHUNK SPEED
|
||||
|
||||
|
||||
v.add("&7&m------------------");
|
||||
v.add(C.GREEN + "Speed" + C.GRAY + ": " + Form.f(g.getGeneratedPerSecond(), 0) + "/s " + Form.duration(1000D / g.getGeneratedPerSecond(), 0));
|
||||
v.add(C.GREEN + "Speed" + C.GRAY + ": " + Form.f(engine.getGeneratedPerSecond(), 0) + "/s " + Form.duration(1000D / engine.getGeneratedPerSecond(), 0));
|
||||
v.add(C.GREEN + "Memory Use" + C.GRAY + ": ~" + Form.memSize(memoryGuess, 0));
|
||||
|
||||
if (engine != null) {
|
||||
v.add("&7&m------------------");
|
||||
KList<IrisFeaturePositional> f = new KList<>();
|
||||
f.add(engine.getEngineParallax().forEachFeature(x, z));
|
||||
v.add(C.AQUA + "Engine" + C.GRAY + ": " + engine.getName() + " " + engine.getMinHeight() + "-" + engine.getMaxHeight());
|
||||
v.add(C.AQUA + "Region" + C.GRAY + ": " + engine.getRegion(x, z).getName());
|
||||
v.add(C.AQUA + "Biome" + C.GRAY + ": " + engine.getBiome(x, y, z).getName());
|
||||
v.add(C.AQUA + "Height" + C.GRAY + ": " + Math.round(engine.getHeight(x, z)));
|
||||
|
@ -22,7 +22,6 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
||||
@ -31,6 +30,7 @@ import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||
import com.volmit.iris.engine.object.tile.TileData;
|
||||
import com.volmit.iris.engine.object.trees.IrisTreeModes;
|
||||
import com.volmit.iris.engine.object.trees.IrisTreeSize;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.data.Cuboid;
|
||||
@ -82,26 +82,14 @@ public class TreeManager implements Listener {
|
||||
return;
|
||||
}
|
||||
|
||||
IrisAccess worldAccess = IrisToolbelt.access(event.getWorld());
|
||||
PlatformChunkGenerator worldAccess = IrisToolbelt.access(event.getWorld());
|
||||
if (worldAccess == null) {
|
||||
Iris.debug(this.getClass().getName() + " passed it off to vanilla because could not get IrisAccess for this world");
|
||||
Iris.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldAccess.getCompound() == null) {
|
||||
Iris.debug(this.getClass().getName() + " passed off to vanilla because dimension compound is null");
|
||||
Iris.reportError(new NullPointerException(event.getWorld().getName() + " is accessible but does not have compound"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (worldAccess.getCompound().getRootDimension() == null) {
|
||||
Iris.debug(this.getClass().getName() + " passed off to vanilla because compound's root dimension is null");
|
||||
Iris.reportError(new NullPointerException(event.getWorld().getName() + " is accessible & has compound but has no root dimension"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (!worldAccess.getCompound().getRootDimension().getTreeSettings().isEnabled()) {
|
||||
if (!worldAccess.getEngine().getDimension().getTreeSettings().isEnabled()) {
|
||||
Iris.debug(this.getClass().getName() + " cancelled because tree overrides are disabled");
|
||||
return;
|
||||
}
|
||||
@ -166,13 +154,7 @@ public class TreeManager implements Listener {
|
||||
|
||||
@Override
|
||||
public int getFluidHeight() {
|
||||
Engine engine;
|
||||
if (worldAccess.getCompound().getSize() > 1) {
|
||||
engine = worldAccess.getCompound().getEngine(0);
|
||||
} else {
|
||||
engine = (Engine) worldAccess.getCompound().getRootDimension();
|
||||
}
|
||||
return engine.getDimension().getFluidHeight();
|
||||
return worldAccess.getEngine().getDimension().getFluidHeight();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -226,18 +208,18 @@ public class TreeManager implements Listener {
|
||||
* @param size The size of the sapling area
|
||||
* @return An object placement which contains the matched tree, or null if none were found / it's disabled.
|
||||
*/
|
||||
private IrisObjectPlacement getObjectPlacement(IrisAccess worldAccess, Location location, TreeType type, IrisTreeSize size) {
|
||||
private IrisObjectPlacement getObjectPlacement(PlatformChunkGenerator worldAccess, Location location, TreeType type, IrisTreeSize size) {
|
||||
|
||||
KList<IrisObjectPlacement> placements = new KList<>();
|
||||
boolean isUseAll = ((Engine) worldAccess.getEngineAccess(location.getBlockY())).getDimension().getTreeSettings().getMode().equals(IrisTreeModes.ALL);
|
||||
boolean isUseAll = worldAccess.getEngine().getDimension().getTreeSettings().getMode().equals(IrisTreeModes.ALL);
|
||||
|
||||
// Retrieve objectPlacements of type `species` from biome
|
||||
IrisBiome biome = worldAccess.getBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
IrisBiome biome = worldAccess.getEngine().getBiome(location.getBlockX(), location.getBlockY(), location.getBlockZ());
|
||||
placements.addAll(matchObjectPlacements(biome.getObjects(), size, type));
|
||||
|
||||
// Add more or find any in the region
|
||||
if (isUseAll || placements.isEmpty()) {
|
||||
IrisRegion region = worldAccess.getCompound().getEngineForHeight(location.getBlockY()).getRegion(location.getBlockX(), location.getBlockZ());
|
||||
IrisRegion region = worldAccess.getEngine().getRegion(location.getBlockX(), location.getBlockZ());
|
||||
placements.addAll(matchObjectPlacements(region.getObjects(), size, type));
|
||||
}
|
||||
|
||||
|
@ -19,8 +19,8 @@
|
||||
package com.volmit.iris.core.edit;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisWorlds;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.parallax.ParallaxAccess;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.math.BlockPosition;
|
||||
@ -42,10 +42,10 @@ public class DustRevealer {
|
||||
|
||||
public static void spawn(Block block, VolmitSender sender) {
|
||||
World world = block.getWorld();
|
||||
IrisAccess access = IrisWorlds.access(world);
|
||||
Engine access = IrisToolbelt.access(world).getEngine();
|
||||
|
||||
if (access != null) {
|
||||
ParallaxAccess a = access.getEngineAccess(block.getY()).getParallaxAccess();
|
||||
ParallaxAccess a = access.getParallaxAccess();
|
||||
|
||||
if (a.getObject(block.getX(), block.getY(), block.getZ()) != null) {
|
||||
sender.sendMessage("Found object " + a.getObject(block.getX(), block.getY(), block.getZ()));
|
||||
|
@ -21,10 +21,9 @@ package com.volmit.iris.core.gui;
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.gui.components.IrisRenderer;
|
||||
import com.volmit.iris.core.gui.components.RenderType;
|
||||
import com.volmit.iris.core.tools.IrisWorlds;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.IrisComplex;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||
@ -156,11 +155,9 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
||||
|
||||
public boolean updateEngine() {
|
||||
if (engine.isClosed()) {
|
||||
int index = engine.getIndex();
|
||||
|
||||
if (world.hasRealWorld()) {
|
||||
try {
|
||||
engine = IrisWorlds.access(world.realWorld()).getCompound().getEngine(index);
|
||||
engine = IrisToolbelt.access(world.realWorld()).getEngine();
|
||||
return !engine.isClosed();
|
||||
} catch (Throwable e) {
|
||||
|
||||
@ -779,9 +776,9 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
||||
}
|
||||
}
|
||||
|
||||
public static void launch(IrisAccess g, int i) {
|
||||
public static void launch(Engine g, int i) {
|
||||
J.a(() ->
|
||||
createAndShowGUI(g.getCompound().getEngine(i), i, g.getCompound().getWorld()));
|
||||
createAndShowGUI(g, i, g.getWorld()));
|
||||
}
|
||||
|
||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||
|
@ -19,9 +19,9 @@
|
||||
package com.volmit.iris.core.link;
|
||||
|
||||
import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.tools.IrisWorlds;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||
import org.bukkit.Location;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
@ -51,46 +51,46 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
||||
@Override
|
||||
public String onRequest(OfflinePlayer player, String p) {
|
||||
Location l = null;
|
||||
IrisAccess a = null;
|
||||
PlatformChunkGenerator a = null;
|
||||
|
||||
if (player.isOnline()) {
|
||||
l = player.getPlayer().getLocation();
|
||||
a = IrisWorlds.access(l.getWorld());
|
||||
a = IrisToolbelt.access(l.getWorld());
|
||||
}
|
||||
|
||||
if (p.equalsIgnoreCase("biome_name")) {
|
||||
if (a != null) {
|
||||
return a.getBiome(l).getName();
|
||||
return a.getEngine().getBiome(l).getName();
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("biome_id")) {
|
||||
if (a != null) {
|
||||
return a.getBiome(l).getLoadKey();
|
||||
return a.getEngine().getBiome(l).getLoadKey();
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("biome_file")) {
|
||||
if (a != null) {
|
||||
return a.getBiome(l).getLoadFile().getPath();
|
||||
return a.getEngine().getBiome(l).getLoadFile().getPath();
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("region_name")) {
|
||||
if (a != null) {
|
||||
return a.getRegion(l).getName();
|
||||
return a.getEngine().getRegion(l).getName();
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("region_id")) {
|
||||
if (a != null) {
|
||||
return a.getRegion(l).getLoadKey();
|
||||
return a.getEngine().getRegion(l).getLoadKey();
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("region_file")) {
|
||||
if (a != null) {
|
||||
return a.getRegion(l).getLoadFile().getPath();
|
||||
return a.getEngine().getRegion(l).getLoadFile().getPath();
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("terrain_slope")) {
|
||||
if (a != null) {
|
||||
return ((Engine) a.getEngineAccess(l.getBlockY()))
|
||||
return (a.getEngine())
|
||||
.getComplex().getSlopeStream()
|
||||
.get(l.getX(), l.getZ()) + "";
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("terrain_height")) {
|
||||
if (a != null) {
|
||||
return (int) Math.round(a.getHeight(l)) + "";
|
||||
return (int) Math.round(a.getEngine().getHeight(l.getBlockX(), l.getBlockZ())) + "";
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("world_mode")) {
|
||||
if (a != null) {
|
||||
@ -102,7 +102,7 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
||||
}
|
||||
} else if (p.equalsIgnoreCase("world_speed")) {
|
||||
if (a != null) {
|
||||
return a.getGeneratedPerSecond() + "/s";
|
||||
return a.getEngine().getGeneratedPerSecond() + "/s";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,8 +20,8 @@ package com.volmit.iris.core.pregenerator.methods;
|
||||
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||
import com.volmit.iris.engine.framework.headless.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import lombok.Getter;
|
||||
|
||||
public class HeadlessPregenMethod implements PregeneratorMethod {
|
||||
|
@ -22,8 +22,8 @@ import com.volmit.iris.Iris;
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||
import com.volmit.iris.core.tools.IrisWorlds;
|
||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import com.volmit.iris.util.math.Position2;
|
||||
import org.bukkit.World;
|
||||
|
||||
@ -42,7 +42,7 @@ public class HybridPregenMethod implements PregeneratorMethod {
|
||||
}
|
||||
|
||||
private boolean supportsHeadless(World world) {
|
||||
return IrisWorlds.access(world) != null && !IrisSettings.get().getGenerator().isDisableMCA();
|
||||
return IrisToolbelt.access(world) != null && !IrisSettings.get().getGenerator().isDisableMCA();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -20,8 +20,8 @@ package com.volmit.iris.core.pregenerator.syndicate;
|
||||
|
||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||
import com.volmit.iris.core.pregenerator.syndicate.command.*;
|
||||
import com.volmit.iris.engine.framework.headless.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import com.volmit.iris.util.io.IO;
|
||||
import com.volmit.iris.util.scheduling.J;
|
||||
import org.zeroturnaround.zip.ZipUtil;
|
||||
|
@ -28,7 +28,6 @@ import com.volmit.iris.core.report.Report;
|
||||
import com.volmit.iris.core.report.ReportType;
|
||||
import com.volmit.iris.core.tools.IrisWorldCreator;
|
||||
import com.volmit.iris.engine.framework.Engine;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiome;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiomeMutation;
|
||||
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
||||
@ -40,6 +39,7 @@ import com.volmit.iris.engine.object.noise.IrisGenerator;
|
||||
import com.volmit.iris.engine.object.objects.IrisObjectPlacement;
|
||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||
import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.collection.KList;
|
||||
import com.volmit.iris.util.collection.KMap;
|
||||
import com.volmit.iris.util.collection.KSet;
|
||||
@ -73,124 +73,13 @@ import java.util.UUID;
|
||||
public class IrisProject {
|
||||
private File path;
|
||||
private String name;
|
||||
private IrisAccess activeProvider;
|
||||
private PlatformChunkGenerator activeProvider;
|
||||
|
||||
public IrisProject(File path) {
|
||||
this.path = path;
|
||||
this.name = path.getName();
|
||||
}
|
||||
|
||||
public KList<Report> scanForErrors() {
|
||||
KList<Report> reports = new KList<>();
|
||||
IrisData data = new IrisData(path);
|
||||
Gson g = new Gson();
|
||||
MultiBurst.burst.burst(collectFiles("json").convert((i) -> () -> {
|
||||
try {
|
||||
new JSONObject(IO.readAll(i));
|
||||
} catch (Throwable e) {
|
||||
synchronized (reports) {
|
||||
reports.add(Report.builder()
|
||||
.title("Invalid Json: " + i.getName())
|
||||
.message(i.getAbsolutePath() + e.getMessage())
|
||||
.suggestion("Correct the json")
|
||||
.type(ReportType.ERROR)
|
||||
.build());
|
||||
}
|
||||
}
|
||||
}));
|
||||
|
||||
try {
|
||||
if (activeProvider != null && activeProvider.getCompound() != null) {
|
||||
for (int i = 0; i < getActiveProvider().getCompound().getSize(); i++) {
|
||||
Engine e = getActiveProvider().getCompound().getEngine(i);
|
||||
IrisDimension dim = e.getDimension();
|
||||
reports.add(scanForErrors(dim));
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
reports.add(Report.builder()
|
||||
.title("Failed to check all errors")
|
||||
.message("There may be some json errors, correct those first")
|
||||
.suggestion("Correct the json, or see exception below")
|
||||
.type(ReportType.SEVERE_WARNING)
|
||||
.build());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
private KList<Report> scanForErrors(IrisDimension dim) {
|
||||
KList<Report> reports = new KList<>();
|
||||
|
||||
if (dim.getFocus() != null && !dim.getFocus().isEmpty()) {
|
||||
reports.add(Report.builder()
|
||||
.type(ReportType.NOTICE)
|
||||
.title("Focus Mode is Enabled")
|
||||
.message("Make sure to disable this before pushing")
|
||||
.suggestion("Turn off focus mode")
|
||||
.build());
|
||||
}
|
||||
|
||||
for (IrisRegion i : dim.getAllRegions(getActiveProvider())) {
|
||||
scanForErrors(i);
|
||||
}
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
private KList<Report> scanForErrors(IrisRegion region) {
|
||||
KList<Report> reports = new KList<>();
|
||||
|
||||
if (region.getRarity() > 60) {
|
||||
reports.add(Report.builder()
|
||||
.type(ReportType.WARNING)
|
||||
.title("Region " + region.getName() + " has a rarity of " + region.getRarity())
|
||||
.message("The region rarity higher than 60 can cause performance issues")
|
||||
.suggestion("Scale all rarities down by 50% all at once, then repeat until all rarities are below 60")
|
||||
.build());
|
||||
}
|
||||
|
||||
for (IrisBiome i : region.getAllBiomes(getActiveProvider())) {
|
||||
reports.add(scanForErrors(i));
|
||||
}
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
private KList<Report> scanForErrors(IrisBiome biome) {
|
||||
KList<Report> reports = new KList<>();
|
||||
|
||||
for (IrisObjectPlacement i : biome.getObjects()) {
|
||||
reports.add(scanForErrors(biome, i));
|
||||
}
|
||||
|
||||
for (IrisBiomePaletteLayer i : biome.getLayers()) {
|
||||
reports.add(scanForErrors(biome, i));
|
||||
}
|
||||
|
||||
for (IrisBiomePaletteLayer i : biome.getSeaLayers()) {
|
||||
reports.add(scanForErrorsSeaLayers(biome, i));
|
||||
}
|
||||
|
||||
return reports;
|
||||
}
|
||||
|
||||
private KList<Report> scanForErrors(IrisBiome biome, IrisObjectPlacement i) {
|
||||
|
||||
return new KList<>();
|
||||
}
|
||||
|
||||
private KList<Report> scanForErrors(IrisBiome biome, IrisBiomePaletteLayer i) {
|
||||
|
||||
return new KList<>();
|
||||
}
|
||||
|
||||
private KList<Report> scanForErrorsSeaLayers(IrisBiome biome, IrisBiomePaletteLayer i) {
|
||||
|
||||
return new KList<>();
|
||||
}
|
||||
|
||||
public boolean isOpen() {
|
||||
return activeProvider != null;
|
||||
}
|
||||
@ -226,31 +115,6 @@ public class IrisProject {
|
||||
|
||||
boolean hasError = false;
|
||||
|
||||
try {
|
||||
KList<Report> reports = scanForErrors();
|
||||
|
||||
if (reports.isNotEmpty()) {
|
||||
sender.sendMessage("There are " + reports.size() + " problems detected with this project. See console!");
|
||||
Iris.error("===========================================================");
|
||||
for (Report i : reports) {
|
||||
if (i.getType().equals(ReportType.ERROR)) {
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
switch (i.getType()) {
|
||||
case ERROR -> Iris.error(i.toString());
|
||||
case SEVERE_WARNING -> Iris.warn(i.toString());
|
||||
case WARNING -> Iris.warn(i.toString());
|
||||
case NOTICE -> Iris.warn(i.toString());
|
||||
}
|
||||
}
|
||||
Iris.error("===========================================================");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
hasError = true;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (hasError) {
|
||||
return;
|
||||
}
|
||||
@ -318,7 +182,7 @@ public class IrisProject {
|
||||
.studioMode()
|
||||
.create();
|
||||
|
||||
IrisAccess gx = ((IrisAccess) c.generator());
|
||||
PlatformChunkGenerator gx = ((PlatformChunkGenerator) c.generator());
|
||||
O<Boolean> done = new O<>();
|
||||
done.set(false);
|
||||
activeProvider = gx;
|
||||
@ -328,23 +192,17 @@ public class IrisProject {
|
||||
double last = 0;
|
||||
int req = 400;
|
||||
|
||||
while (gx.getGenerated() < req) {
|
||||
while (gx.getEngine().getGenerated() < req) {
|
||||
assert gx != null;
|
||||
double v = (double) gx.getGenerated() / (double) req;
|
||||
double v = (double) gx.getEngine().getGenerated() / (double) req;
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - gx.getGenerated()) + " Left)"))));
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - gx.getEngine().getGenerated()) + " Left)"))));
|
||||
J.sleep(50);
|
||||
} else {
|
||||
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - gx.getGenerated()) + " Left)")));
|
||||
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - gx.getEngine().getGenerated()) + " Left)")));
|
||||
J.sleep(1000);
|
||||
}
|
||||
|
||||
if (gx.isFailing()) {
|
||||
|
||||
sender.sendMessage("Generation Failed!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (sender.isPlayer()) {
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
||||
|
@ -20,9 +20,10 @@ package com.volmit.iris.core.tools;
|
||||
|
||||
import com.volmit.iris.core.IrisSettings;
|
||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
||||
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.exceptions.IrisException;
|
||||
import com.volmit.iris.util.exceptions.MissingDimensionException;
|
||||
import com.volmit.iris.util.format.C;
|
||||
@ -92,9 +93,9 @@ public class IrisCreator {
|
||||
* @return the IrisAccess
|
||||
* @throws IrisException shit happens
|
||||
*/
|
||||
public IrisAccess create() throws IrisException {
|
||||
public PlatformChunkGenerator create() throws IrisException {
|
||||
IrisDimension d = IrisToolbelt.getDimension(dimension());
|
||||
IrisAccess access = null;
|
||||
PlatformChunkGenerator access = null;
|
||||
Consumer<Double> prog = (pxx) -> {
|
||||
double px = pxx;
|
||||
|
||||
@ -117,7 +118,7 @@ public class IrisCreator {
|
||||
|
||||
if (headless) {
|
||||
HeadlessWorld w = new HeadlessWorld(name, d, seed, studio);
|
||||
access = w.generate().getGenerator();
|
||||
access = w.generate();
|
||||
} else {
|
||||
O<Boolean> done = new O<>();
|
||||
done.set(false);
|
||||
@ -127,33 +128,27 @@ public class IrisCreator {
|
||||
.seed(seed)
|
||||
.studio(studio)
|
||||
.create();
|
||||
access = (IrisAccess) wc.generator();
|
||||
IrisAccess finalAccess1 = access;
|
||||
access = (PlatformChunkGenerator) wc.generator();
|
||||
PlatformChunkGenerator finalAccess1 = access;
|
||||
|
||||
J.a(() ->
|
||||
{
|
||||
int req = 400;
|
||||
|
||||
while (finalAccess1.getGenerated() < req && !done.get()) {
|
||||
double v = (double) finalAccess1.getGenerated() / (double) req;
|
||||
while (finalAccess1.getEngine().getGenerated() < req && !done.get()) {
|
||||
double v = (double) finalAccess1.getEngine().getGenerated() / (double) req;
|
||||
|
||||
if (pregen != null) {
|
||||
v /= 2;
|
||||
}
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess1.getGenerated()) + " Left)"))));
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess1.getEngine().getGenerated()) + " Left)"))));
|
||||
J.sleep(50);
|
||||
} else {
|
||||
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess1.getGenerated()) + " Left)")));
|
||||
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess1.getEngine().getGenerated()) + " Left)")));
|
||||
J.sleep(1000);
|
||||
}
|
||||
|
||||
if (finalAccess1.isFailing()) {
|
||||
|
||||
sender.sendMessage("Generation Failed!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
||||
@ -186,7 +181,7 @@ public class IrisCreator {
|
||||
|
||||
try {
|
||||
|
||||
IrisAccess finalAccess = access;
|
||||
PlatformChunkGenerator finalAccess = access;
|
||||
J.sfut(() -> {
|
||||
if (headless) {
|
||||
O<Boolean> done = new O<>();
|
||||
@ -196,29 +191,23 @@ public class IrisCreator {
|
||||
{
|
||||
int req = 400;
|
||||
|
||||
while (finalAccess.getGenerated() < req && !done.get()) {
|
||||
double v = (double) finalAccess.getGenerated() / (double) req;
|
||||
while (finalAccess.getEngine().getGenerated() < req && !done.get()) {
|
||||
double v = (double) finalAccess.getEngine().getGenerated() / (double) req;
|
||||
v = (v / 2) + 0.5;
|
||||
|
||||
if (sender.isPlayer()) {
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess.getGenerated()) + " Left)"))));
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess.getEngine().getGenerated()) + " Left)"))));
|
||||
J.sleep(50);
|
||||
} else {
|
||||
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess.getGenerated()) + " Left)")));
|
||||
sender.sendMessage(C.WHITE + "Generating " + Form.pc(v) + ((C.GRAY + " (" + (req - finalAccess.getEngine().getGenerated()) + " Left)")));
|
||||
J.sleep(1000);
|
||||
}
|
||||
|
||||
if (finalAccess.isFailing()) {
|
||||
|
||||
sender.sendMessage("Generation Failed!");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
||||
});
|
||||
|
||||
finalAccess.getHeadlessGenerator().getWorld().load();
|
||||
((HeadlessGenerator)finalAccess).getWorld().load();
|
||||
done.set(true);
|
||||
}
|
||||
}).get();
|
||||
|
@ -26,11 +26,13 @@ import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||
import com.volmit.iris.core.pregenerator.methods.HeadlessPregenMethod;
|
||||
import com.volmit.iris.core.pregenerator.methods.HybridPregenMethod;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.framework.IrisAccess;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import com.volmit.iris.util.plugin.VolmitSender;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -80,7 +82,11 @@ public class IrisToolbelt {
|
||||
* @return true if it is an Iris Access world
|
||||
*/
|
||||
public static boolean isIrisWorld(World world) {
|
||||
return access(world) != null;
|
||||
if (world == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return world.getGenerator() instanceof PlatformChunkGenerator;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,8 +95,12 @@ public class IrisToolbelt {
|
||||
* @param world the given world
|
||||
* @return the IrisAccess or null if it's not an Iris World
|
||||
*/
|
||||
public static IrisAccess access(World world) {
|
||||
return IrisWorlds.access(world);
|
||||
public static PlatformChunkGenerator access(World world) {
|
||||
if (isIrisWorld(world)) {
|
||||
return ((PlatformChunkGenerator) world.getGenerator());
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -109,15 +119,15 @@ public class IrisToolbelt {
|
||||
* otherwise Hybrid mode is used.
|
||||
*
|
||||
* @param task the scheduled task
|
||||
* @param access the Iris Generator
|
||||
* @param gen the Iris Generator
|
||||
* @return the pregenerator job (already started)
|
||||
*/
|
||||
public static PregeneratorJob pregenerate(PregenTask task, IrisAccess access) {
|
||||
if (access.isHeadless()) {
|
||||
return pregenerate(task, new HeadlessPregenMethod(access.getHeadlessGenerator().getWorld(), access.getHeadlessGenerator()));
|
||||
public static PregeneratorJob pregenerate(PregenTask task, PlatformChunkGenerator gen) {
|
||||
if (gen.isHeadless()) {
|
||||
return pregenerate(task, new HeadlessPregenMethod(((HeadlessGenerator)gen).getWorld(), (HeadlessGenerator) gen));
|
||||
}
|
||||
|
||||
return pregenerate(task, new HybridPregenMethod(access.getCompound().getWorld().realWorld(), IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getPregenThreadCount())));
|
||||
return pregenerate(task, new HybridPregenMethod(gen.getEngine().getWorld().realWorld(), IrisSettings.getThreadCount(IrisSettings.get().getConcurrency().getPregenThreadCount())));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -142,7 +152,33 @@ public class IrisToolbelt {
|
||||
*
|
||||
* @param world the world to evac
|
||||
*/
|
||||
public static void evacuate(World world) {
|
||||
IrisWorlds.evacuate(world);
|
||||
public static boolean evacuate(World world) {
|
||||
for (World i : Bukkit.getWorlds()) {
|
||||
if (!i.getName().equals(world.getName())) {
|
||||
for (Player j : world.getPlayers()) {
|
||||
new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world.");
|
||||
j.teleport(i.getSpawnLocation());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean evacuate(World world, String m) {
|
||||
for (World i : Bukkit.getWorlds()) {
|
||||
if (!i.getName().equals(world.getName())) {
|
||||
for (Player j : world.getPlayers()) {
|
||||
new VolmitSender(j, Iris.instance.getTag()).sendMessage("You have been evacuated from this world. " + m);
|
||||
j.teleport(i.getSpawnLocation());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,15 @@
|
||||
|
||||
package com.volmit.iris.core.tools;
|
||||
|
||||
import com.sun.jna.Platform;
|
||||
import com.volmit.iris.core.project.loader.IrisData;
|
||||
import com.volmit.iris.engine.framework.EngineCompositeGenerator;
|
||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
||||
import com.volmit.iris.engine.platform.BukkitChunkGenerator;
|
||||
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||
import org.bukkit.World;
|
||||
import org.bukkit.WorldCreator;
|
||||
import org.bukkit.generator.ChunkGenerator;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@ -77,15 +80,18 @@ public class IrisWorldCreator {
|
||||
}
|
||||
|
||||
public WorldCreator create() {
|
||||
EngineCompositeGenerator g = new EngineCompositeGenerator(dimensionName, !studio);
|
||||
g.initialize(IrisWorld.builder()
|
||||
IrisWorld w = IrisWorld.builder()
|
||||
.name(name)
|
||||
.minHeight(minHeight)
|
||||
.maxHeight(maxHeight)
|
||||
.seed(seed)
|
||||
.worldFolder(new File(name))
|
||||
.environment(findEnvironment())
|
||||
.build());
|
||||
.build();
|
||||
ChunkGenerator g = new BukkitChunkGenerator(w, studio, studio
|
||||
? IrisData.loadAnyDimension(dimensionName).getLoader().getDataFolder():
|
||||
new File(w.worldFolder(), "iris"), dimensionName);
|
||||
|
||||
return new WorldCreator(name)
|
||||
.environment(findEnvironment())
|
||||
.generateStructures(true)
|
||||
|
Loading…
x
Reference in New Issue
Block a user