mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Patch core
This commit is contained in:
parent
ba2a398da3
commit
69cbb262ba
@ -19,9 +19,8 @@
|
|||||||
package com.volmit.iris.core;
|
package com.volmit.iris.core;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
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.Engine;
|
||||||
import com.volmit.iris.engine.framework.IrisAccess;
|
|
||||||
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
import com.volmit.iris.engine.object.feature.IrisFeaturePositional;
|
||||||
import com.volmit.iris.util.board.BoardManager;
|
import com.volmit.iris.util.board.BoardManager;
|
||||||
import com.volmit.iris.util.board.BoardProvider;
|
import com.volmit.iris.util.board.BoardProvider;
|
||||||
@ -73,7 +72,7 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
|||||||
|
|
||||||
|
|
||||||
private boolean isIrisWorld(World w) {
|
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) {
|
public void updatePlayer(Player p) {
|
||||||
@ -102,7 +101,7 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
|||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisAccess g = IrisWorlds.access(player.getWorld());
|
Engine engine = IrisToolbelt.access(player.getWorld()).getEngine();
|
||||||
|
|
||||||
if (cl.flip()) {
|
if (cl.flip()) {
|
||||||
// TODO MEMORY
|
// TODO MEMORY
|
||||||
@ -113,12 +112,6 @@ public class IrisBoardManager implements BoardProvider, Listener {
|
|||||||
int y = player.getLocation().getBlockY();
|
int y = player.getLocation().getBlockY();
|
||||||
int z = player.getLocation().getBlockZ();
|
int z = player.getLocation().getBlockZ();
|
||||||
|
|
||||||
if (g.getCompound() == null) {
|
|
||||||
v.add("Loading...");
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
|
|
||||||
Engine engine = g.getCompound().getEngineForHeight(y);
|
|
||||||
if (ecl.flip()) {
|
if (ecl.flip()) {
|
||||||
energyBar.setProgress(Math.min(1000D, engine.getWorldManager().getEnergy()) / 1000D);
|
energyBar.setProgress(Math.min(1000D, engine.getWorldManager().getEnergy()) / 1000D);
|
||||||
energyBar.setTitle("Spawner Energy: " + Form.f((int) Math.min(1000D, engine.getWorldManager().getEnergy())));
|
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;
|
long memoryGuess = 0;
|
||||||
int loadedObjects = 0;
|
int loadedObjects = 0;
|
||||||
|
|
||||||
for (int i = 0; i < g.getCompound().getSize(); i++) {
|
parallaxRegions +=engine.getParallax().getRegionCount();
|
||||||
parallaxRegions += g.getCompound().getEngine(i).getParallax().getRegionCount();
|
parallaxChunks += engine.getParallax().getChunkCount();
|
||||||
parallaxChunks += g.getCompound().getEngine(i).getParallax().getChunkCount();
|
loadedObjects += engine.getData().getObjectLoader().getSize();
|
||||||
loadedObjects += g.getCompound().getData().getObjectLoader().getSize();
|
memoryGuess += engine.getData().getObjectLoader().getTotalStorage() * 225L;
|
||||||
memoryGuess += g.getCompound().getData().getObjectLoader().getTotalStorage() * 225L;
|
|
||||||
memoryGuess += parallaxChunks * 3500L;
|
memoryGuess += parallaxChunks * 3500L;
|
||||||
memoryGuess += parallaxRegions * 1700000L;
|
memoryGuess += parallaxRegions * 1700000L;
|
||||||
}
|
|
||||||
|
|
||||||
tp.put(0); // TODO: CHUNK SPEED
|
tp.put(0); // TODO: CHUNK SPEED
|
||||||
|
|
||||||
|
|
||||||
v.add("&7&m------------------");
|
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));
|
v.add(C.GREEN + "Memory Use" + C.GRAY + ": ~" + Form.memSize(memoryGuess, 0));
|
||||||
|
|
||||||
if (engine != null) {
|
if (engine != null) {
|
||||||
v.add("&7&m------------------");
|
v.add("&7&m------------------");
|
||||||
KList<IrisFeaturePositional> f = new KList<>();
|
KList<IrisFeaturePositional> f = new KList<>();
|
||||||
f.add(engine.getEngineParallax().forEachFeature(x, z));
|
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 + "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 + "Biome" + C.GRAY + ": " + engine.getBiome(x, y, z).getName());
|
||||||
v.add(C.AQUA + "Height" + C.GRAY + ": " + Math.round(engine.getHeight(x, z)));
|
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.project.loader.IrisData;
|
||||||
import com.volmit.iris.core.tools.IrisToolbelt;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
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.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
import com.volmit.iris.engine.object.common.IObjectPlacer;
|
||||||
import com.volmit.iris.engine.object.objects.IrisObject;
|
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.tile.TileData;
|
||||||
import com.volmit.iris.engine.object.trees.IrisTreeModes;
|
import com.volmit.iris.engine.object.trees.IrisTreeModes;
|
||||||
import com.volmit.iris.engine.object.trees.IrisTreeSize;
|
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.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.data.Cuboid;
|
import com.volmit.iris.util.data.Cuboid;
|
||||||
@ -82,26 +82,14 @@ public class TreeManager implements Listener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IrisAccess worldAccess = IrisToolbelt.access(event.getWorld());
|
PlatformChunkGenerator worldAccess = IrisToolbelt.access(event.getWorld());
|
||||||
if (worldAccess == null) {
|
if (worldAccess == null) {
|
||||||
Iris.debug(this.getClass().getName() + " passed it off to vanilla because could not get IrisAccess for this world");
|
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"));
|
Iris.reportError(new NullPointerException(event.getWorld().getName() + " could not be accessed despite being an Iris world"));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (worldAccess.getCompound() == null) {
|
if (!worldAccess.getEngine().getDimension().getTreeSettings().isEnabled()) {
|
||||||
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()) {
|
|
||||||
Iris.debug(this.getClass().getName() + " cancelled because tree overrides are disabled");
|
Iris.debug(this.getClass().getName() + " cancelled because tree overrides are disabled");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -166,13 +154,7 @@ public class TreeManager implements Listener {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFluidHeight() {
|
public int getFluidHeight() {
|
||||||
Engine engine;
|
return worldAccess.getEngine().getDimension().getFluidHeight();
|
||||||
if (worldAccess.getCompound().getSize() > 1) {
|
|
||||||
engine = worldAccess.getCompound().getEngine(0);
|
|
||||||
} else {
|
|
||||||
engine = (Engine) worldAccess.getCompound().getRootDimension();
|
|
||||||
}
|
|
||||||
return engine.getDimension().getFluidHeight();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -226,18 +208,18 @@ public class TreeManager implements Listener {
|
|||||||
* @param size The size of the sapling area
|
* @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.
|
* @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<>();
|
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
|
// 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));
|
placements.addAll(matchObjectPlacements(biome.getObjects(), size, type));
|
||||||
|
|
||||||
// Add more or find any in the region
|
// Add more or find any in the region
|
||||||
if (isUseAll || placements.isEmpty()) {
|
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));
|
placements.addAll(matchObjectPlacements(region.getObjects(), size, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,8 +19,8 @@
|
|||||||
package com.volmit.iris.core.edit;
|
package com.volmit.iris.core.edit;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
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.IrisAccess;
|
import com.volmit.iris.engine.framework.Engine;
|
||||||
import com.volmit.iris.engine.parallax.ParallaxAccess;
|
import com.volmit.iris.engine.parallax.ParallaxAccess;
|
||||||
import com.volmit.iris.util.collection.KList;
|
import com.volmit.iris.util.collection.KList;
|
||||||
import com.volmit.iris.util.math.BlockPosition;
|
import com.volmit.iris.util.math.BlockPosition;
|
||||||
@ -42,10 +42,10 @@ public class DustRevealer {
|
|||||||
|
|
||||||
public static void spawn(Block block, VolmitSender sender) {
|
public static void spawn(Block block, VolmitSender sender) {
|
||||||
World world = block.getWorld();
|
World world = block.getWorld();
|
||||||
IrisAccess access = IrisWorlds.access(world);
|
Engine access = IrisToolbelt.access(world).getEngine();
|
||||||
|
|
||||||
if (access != null) {
|
if (access != null) {
|
||||||
ParallaxAccess a = access.getEngineAccess(block.getY()).getParallaxAccess();
|
ParallaxAccess a = access.getParallaxAccess();
|
||||||
|
|
||||||
if (a.getObject(block.getX(), block.getY(), block.getZ()) != null) {
|
if (a.getObject(block.getX(), block.getY(), block.getZ()) != null) {
|
||||||
sender.sendMessage("Found object " + a.getObject(block.getX(), block.getY(), block.getZ()));
|
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.Iris;
|
||||||
import com.volmit.iris.core.gui.components.IrisRenderer;
|
import com.volmit.iris.core.gui.components.IrisRenderer;
|
||||||
import com.volmit.iris.core.gui.components.RenderType;
|
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.IrisComplex;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
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.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.common.IrisWorld;
|
import com.volmit.iris.engine.object.common.IrisWorld;
|
||||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||||
@ -156,11 +155,9 @@ public class VisionGUI extends JPanel implements MouseWheelListener, KeyListener
|
|||||||
|
|
||||||
public boolean updateEngine() {
|
public boolean updateEngine() {
|
||||||
if (engine.isClosed()) {
|
if (engine.isClosed()) {
|
||||||
int index = engine.getIndex();
|
|
||||||
|
|
||||||
if (world.hasRealWorld()) {
|
if (world.hasRealWorld()) {
|
||||||
try {
|
try {
|
||||||
engine = IrisWorlds.access(world.realWorld()).getCompound().getEngine(index);
|
engine = IrisToolbelt.access(world.realWorld()).getEngine();
|
||||||
return !engine.isClosed();
|
return !engine.isClosed();
|
||||||
} catch (Throwable e) {
|
} 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(() ->
|
J.a(() ->
|
||||||
createAndShowGUI(g.getCompound().getEngine(i), i, g.getCompound().getWorld()));
|
createAndShowGUI(g, i, g.getWorld()));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void mouseWheelMoved(MouseWheelEvent e) {
|
public void mouseWheelMoved(MouseWheelEvent e) {
|
||||||
|
@ -19,9 +19,9 @@
|
|||||||
package com.volmit.iris.core.link;
|
package com.volmit.iris.core.link;
|
||||||
|
|
||||||
import com.volmit.iris.Iris;
|
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.Engine;
|
||||||
import com.volmit.iris.engine.framework.IrisAccess;
|
import com.volmit.iris.engine.platform.PlatformChunkGenerator;
|
||||||
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
import me.clip.placeholderapi.expansion.PlaceholderExpansion;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.OfflinePlayer;
|
import org.bukkit.OfflinePlayer;
|
||||||
@ -51,46 +51,46 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
|||||||
@Override
|
@Override
|
||||||
public String onRequest(OfflinePlayer player, String p) {
|
public String onRequest(OfflinePlayer player, String p) {
|
||||||
Location l = null;
|
Location l = null;
|
||||||
IrisAccess a = null;
|
PlatformChunkGenerator a = null;
|
||||||
|
|
||||||
if (player.isOnline()) {
|
if (player.isOnline()) {
|
||||||
l = player.getPlayer().getLocation();
|
l = player.getPlayer().getLocation();
|
||||||
a = IrisWorlds.access(l.getWorld());
|
a = IrisToolbelt.access(l.getWorld());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (p.equalsIgnoreCase("biome_name")) {
|
if (p.equalsIgnoreCase("biome_name")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return a.getBiome(l).getName();
|
return a.getEngine().getBiome(l).getName();
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("biome_id")) {
|
} else if (p.equalsIgnoreCase("biome_id")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return a.getBiome(l).getLoadKey();
|
return a.getEngine().getBiome(l).getLoadKey();
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("biome_file")) {
|
} else if (p.equalsIgnoreCase("biome_file")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return a.getBiome(l).getLoadFile().getPath();
|
return a.getEngine().getBiome(l).getLoadFile().getPath();
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("region_name")) {
|
} else if (p.equalsIgnoreCase("region_name")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return a.getRegion(l).getName();
|
return a.getEngine().getRegion(l).getName();
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("region_id")) {
|
} else if (p.equalsIgnoreCase("region_id")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return a.getRegion(l).getLoadKey();
|
return a.getEngine().getRegion(l).getLoadKey();
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("region_file")) {
|
} else if (p.equalsIgnoreCase("region_file")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return a.getRegion(l).getLoadFile().getPath();
|
return a.getEngine().getRegion(l).getLoadFile().getPath();
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("terrain_slope")) {
|
} else if (p.equalsIgnoreCase("terrain_slope")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
return ((Engine) a.getEngineAccess(l.getBlockY()))
|
return (a.getEngine())
|
||||||
.getComplex().getSlopeStream()
|
.getComplex().getSlopeStream()
|
||||||
.get(l.getX(), l.getZ()) + "";
|
.get(l.getX(), l.getZ()) + "";
|
||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("terrain_height")) {
|
} else if (p.equalsIgnoreCase("terrain_height")) {
|
||||||
if (a != null) {
|
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")) {
|
} else if (p.equalsIgnoreCase("world_mode")) {
|
||||||
if (a != null) {
|
if (a != null) {
|
||||||
@ -102,7 +102,7 @@ public class IrisPapiExpansion extends PlaceholderExpansion {
|
|||||||
}
|
}
|
||||||
} else if (p.equalsIgnoreCase("world_speed")) {
|
} else if (p.equalsIgnoreCase("world_speed")) {
|
||||||
if (a != null) {
|
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.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
import com.volmit.iris.engine.framework.headless.HeadlessGenerator;
|
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
public class HeadlessPregenMethod implements PregeneratorMethod {
|
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.IrisSettings;
|
||||||
import com.volmit.iris.core.pregenerator.PregenListener;
|
import com.volmit.iris.core.pregenerator.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
import com.volmit.iris.core.pregenerator.PregeneratorMethod;
|
||||||
import com.volmit.iris.core.tools.IrisWorlds;
|
import com.volmit.iris.core.tools.IrisToolbelt;
|
||||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||||
import com.volmit.iris.util.math.Position2;
|
import com.volmit.iris.util.math.Position2;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ public class HybridPregenMethod implements PregeneratorMethod {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private boolean supportsHeadless(World world) {
|
private boolean supportsHeadless(World world) {
|
||||||
return IrisWorlds.access(world) != null && !IrisSettings.get().getGenerator().isDisableMCA();
|
return IrisToolbelt.access(world) != null && !IrisSettings.get().getGenerator().isDisableMCA();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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.PregenListener;
|
||||||
import com.volmit.iris.core.pregenerator.syndicate.command.*;
|
import com.volmit.iris.core.pregenerator.syndicate.command.*;
|
||||||
import com.volmit.iris.engine.framework.headless.HeadlessGenerator;
|
import com.volmit.iris.engine.platform.HeadlessGenerator;
|
||||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||||
import com.volmit.iris.util.io.IO;
|
import com.volmit.iris.util.io.IO;
|
||||||
import com.volmit.iris.util.scheduling.J;
|
import com.volmit.iris.util.scheduling.J;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
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.report.ReportType;
|
||||||
import com.volmit.iris.core.tools.IrisWorldCreator;
|
import com.volmit.iris.core.tools.IrisWorldCreator;
|
||||||
import com.volmit.iris.engine.framework.Engine;
|
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.IrisBiome;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomeMutation;
|
import com.volmit.iris.engine.object.biome.IrisBiomeMutation;
|
||||||
import com.volmit.iris.engine.object.biome.IrisBiomePaletteLayer;
|
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.objects.IrisObjectPlacement;
|
||||||
import com.volmit.iris.engine.object.regional.IrisRegion;
|
import com.volmit.iris.engine.object.regional.IrisRegion;
|
||||||
import com.volmit.iris.engine.object.spawners.IrisSpawner;
|
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.KList;
|
||||||
import com.volmit.iris.util.collection.KMap;
|
import com.volmit.iris.util.collection.KMap;
|
||||||
import com.volmit.iris.util.collection.KSet;
|
import com.volmit.iris.util.collection.KSet;
|
||||||
@ -73,124 +73,13 @@ import java.util.UUID;
|
|||||||
public class IrisProject {
|
public class IrisProject {
|
||||||
private File path;
|
private File path;
|
||||||
private String name;
|
private String name;
|
||||||
private IrisAccess activeProvider;
|
private PlatformChunkGenerator activeProvider;
|
||||||
|
|
||||||
public IrisProject(File path) {
|
public IrisProject(File path) {
|
||||||
this.path = path;
|
this.path = path;
|
||||||
this.name = path.getName();
|
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() {
|
public boolean isOpen() {
|
||||||
return activeProvider != null;
|
return activeProvider != null;
|
||||||
}
|
}
|
||||||
@ -226,31 +115,6 @@ public class IrisProject {
|
|||||||
|
|
||||||
boolean hasError = false;
|
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) {
|
if (hasError) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -318,7 +182,7 @@ public class IrisProject {
|
|||||||
.studioMode()
|
.studioMode()
|
||||||
.create();
|
.create();
|
||||||
|
|
||||||
IrisAccess gx = ((IrisAccess) c.generator());
|
PlatformChunkGenerator gx = ((PlatformChunkGenerator) c.generator());
|
||||||
O<Boolean> done = new O<>();
|
O<Boolean> done = new O<>();
|
||||||
done.set(false);
|
done.set(false);
|
||||||
activeProvider = gx;
|
activeProvider = gx;
|
||||||
@ -328,23 +192,17 @@ public class IrisProject {
|
|||||||
double last = 0;
|
double last = 0;
|
||||||
int req = 400;
|
int req = 400;
|
||||||
|
|
||||||
while (gx.getGenerated() < req) {
|
while (gx.getEngine().getGenerated() < req) {
|
||||||
assert gx != null;
|
assert gx != null;
|
||||||
double v = (double) gx.getGenerated() / (double) req;
|
double v = (double) gx.getEngine().getGenerated() / (double) req;
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
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);
|
J.sleep(50);
|
||||||
} else {
|
} 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);
|
J.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gx.isFailing()) {
|
|
||||||
|
|
||||||
sender.sendMessage("Generation Failed!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (sender.isPlayer()) {
|
if (sender.isPlayer()) {
|
||||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
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.IrisSettings;
|
||||||
import com.volmit.iris.core.pregenerator.PregenTask;
|
import com.volmit.iris.core.pregenerator.PregenTask;
|
||||||
import com.volmit.iris.engine.framework.IrisAccess;
|
import com.volmit.iris.engine.object.common.HeadlessWorld;
|
||||||
import com.volmit.iris.engine.framework.headless.HeadlessWorld;
|
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
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.IrisException;
|
||||||
import com.volmit.iris.util.exceptions.MissingDimensionException;
|
import com.volmit.iris.util.exceptions.MissingDimensionException;
|
||||||
import com.volmit.iris.util.format.C;
|
import com.volmit.iris.util.format.C;
|
||||||
@ -92,9 +93,9 @@ public class IrisCreator {
|
|||||||
* @return the IrisAccess
|
* @return the IrisAccess
|
||||||
* @throws IrisException shit happens
|
* @throws IrisException shit happens
|
||||||
*/
|
*/
|
||||||
public IrisAccess create() throws IrisException {
|
public PlatformChunkGenerator create() throws IrisException {
|
||||||
IrisDimension d = IrisToolbelt.getDimension(dimension());
|
IrisDimension d = IrisToolbelt.getDimension(dimension());
|
||||||
IrisAccess access = null;
|
PlatformChunkGenerator access = null;
|
||||||
Consumer<Double> prog = (pxx) -> {
|
Consumer<Double> prog = (pxx) -> {
|
||||||
double px = pxx;
|
double px = pxx;
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ public class IrisCreator {
|
|||||||
|
|
||||||
if (headless) {
|
if (headless) {
|
||||||
HeadlessWorld w = new HeadlessWorld(name, d, seed, studio);
|
HeadlessWorld w = new HeadlessWorld(name, d, seed, studio);
|
||||||
access = w.generate().getGenerator();
|
access = w.generate();
|
||||||
} else {
|
} else {
|
||||||
O<Boolean> done = new O<>();
|
O<Boolean> done = new O<>();
|
||||||
done.set(false);
|
done.set(false);
|
||||||
@ -127,33 +128,27 @@ public class IrisCreator {
|
|||||||
.seed(seed)
|
.seed(seed)
|
||||||
.studio(studio)
|
.studio(studio)
|
||||||
.create();
|
.create();
|
||||||
access = (IrisAccess) wc.generator();
|
access = (PlatformChunkGenerator) wc.generator();
|
||||||
IrisAccess finalAccess1 = access;
|
PlatformChunkGenerator finalAccess1 = access;
|
||||||
|
|
||||||
J.a(() ->
|
J.a(() ->
|
||||||
{
|
{
|
||||||
int req = 400;
|
int req = 400;
|
||||||
|
|
||||||
while (finalAccess1.getGenerated() < req && !done.get()) {
|
while (finalAccess1.getEngine().getGenerated() < req && !done.get()) {
|
||||||
double v = (double) finalAccess1.getGenerated() / (double) req;
|
double v = (double) finalAccess1.getEngine().getGenerated() / (double) req;
|
||||||
|
|
||||||
if (pregen != null) {
|
if (pregen != null) {
|
||||||
v /= 2;
|
v /= 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
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);
|
J.sleep(50);
|
||||||
} else {
|
} 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);
|
J.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalAccess1.isFailing()) {
|
|
||||||
|
|
||||||
sender.sendMessage("Generation Failed!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
||||||
@ -186,7 +181,7 @@ public class IrisCreator {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
IrisAccess finalAccess = access;
|
PlatformChunkGenerator finalAccess = access;
|
||||||
J.sfut(() -> {
|
J.sfut(() -> {
|
||||||
if (headless) {
|
if (headless) {
|
||||||
O<Boolean> done = new O<>();
|
O<Boolean> done = new O<>();
|
||||||
@ -196,29 +191,23 @@ public class IrisCreator {
|
|||||||
{
|
{
|
||||||
int req = 400;
|
int req = 400;
|
||||||
|
|
||||||
while (finalAccess.getGenerated() < req && !done.get()) {
|
while (finalAccess.getEngine().getGenerated() < req && !done.get()) {
|
||||||
double v = (double) finalAccess.getGenerated() / (double) req;
|
double v = (double) finalAccess.getEngine().getGenerated() / (double) req;
|
||||||
v = (v / 2) + 0.5;
|
v = (v / 2) + 0.5;
|
||||||
|
|
||||||
if (sender.isPlayer()) {
|
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);
|
J.sleep(50);
|
||||||
} else {
|
} 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);
|
J.sleep(1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finalAccess.isFailing()) {
|
|
||||||
|
|
||||||
sender.sendMessage("Generation Failed!");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
sender.player().spigot().sendMessage(ChatMessageType.ACTION_BAR, TextComponent.fromLegacyText(C.WHITE + "Generation Complete"));
|
||||||
});
|
});
|
||||||
|
|
||||||
finalAccess.getHeadlessGenerator().getWorld().load();
|
((HeadlessGenerator)finalAccess).getWorld().load();
|
||||||
done.set(true);
|
done.set(true);
|
||||||
}
|
}
|
||||||
}).get();
|
}).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.HeadlessPregenMethod;
|
||||||
import com.volmit.iris.core.pregenerator.methods.HybridPregenMethod;
|
import com.volmit.iris.core.pregenerator.methods.HybridPregenMethod;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
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.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 com.volmit.iris.util.plugin.VolmitSender;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -80,7 +82,11 @@ public class IrisToolbelt {
|
|||||||
* @return true if it is an Iris Access world
|
* @return true if it is an Iris Access world
|
||||||
*/
|
*/
|
||||||
public static boolean isIrisWorld(World 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
|
* @param world the given world
|
||||||
* @return the IrisAccess or null if it's not an Iris World
|
* @return the IrisAccess or null if it's not an Iris World
|
||||||
*/
|
*/
|
||||||
public static IrisAccess access(World world) {
|
public static PlatformChunkGenerator access(World world) {
|
||||||
return IrisWorlds.access(world);
|
if (isIrisWorld(world)) {
|
||||||
|
return ((PlatformChunkGenerator) world.getGenerator());
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -109,15 +119,15 @@ public class IrisToolbelt {
|
|||||||
* otherwise Hybrid mode is used.
|
* otherwise Hybrid mode is used.
|
||||||
*
|
*
|
||||||
* @param task the scheduled task
|
* @param task the scheduled task
|
||||||
* @param access the Iris Generator
|
* @param gen the Iris Generator
|
||||||
* @return the pregenerator job (already started)
|
* @return the pregenerator job (already started)
|
||||||
*/
|
*/
|
||||||
public static PregeneratorJob pregenerate(PregenTask task, IrisAccess access) {
|
public static PregeneratorJob pregenerate(PregenTask task, PlatformChunkGenerator gen) {
|
||||||
if (access.isHeadless()) {
|
if (gen.isHeadless()) {
|
||||||
return pregenerate(task, new HeadlessPregenMethod(access.getHeadlessGenerator().getWorld(), access.getHeadlessGenerator()));
|
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
|
* @param world the world to evac
|
||||||
*/
|
*/
|
||||||
public static void evacuate(World world) {
|
public static boolean evacuate(World world) {
|
||||||
IrisWorlds.evacuate(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;
|
package com.volmit.iris.core.tools;
|
||||||
|
|
||||||
|
import com.sun.jna.Platform;
|
||||||
import com.volmit.iris.core.project.loader.IrisData;
|
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.common.IrisWorld;
|
||||||
import com.volmit.iris.engine.object.dimensional.IrisDimension;
|
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.World;
|
||||||
import org.bukkit.WorldCreator;
|
import org.bukkit.WorldCreator;
|
||||||
|
import org.bukkit.generator.ChunkGenerator;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
@ -77,15 +80,18 @@ public class IrisWorldCreator {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public WorldCreator create() {
|
public WorldCreator create() {
|
||||||
EngineCompositeGenerator g = new EngineCompositeGenerator(dimensionName, !studio);
|
IrisWorld w = IrisWorld.builder()
|
||||||
g.initialize(IrisWorld.builder()
|
|
||||||
.name(name)
|
.name(name)
|
||||||
.minHeight(minHeight)
|
.minHeight(minHeight)
|
||||||
.maxHeight(maxHeight)
|
.maxHeight(maxHeight)
|
||||||
.seed(seed)
|
.seed(seed)
|
||||||
.worldFolder(new File(name))
|
.worldFolder(new File(name))
|
||||||
.environment(findEnvironment())
|
.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)
|
return new WorldCreator(name)
|
||||||
.environment(findEnvironment())
|
.environment(findEnvironment())
|
||||||
.generateStructures(true)
|
.generateStructures(true)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user