Merge remote-tracking branch 'origin/1.16.5' into 1.16.5
This commit is contained in:
@@ -37,8 +37,10 @@ import com.seibel.lod.objects.LodDimension;
|
||||
import com.seibel.lod.proxy.ClientProxy;
|
||||
import com.seibel.lod.util.LodUtil;
|
||||
|
||||
import com.seibel.lod.wrappers.MinecraftWrapper;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.world.ClientWorld;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.util.palette.UpgradeData;
|
||||
import net.minecraft.util.registry.Registry;
|
||||
@@ -183,13 +185,13 @@ public class LodNodeGenWorker implements IWorker
|
||||
/* TODO I must disable this 'if', if I will find a way to replace it */
|
||||
if (lodDim.regionIsInRange(pos.x / LodUtil.REGION_WIDTH_IN_CHUNKS, pos.z / LodUtil.REGION_WIDTH_IN_CHUNKS))
|
||||
{
|
||||
IChunk loadedChunk = null;
|
||||
// long startTime = System.currentTimeMillis();
|
||||
//if(LodConfig.CLIENT.worldGenerator.alwaysLoadPregeneratedChunks.get())
|
||||
// loadedChunk = ChunkLoader.getChunkFromFile(pos);
|
||||
//loadedChunk = ChunkLoader.getChunkFromFile(pos);
|
||||
if(loadedChunk == null)
|
||||
{
|
||||
|
||||
//if(loadedChunk != null)
|
||||
//{
|
||||
// lodBuilder.generateLodNodeFromChunk(lodDim, loadedChunk, new LodBuilderConfig(DistanceGenerationMode.SERVER));
|
||||
//}
|
||||
//else
|
||||
//{
|
||||
switch (generationMode)
|
||||
{
|
||||
case NONE:
|
||||
@@ -213,11 +215,7 @@ public class LodNodeGenWorker implements IWorker
|
||||
generateWithServer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, loadedChunk, new LodBuilderConfig(DistanceGenerationMode.SERVER));
|
||||
}
|
||||
//}
|
||||
|
||||
//lodRenderer.regenerateLODsNextFrame();
|
||||
|
||||
|
||||
@@ -375,7 +375,7 @@ public class LodConfig
|
||||
+ " \n"
|
||||
+ " The maximum value is the number of logical processors on your CPU. \n"
|
||||
+ " Requires a restart to take effect. \n")
|
||||
.defineInRange("numberOfWorldGenerationThreads", Runtime.getRuntime().availableProcessors() / 2, 1, Runtime.getRuntime().availableProcessors());
|
||||
.defineInRange("numberOfWorldGenerationThreads", Math.max(1,Runtime.getRuntime().availableProcessors() / 2), 1, Runtime.getRuntime().availableProcessors());
|
||||
|
||||
numberOfBufferBuilderThreads = builder
|
||||
.comment("\n\n"
|
||||
@@ -386,7 +386,7 @@ public class LodConfig
|
||||
+ " \n"
|
||||
+ " The maximum value is the number of logical processors on your CPU. \n"
|
||||
+ " Requires a restart to take effect. \n")
|
||||
.defineInRange("numberOfBufferBuilderThreads", Runtime.getRuntime().availableProcessors(), 1, Runtime.getRuntime().availableProcessors());
|
||||
.defineInRange("numberOfBufferBuilderThreads", Math.max(1,Runtime.getRuntime().availableProcessors() / 2), 1, Runtime.getRuntime().availableProcessors());
|
||||
|
||||
builder.pop();
|
||||
}
|
||||
|
||||
@@ -8,6 +8,14 @@ import com.seibel.lod.util.DataPointUtil;
|
||||
import com.seibel.lod.util.DetailDistanceUtil;
|
||||
import com.seibel.lod.util.LevelPosUtil;
|
||||
import com.seibel.lod.util.LodUtil;
|
||||
import com.seibel.lod.wrappers.MinecraftWrapper;
|
||||
import net.minecraft.util.math.ChunkPos;
|
||||
import net.minecraft.world.chunk.storage.RegionFile;
|
||||
import net.minecraft.world.server.ServerChunkProvider;
|
||||
import net.minecraft.world.server.ServerWorld;
|
||||
import org.lwjgl.system.CallbackI;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This object holds all loaded LevelContainers acting as a quad tree
|
||||
@@ -37,6 +45,11 @@ public class LodRegion
|
||||
*/
|
||||
private final LevelContainer[] dataContainer;
|
||||
|
||||
/**
|
||||
* This chunk Pos has been generated
|
||||
*/
|
||||
//private final boolean[] preGeneratedChunkPos;
|
||||
|
||||
/**
|
||||
* the generation mode for this region
|
||||
*/
|
||||
@@ -55,15 +68,6 @@ public class LodRegion
|
||||
*/
|
||||
public final int regionPosZ;
|
||||
|
||||
|
||||
public LodRegion(RegionPos regionPos)
|
||||
{
|
||||
this.minDetailLevel = LodUtil.REGION_DETAIL_LEVEL;
|
||||
this.regionPosX = regionPos.x;
|
||||
this.regionPosZ = regionPos.z;
|
||||
dataContainer = new LevelContainer[POSSIBLE_LOD];
|
||||
}
|
||||
|
||||
public LodRegion(byte minDetailLevel, RegionPos regionPos, DistanceGenerationMode generationMode, VerticalQuality verticalQuality)
|
||||
{
|
||||
this.minDetailLevel = minDetailLevel;
|
||||
@@ -79,9 +83,50 @@ public class LodRegion
|
||||
{
|
||||
dataContainer[lod] = new VerticalLevelContainer(lod);
|
||||
}
|
||||
|
||||
/*boolean fileFound = false;
|
||||
|
||||
preGeneratedChunkPos = new boolean[32*32];
|
||||
|
||||
if (MinecraftWrapper.INSTANCE.hasSinglePlayerServer())
|
||||
{
|
||||
File regionFileDirParent;
|
||||
File regionFileDirHead;
|
||||
// local world
|
||||
|
||||
ServerWorld serverWorld = LodUtil.getServerWorldFromDimension(MinecraftWrapper.INSTANCE.getCurrentDimension());
|
||||
|
||||
// provider needs a separate variable to prevent
|
||||
// the compiler from complaining
|
||||
ServerChunkProvider provider = serverWorld.getChunkSource();
|
||||
regionFileDirParent = new File(provider.dataStorage.dataFolder.getParentFile().getPath() + File.separatorChar + "region");
|
||||
regionFileDirHead = new File("r." + regionPosZ + "." + regionPosX + ".mca");
|
||||
try{
|
||||
RegionFile regionFile = new RegionFile(regionFileDirParent, regionFileDirHead, true);
|
||||
for(int x = 0; x < 32; x++)
|
||||
{
|
||||
for(int z = 0; z < 32; z++)
|
||||
{
|
||||
preGeneratedChunkPos[x*32 + z] = regionFile.hasChunk(new ChunkPos(regionPosX*32 + x, regionPosZ*32 + z));
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder string = new StringBuilder();
|
||||
string.append("region " + regionPosX + " " + regionPosZ + "\n");
|
||||
for(int x = 0; x < 32; x++)
|
||||
{
|
||||
for(int z = 0; z < 32; z++)
|
||||
{
|
||||
string.append(preGeneratedChunkPos[x*32 + z] + "\t");
|
||||
}
|
||||
string.append("\n");
|
||||
}
|
||||
System.out.println(string);*/
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Inserts the data point into the region.
|
||||
* <p>
|
||||
|
||||
Reference in New Issue
Block a user