mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2025-07-18 18:23:06 +00:00
Error Test
This commit is contained in:
parent
7e08f495a7
commit
f0a89e99f5
@ -561,6 +561,25 @@ public class Iris extends VolmitPlugin implements Listener {
|
|||||||
return IrisSettings.get().getGenerator().isMcaPregenerator();
|
return IrisSettings.get().getGenerator().isMcaPregenerator();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void reportErrorChunk(int x, int z, Throwable e) {
|
||||||
|
if (IrisSettings.get().getGeneral().isDebug()) {
|
||||||
|
File f = instance.getDataFile("debug", "chunk-errors", "chunk."+ x + "." + z + ".txt");
|
||||||
|
|
||||||
|
if (!f.exists()) {
|
||||||
|
J.attempt(() -> {
|
||||||
|
PrintWriter pw = new PrintWriter(f);
|
||||||
|
pw.println("Thread: " + Thread.currentThread().getName());
|
||||||
|
pw.println("First: " + new Date(M.ms()));
|
||||||
|
e.printStackTrace(pw);
|
||||||
|
pw.close();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
Iris.debug("Chunk " + x + "," + z + " Exception Logged: " + e.getClass().getSimpleName() + ": " + C.RESET + "" + C.LIGHT_PURPLE + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static synchronized void reportError(Throwable e) {
|
public static synchronized void reportError(Throwable e) {
|
||||||
if (IrisSettings.get().getGeneral().isDebug()) {
|
if (IrisSettings.get().getGeneral().isDebug()) {
|
||||||
String n = e.getClass().getCanonicalName() + "-" + e.getStackTrace()[0].getClassName() + "-" + e.getStackTrace()[0].getLineNumber();
|
String n = e.getClass().getCanonicalName() + "-" + e.getStackTrace()[0].getClassName() + "-" + e.getStackTrace()[0].getLineNumber();
|
||||||
|
@ -71,6 +71,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
|
|
||||||
public class EngineCompositeGenerator extends ChunkGenerator implements IrisAccess {
|
public class EngineCompositeGenerator extends ChunkGenerator implements IrisAccess {
|
||||||
|
private static final BlockData ERROR_BLOCK = Material.RED_GLAZED_TERRACOTTA.createBlockData();
|
||||||
private final AtomicReference<EngineCompound> compound = new AtomicReference<>();
|
private final AtomicReference<EngineCompound> compound = new AtomicReference<>();
|
||||||
private final AtomicBoolean initialized;
|
private final AtomicBoolean initialized;
|
||||||
private final String dimensionQuery;
|
private final String dimensionQuery;
|
||||||
@ -448,23 +449,46 @@ public class EngineCompositeGenerator extends ChunkGenerator implements IrisAcce
|
|||||||
@NotNull
|
@NotNull
|
||||||
@Override
|
@Override
|
||||||
public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) {
|
public ChunkData generateChunkData(@NotNull World world, @NotNull Random ignored, int x, int z, @NotNull BiomeGrid biome) {
|
||||||
PrecisionStopwatch ps = PrecisionStopwatch.start();
|
try
|
||||||
TerrainChunk tc = TerrainChunk.create(world, biome);
|
{
|
||||||
IrisWorld ww = (getComposite() == null || getComposite().getWorld() == null) ? IrisWorld.fromWorld(world) : getComposite().getWorld();
|
PrecisionStopwatch ps = PrecisionStopwatch.start();
|
||||||
generateChunkRawData(ww, x, z, tc).run();
|
TerrainChunk tc = TerrainChunk.create(world, biome);
|
||||||
|
IrisWorld ww = (getComposite() == null || getComposite().getWorld() == null) ? IrisWorld.fromWorld(world) : getComposite().getWorld();
|
||||||
|
generateChunkRawData(ww, x, z, tc).run();
|
||||||
|
|
||||||
if (!getComposite().getWorld().hasRealWorld()) {
|
if (!getComposite().getWorld().hasRealWorld()) {
|
||||||
getComposite().getWorld().bind(world);
|
getComposite().getWorld().bind(world);
|
||||||
|
}
|
||||||
|
|
||||||
|
generated++;
|
||||||
|
ps.end();
|
||||||
|
|
||||||
|
if (IrisSettings.get().getGeneral().isDebug()) {
|
||||||
|
Iris.debug("Chunk " + C.GREEN + x + "," + z + C.LIGHT_PURPLE + " in " + C.YELLOW + Form.duration(ps.getMillis(), 2) + C.LIGHT_PURPLE + " Rate: " + C.BLUE + Form.f(getGeneratedPerSecond(), 0) + "/s");
|
||||||
|
}
|
||||||
|
|
||||||
|
return tc.getRaw();
|
||||||
}
|
}
|
||||||
|
|
||||||
generated++;
|
catch(Throwable e)
|
||||||
ps.end();
|
{
|
||||||
|
Iris.error("======================================");
|
||||||
|
e.printStackTrace();
|
||||||
|
Iris.reportErrorChunk(x, z, e);
|
||||||
|
Iris.error("======================================");
|
||||||
|
|
||||||
if (IrisSettings.get().getGeneral().isDebug()) {
|
ChunkData d = Bukkit.createChunkData(world);
|
||||||
Iris.debug("Chunk " + C.GREEN + x + "," + z + C.LIGHT_PURPLE + " in " + C.YELLOW + Form.duration(ps.getMillis(), 2) + C.LIGHT_PURPLE + " Rate: " + C.BLUE + Form.f(getGeneratedPerSecond(), 0) + "/s");
|
|
||||||
|
for(int i = 0; i < 16; i++)
|
||||||
|
{
|
||||||
|
for(int j = 0; j < 16; j++)
|
||||||
|
{
|
||||||
|
d.setBlock(i, 0, j, ERROR_BLOCK);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
return tc.getRaw();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void assignHeadlessGenerator(HeadlessGenerator headlessGenerator) {
|
public void assignHeadlessGenerator(HeadlessGenerator headlessGenerator) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user