Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a314f0fe79 | |||
| d8091ab62a |
@@ -33,6 +33,7 @@ import com.seibel.lod.builders.lodBuilding.LodBuilder;
|
|||||||
import com.seibel.lod.builders.lodBuilding.LodBuilderConfig;
|
import com.seibel.lod.builders.lodBuilding.LodBuilderConfig;
|
||||||
import com.seibel.lod.config.LodConfig;
|
import com.seibel.lod.config.LodConfig;
|
||||||
import com.seibel.lod.enums.DistanceGenerationMode;
|
import com.seibel.lod.enums.DistanceGenerationMode;
|
||||||
|
import com.seibel.lod.handlers.ChunkLoader;
|
||||||
import com.seibel.lod.objects.LodDimension;
|
import com.seibel.lod.objects.LodDimension;
|
||||||
import com.seibel.lod.proxy.ClientProxy;
|
import com.seibel.lod.proxy.ClientProxy;
|
||||||
import com.seibel.lod.util.LodUtil;
|
import com.seibel.lod.util.LodUtil;
|
||||||
@@ -190,9 +191,8 @@ public class LodGenWorker implements IWorker
|
|||||||
//}
|
//}
|
||||||
//else
|
//else
|
||||||
//{
|
//{
|
||||||
/*
|
|
||||||
IChunk loadedChunk = null;
|
IChunk loadedChunk = null;
|
||||||
if (lodDim.isChunkPreGenerated(pos.x, pos.z) && LodConfig.CLIENT.worldGenerator.useExperimentalPreGenLoading.get())
|
if (LodConfig.CLIENT.advancedModOptions.debugging.usePregen.get() && lodDim.isChunkPreGenerated(pos.x, pos.z))
|
||||||
{
|
{
|
||||||
// generate a Lod like normal
|
// generate a Lod like normal
|
||||||
loadedChunk = ChunkLoader.getChunkFromFile(pos);
|
loadedChunk = ChunkLoader.getChunkFromFile(pos);
|
||||||
@@ -227,7 +227,7 @@ public class LodGenWorker implements IWorker
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{*/
|
{
|
||||||
switch (generationMode)
|
switch (generationMode)
|
||||||
{
|
{
|
||||||
case NONE:
|
case NONE:
|
||||||
@@ -251,7 +251,7 @@ public class LodGenWorker implements IWorker
|
|||||||
generateWithServer();
|
generateWithServer();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//}
|
}
|
||||||
|
|
||||||
//lodRenderer.regenerateLODsNextFrame();
|
//lodRenderer.regenerateLODsNextFrame();
|
||||||
|
|
||||||
|
|||||||
@@ -135,7 +135,7 @@ public class LodWorldGenerator
|
|||||||
// an easy way to do so.
|
// an easy way to do so.
|
||||||
|
|
||||||
// add the near positions
|
// add the near positions
|
||||||
if (posToGenerate.getNthDetail(nearIndex, true) != 0 && nearIndex < posToGenerate.getNumberOfNearPos())
|
if (nearIndex < posToGenerate.getNumberOfNearPos() && posToGenerate.getNthDetail(nearIndex, true) != 0)
|
||||||
{
|
{
|
||||||
detailLevel = (byte) (posToGenerate.getNthDetail(nearIndex, true) - 1);
|
detailLevel = (byte) (posToGenerate.getNthDetail(nearIndex, true) - 1);
|
||||||
posX = posToGenerate.getNthPosX(nearIndex, true);
|
posX = posToGenerate.getNthPosX(nearIndex, true);
|
||||||
@@ -160,7 +160,7 @@ public class LodWorldGenerator
|
|||||||
|
|
||||||
|
|
||||||
// add the far positions
|
// add the far positions
|
||||||
if (posToGenerate.getNthDetail(farIndex, false) != 0 && farIndex < posToGenerate.getNumberOfFarPos())
|
if (farIndex < posToGenerate.getNumberOfFarPos() && posToGenerate.getNthDetail(farIndex, false) != 0)
|
||||||
{
|
{
|
||||||
detailLevel = (byte) (posToGenerate.getNthDetail(farIndex, false) - 1);
|
detailLevel = (byte) (posToGenerate.getNthDetail(farIndex, false) - 1);
|
||||||
posX = posToGenerate.getNthPosX(farIndex, false);
|
posX = posToGenerate.getNthPosX(farIndex, false);
|
||||||
|
|||||||
@@ -480,12 +480,18 @@ public class LodConfig
|
|||||||
{
|
{
|
||||||
public final ForgeConfigSpec.BooleanValue drawLods;
|
public final ForgeConfigSpec.BooleanValue drawLods;
|
||||||
public final ForgeConfigSpec.EnumValue<DebugMode> debugMode;
|
public final ForgeConfigSpec.EnumValue<DebugMode> debugMode;
|
||||||
|
public final ForgeConfigSpec.BooleanValue usePregen;
|
||||||
public final ForgeConfigSpec.BooleanValue enableDebugKeybindings;
|
public final ForgeConfigSpec.BooleanValue enableDebugKeybindings;
|
||||||
|
|
||||||
Debugging(ForgeConfigSpec.Builder builder)
|
Debugging(ForgeConfigSpec.Builder builder)
|
||||||
{
|
{
|
||||||
builder.comment("These settings can be used to look for bugs, or see how certain aspects of the mod work.").push(this.getClass().getSimpleName());
|
builder.comment("These settings can be used to look for bugs, or see how certain aspects of the mod work.").push(this.getClass().getSimpleName());
|
||||||
|
|
||||||
|
usePregen = builder
|
||||||
|
.comment("\n\n"
|
||||||
|
+ " if true the game will use pregen when possible \n")
|
||||||
|
.define("Use Pregen", false);
|
||||||
|
|
||||||
drawLods = builder
|
drawLods = builder
|
||||||
.comment("\n\n"
|
.comment("\n\n"
|
||||||
+ " If true, the mod is enabled and fake chunks will be drawn. \n"
|
+ " If true, the mod is enabled and fake chunks will be drawn. \n"
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ import com.seibel.lod.enums.DistanceGenerationMode;
|
|||||||
import com.seibel.lod.enums.GenerationPriority;
|
import com.seibel.lod.enums.GenerationPriority;
|
||||||
import com.seibel.lod.enums.VerticalQuality;
|
import com.seibel.lod.enums.VerticalQuality;
|
||||||
import com.seibel.lod.handlers.LodDimensionFileHandler;
|
import com.seibel.lod.handlers.LodDimensionFileHandler;
|
||||||
|
import com.seibel.lod.proxy.ClientProxy;
|
||||||
import com.seibel.lod.util.DataPointUtil;
|
import com.seibel.lod.util.DataPointUtil;
|
||||||
import com.seibel.lod.util.DetailDistanceUtil;
|
import com.seibel.lod.util.DetailDistanceUtil;
|
||||||
import com.seibel.lod.util.LevelPosUtil;
|
import com.seibel.lod.util.LevelPosUtil;
|
||||||
@@ -602,6 +603,9 @@ public class LodDimension
|
|||||||
//if(lodRegion.isChunkPreGenerated(xChunkToCheck,zChunkToCheck))
|
//if(lodRegion.isChunkPreGenerated(xChunkToCheck,zChunkToCheck))
|
||||||
// complexity = DistanceGenerationMode.SERVER.complexity;
|
// complexity = DistanceGenerationMode.SERVER.complexity;
|
||||||
//else
|
//else
|
||||||
|
if(LodConfig.CLIENT.advancedModOptions.debugging.usePregen.get() && isChunkPreGenerated(xChunkToCheck, zChunkToCheck))
|
||||||
|
complexity = DistanceGenerationMode.SERVER.complexity;
|
||||||
|
else
|
||||||
complexity = LodConfig.CLIENT.worldGenerator.distanceGenerationMode.get().complexity;
|
complexity = LodConfig.CLIENT.worldGenerator.distanceGenerationMode.get().complexity;
|
||||||
|
|
||||||
|
|
||||||
@@ -817,15 +821,15 @@ public class LodDimension
|
|||||||
/**
|
/**
|
||||||
* Return true if the chunk has been pregenerated in game
|
* Return true if the chunk has been pregenerated in game
|
||||||
*/
|
*/
|
||||||
//public boolean isChunkPreGenerated(int xChunkPos, int zChunkPos)
|
public boolean isChunkPreGenerated(int xChunkPos, int zChunkPos)
|
||||||
//{
|
{
|
||||||
//
|
|
||||||
// LodRegion region = getRegion(LodUtil.CHUNK_DETAIL_LEVEL, xChunkPos, zChunkPos);
|
LodRegion region = getRegion(LodUtil.CHUNK_DETAIL_LEVEL, xChunkPos, zChunkPos);
|
||||||
// if (region == null)
|
if (region == null)
|
||||||
// return false;
|
return false;
|
||||||
//
|
|
||||||
// return region.isChunkPreGenerated(xChunkPos, zChunkPos);
|
return region.isChunkPreGenerated(xChunkPos, zChunkPos);
|
||||||
//}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether the region at the given RegionPos
|
* Returns whether the region at the given RegionPos
|
||||||
|
|||||||
@@ -25,6 +25,13 @@ import com.seibel.lod.util.DataPointUtil;
|
|||||||
import com.seibel.lod.util.DetailDistanceUtil;
|
import com.seibel.lod.util.DetailDistanceUtil;
|
||||||
import com.seibel.lod.util.LevelPosUtil;
|
import com.seibel.lod.util.LevelPosUtil;
|
||||||
import com.seibel.lod.util.LodUtil;
|
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 java.io.File;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This object holds all loaded LevelContainers acting as a quad tree
|
* This object holds all loaded LevelContainers acting as a quad tree
|
||||||
@@ -58,7 +65,7 @@ public class LodRegion
|
|||||||
/**
|
/**
|
||||||
* This chunk Pos has been generated
|
* This chunk Pos has been generated
|
||||||
*/
|
*/
|
||||||
//private final boolean[] preGeneratedChunkPos;
|
private final boolean[] preGeneratedChunkPos;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* the generation mode for this region
|
* the generation mode for this region
|
||||||
@@ -96,9 +103,9 @@ public class LodRegion
|
|||||||
|
|
||||||
boolean fileFound = false;
|
boolean fileFound = false;
|
||||||
|
|
||||||
/*
|
|
||||||
preGeneratedChunkPos = new boolean[32 * 32];
|
preGeneratedChunkPos = new boolean[32 * 32];
|
||||||
if (MinecraftWrapper.INSTANCE.hasSinglePlayerServer() && LodConfig.CLIENT.worldGenerator.useExperimentalPreGenLoading.get())
|
if (MinecraftWrapper.INSTANCE.hasSinglePlayerServer())
|
||||||
{
|
{
|
||||||
File regionFileDirHead;
|
File regionFileDirHead;
|
||||||
File regionFileDirParent;
|
File regionFileDirParent;
|
||||||
@@ -108,7 +115,7 @@ public class LodRegion
|
|||||||
|
|
||||||
// provider needs a separate variable to prevent
|
// provider needs a separate variable to prevent
|
||||||
// the compiler from complaining
|
// the compiler from complaining
|
||||||
StringBuilder string = new StringBuilder();
|
//StringBuilder string = new StringBuilder();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
ServerChunkProvider provider = serverWorld.getChunkSource();
|
ServerChunkProvider provider = serverWorld.getChunkSource();
|
||||||
@@ -119,7 +126,7 @@ public class LodRegion
|
|||||||
{
|
{
|
||||||
regionFileDirParent = regionFileDirHead.getParentFile();
|
regionFileDirParent = regionFileDirHead.getParentFile();
|
||||||
//string.append(regionFileDirParent.toString());
|
//string.append(regionFileDirParent.toString());
|
||||||
string.append(regionFileDirHead);
|
//string.append(regionFileDirHead);
|
||||||
RegionFile regionFile = new RegionFile(regionFileDirHead, regionFileDirParent, true);
|
RegionFile regionFile = new RegionFile(regionFileDirHead, regionFileDirParent, true);
|
||||||
for (int x = 0; x < 32; x++)
|
for (int x = 0; x < 32; x++)
|
||||||
{
|
{
|
||||||
@@ -129,7 +136,7 @@ public class LodRegion
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string.append("region " + regionPosX + " " + regionPosZ + "\n");
|
/*string.append("region " + regionPosX + " " + regionPosZ + "\n");
|
||||||
for (int x = 0; x < 32; x++)
|
for (int x = 0; x < 32; x++)
|
||||||
{
|
{
|
||||||
for (int z = 0; z < 32; z++)
|
for (int z = 0; z < 32; z++)
|
||||||
@@ -137,8 +144,8 @@ public class LodRegion
|
|||||||
//regionFile.doesChunkExist()
|
//regionFile.doesChunkExist()
|
||||||
string.append(preGeneratedChunkPos[x * 32 + z] + "\t");
|
string.append(preGeneratedChunkPos[x * 32 + z] + "\t");
|
||||||
}
|
}
|
||||||
string.append("\n");
|
//string.append("\n");
|
||||||
}
|
}*/
|
||||||
regionFile.close();
|
regionFile.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -146,8 +153,8 @@ public class LodRegion
|
|||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
System.out.println(string);
|
//System.out.println(string);
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -155,12 +162,12 @@ public class LodRegion
|
|||||||
/**
|
/**
|
||||||
* Return true if the chunk has been pregenerated in game
|
* Return true if the chunk has been pregenerated in game
|
||||||
*/
|
*/
|
||||||
//public boolean isChunkPreGenerated(int xChunkPos, int zChunkPos)
|
public boolean isChunkPreGenerated(int xChunkPos, int zChunkPos)
|
||||||
//{
|
{
|
||||||
// xChunkPos = LevelPosUtil.getRegionModule(LodUtil.CHUNK_DETAIL_LEVEL, xChunkPos);
|
xChunkPos = LevelPosUtil.getRegionModule(LodUtil.CHUNK_DETAIL_LEVEL, xChunkPos);
|
||||||
// zChunkPos = LevelPosUtil.getRegionModule(LodUtil.CHUNK_DETAIL_LEVEL, zChunkPos);
|
zChunkPos = LevelPosUtil.getRegionModule(LodUtil.CHUNK_DETAIL_LEVEL, zChunkPos);
|
||||||
// return preGeneratedChunkPos[xChunkPos * 32 + zChunkPos];
|
return preGeneratedChunkPos[xChunkPos * 32 + zChunkPos];
|
||||||
//}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Inserts the data point into the region.
|
* Inserts the data point into the region.
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
|
|
||||||
package com.seibel.lod.proxy;
|
package com.seibel.lod.proxy;
|
||||||
|
|
||||||
|
import net.minecraft.client.entity.player.ClientPlayerEntity;
|
||||||
|
import net.minecraft.util.text.TextComponent;
|
||||||
import org.apache.logging.log4j.LogManager;
|
import org.apache.logging.log4j.LogManager;
|
||||||
import org.apache.logging.log4j.Logger;
|
import org.apache.logging.log4j.Logger;
|
||||||
import org.lwjgl.glfw.GLFW;
|
import org.lwjgl.glfw.GLFW;
|
||||||
@@ -299,6 +301,17 @@ public class ClientProxy
|
|||||||
{
|
{
|
||||||
LodConfig.CLIENT.advancedModOptions.debugging.drawLods.set(!LodConfig.CLIENT.advancedModOptions.debugging.drawLods.get());
|
LodConfig.CLIENT.advancedModOptions.debugging.drawLods.set(!LodConfig.CLIENT.advancedModOptions.debugging.drawLods.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (LodConfig.CLIENT.advancedModOptions.debugging.enableDebugKeybindings.get()
|
||||||
|
&& event.getKey() == GLFW.GLFW_KEY_F7 && event.getAction() == GLFW.GLFW_PRESS)
|
||||||
|
{
|
||||||
|
LodConfig.CLIENT.advancedModOptions.debugging.usePregen.set(!LodConfig.CLIENT.advancedModOptions.debugging.usePregen.get());
|
||||||
|
ClientPlayerEntity player = MinecraftWrapper.INSTANCE.getPlayer();
|
||||||
|
if(LodConfig.CLIENT.advancedModOptions.debugging.usePregen.get())
|
||||||
|
player.sendMessage(new StringTextComponent("pregen activated."),player.getUUID());
|
||||||
|
else
|
||||||
|
player.sendMessage(new StringTextComponent("pregen de-activated."),player.getUUID());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user