Updated generation comments

This commit is contained in:
coolGi2007
2021-12-13 12:33:04 +00:00
parent 56e74a15ba
commit ed41a7e449
2 changed files with 12 additions and 19 deletions
@@ -23,6 +23,10 @@ public class VersionConstants implements IVersionConstants {
@Override
public boolean isWorldGeneratorSingleThreaded(DistanceGenerationMode distanceGenerationMode) {
// We are always asking the server to generate the chunk,
// so no use running this stuff multithreaded.
return true;
/*
switch (distanceGenerationMode) {
default:
case NONE:
@@ -35,5 +39,6 @@ public class VersionConstants implements IVersionConstants {
case FULL:
return true;
}
*/
}
}
@@ -26,18 +26,6 @@ import net.minecraft.world.level.chunk.*;
*/
public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
{
//private static final ILodConfigWrapperSingleton CONFIG = SingletonHandler.get(ILodConfigWrapperSingleton.class);
/**
* If a configured feature fails for whatever reason,
* add it to this list. This will hopefully remove any
* features that could cause issues down the line.
*/
//private static final ConcurrentHashMap<Integer, ConfiguredFeature<?, ?>> FEATURES_TO_AVOID = new ConcurrentHashMap<>();
//private static ExecutorService Executor = Executors.newSingleThreadExecutor();
public final ServerLevel serverWorld;
public final LodDimension lodDim;
public final LodBuilder lodBuilder;
@@ -71,8 +59,6 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
/**
* takes about 15 - 20 ms
* <p>
* Causes concurrentModification Exceptions,
* which could cause instability or world generation bugs
*/
@Override
public void generateFeatures(AbstractChunkPosWrapper pos)
@@ -100,7 +86,7 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
private void generate(int chunkX, int chunkZ, DistanceGenerationMode generationMode) {
long t = System.nanoTime();
// long t = System.nanoTime();
ChunkStatus targetStatus;
switch (generationMode) {
@@ -125,14 +111,16 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
return;
}
// The bool=true means that we wants to generate chunk, and that the returned ChunkAccess must not be null
ChunkAccess ca = serverWorld.getChunkSource().getChunk(chunkX, chunkZ, targetStatus, true);
if (ca == null) throw new RuntimeException("This should NEVER be null due to bool being true");
lodBuilder.generateLodNodeFromChunk(lodDim, new ChunkWrapper(ca), new LodBuilderConfig(generationMode));
long duration = System.nanoTime()-t;
System.out.println("LodChunkGenFull["+chunkX+","+chunkZ+"]: "+(double)(duration)/1000.);
// long duration = System.nanoTime()-t;
// Debug print the duration
// System.out.println("LodChunkGenFull["+chunkX+","+chunkZ+"]: "+(double)(duration)/1000.);
}
@@ -141,7 +129,7 @@ public class WorldGeneratorWrapper extends AbstractWorldGeneratorWrapper
/*
/* TODO: Ask leetom to update chart
* performance/generation tests related to
* serverWorld.getChunk(x, z, ChunkStatus. *** )