more typos
This commit is contained in:
+2
-2
@@ -2,7 +2,7 @@ This mod adds a Level Of Detail (LOD) system to Minecraft.
|
||||
This implementation renders simplified chunks outside the normal render distance
|
||||
allowing for an increased view distance without harming performance.
|
||||
|
||||
Or in other words: this mod let's you see farther without turning your game into a slide show.
|
||||
Or in other words: this mod lets you see farther without turning your game into a slide show.
|
||||
If you want to see a quick demo, check out the video I made here:
|
||||
https://youtu.be/CCT-3s02tYA
|
||||
|
||||
@@ -63,7 +63,7 @@ Other commands
|
||||
Note to self
|
||||
============
|
||||
|
||||
The Minecraft source code is NOT added to your workspace in a editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes only.
|
||||
The Minecraft source code is NOT added to your workspace in an editable way. Minecraft is treated like a normal Library. Sources are there for documentation and research purposes only.
|
||||
|
||||
Source code uses Mojang mappings.
|
||||
|
||||
|
||||
@@ -468,13 +468,13 @@ public class LodBufferBuilder
|
||||
|
||||
// if the memory required is greater than the max buffer
|
||||
// capacity, divide the memory across multiple buffers
|
||||
if (regionMemoryRequired > LodUtil.MAX_ALOCATEABLE_DIRECT_MEMORY)
|
||||
if (regionMemoryRequired > LodUtil.MAX_ALLOCATABLE_DIRECT_MEMORY)
|
||||
{
|
||||
numberOfBuffers = (int) Math.ceil(regionMemoryRequired / LodUtil.MAX_ALOCATEABLE_DIRECT_MEMORY) + 1;
|
||||
numberOfBuffers = (int) Math.ceil(regionMemoryRequired / LodUtil.MAX_ALLOCATABLE_DIRECT_MEMORY) + 1;
|
||||
|
||||
// TODO shouldn't this be determined with regionMemoryRequired?
|
||||
// always allocating the max memory is a bit expensive isn't it?
|
||||
regionMemoryRequired = LodUtil.MAX_ALOCATEABLE_DIRECT_MEMORY;
|
||||
regionMemoryRequired = LodUtil.MAX_ALLOCATABLE_DIRECT_MEMORY;
|
||||
numberOfBuffersPerRegion[x][z] = numberOfBuffers;
|
||||
buildableBuffers[x][z] = new BufferBuilder[numberOfBuffers];
|
||||
buildableVbos[x][z] = new VertexBuffer[numberOfBuffers];
|
||||
|
||||
@@ -23,7 +23,7 @@ import com.seibel.lod.enums.DistanceGenerationMode;
|
||||
/**
|
||||
* This is used to easily configure how LodChunks are generated.
|
||||
* Generally this will only be used if we want to generate a
|
||||
* LodChunk using a incomplete Chunk, otherwise the defaults
|
||||
* LodChunk using an incomplete Chunk, otherwise the defaults
|
||||
* work best for a fully generated chunk (IE has correct surface blocks).
|
||||
*
|
||||
* @author James Seibel
|
||||
@@ -74,7 +74,6 @@ public class LodBuilderConfig
|
||||
* @param newUseHeightmap default = false
|
||||
* @param newUseBiomeColors default = false
|
||||
* @param newUseSolidBlocksInBiomeColor default = true
|
||||
* @param newDistanceGenerationMode default = Server
|
||||
*/
|
||||
public LodBuilderConfig(boolean newUseHeightmap, boolean newUseBiomeColors, boolean newUseSolidBlocksInBiomeColor)
|
||||
{
|
||||
@@ -86,9 +85,6 @@ public class LodBuilderConfig
|
||||
}
|
||||
|
||||
/**
|
||||
* @param newUseHeightmap default = false
|
||||
* @param newUseBiomeColors default = false
|
||||
* @param newUseSolidBlocksInBiomeColor default = true
|
||||
* @param newDistanceGenerationMode default = Server
|
||||
*/
|
||||
public LodBuilderConfig(DistanceGenerationMode newDistanceGenerationMode)
|
||||
|
||||
@@ -248,7 +248,7 @@ public class LodNodeGenWorker implements IWorker
|
||||
|
||||
// generate the terrain (this is thread safe)
|
||||
ChunkStatus.EMPTY.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ServerWorldLightManager) serverWorld.getLightEngine(), null, chunkList);
|
||||
// override the chunk status so we can run the next generator stage
|
||||
// override the chunk status, so we can run the next generator stage
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk);
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
@@ -336,7 +336,7 @@ public class LodNodeGenWorker implements IWorker
|
||||
{
|
||||
// if we are in the end, don't generate any chunks.
|
||||
// Since we don't know where the islands are, everything
|
||||
// generates the same and it looks really bad.
|
||||
// generates the same, and it looks awful.
|
||||
lodBuilder.generateLodNodeFromChunk(lodDim, chunk, new LodBuilderConfig(true, true, false));
|
||||
}
|
||||
|
||||
@@ -363,13 +363,13 @@ public class LodNodeGenWorker implements IWorker
|
||||
|
||||
// generate the terrain (this is thread safe)
|
||||
ChunkStatus.EMPTY.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ServerWorldLightManager) serverWorld.getLightEngine(), null, chunkList);
|
||||
// override the chunk status so we can run the next generator stage
|
||||
// override the chunk status, so we can run the next generator stage
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk);
|
||||
ChunkStatus.NOISE.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ServerWorldLightManager) serverWorld.getLightEngine(), null, chunkList);
|
||||
ChunkStatus.SURFACE.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ServerWorldLightManager) serverWorld.getLightEngine(), null, chunkList);
|
||||
|
||||
// this feature has been proven to be thread safe
|
||||
// this feature has been proven to be thread safe,
|
||||
// so we will add it
|
||||
IceAndSnowFeature snowFeature = new IceAndSnowFeature(NoFeatureConfig.CODEC);
|
||||
snowFeature.place(lodServerWorld, chunkGen, serverWorld.random, chunk.getPos().getWorldPosition(), null);
|
||||
@@ -400,7 +400,7 @@ public class LodNodeGenWorker implements IWorker
|
||||
|
||||
// generate the terrain (this is thread safe)
|
||||
ChunkStatus.EMPTY.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ServerWorldLightManager) serverWorld.getLightEngine(), null, chunkList);
|
||||
// override the chunk status so we can run the next generator stage
|
||||
// override the chunk status, so we can run the next generator stage
|
||||
chunk.setStatus(ChunkStatus.STRUCTURE_REFERENCES);
|
||||
chunkGen.createBiomes(serverWorld.registryAccess().registryOrThrow(Registry.BIOME_REGISTRY), chunk);
|
||||
ChunkStatus.NOISE.generate(serverWorld, chunkGen, serverWorld.getStructureManager(), (ServerWorldLightManager) serverWorld.getLightEngine(), null, chunkList);
|
||||
@@ -456,7 +456,7 @@ public class LodNodeGenWorker implements IWorker
|
||||
catch (ConcurrentModificationException e)
|
||||
{
|
||||
// This will happen. I'm not sure what to do about it
|
||||
// except pray that it doesn't effect the normal world generation
|
||||
// except pray that it doesn't affect the normal world generation
|
||||
// in any harmful way.
|
||||
// Update: this can cause crashes and high CPU usage.
|
||||
|
||||
@@ -554,7 +554,7 @@ public class LodNodeGenWorker implements IWorker
|
||||
}
|
||||
else
|
||||
{
|
||||
// ClientProxy.LOGGER.debug("unkown decorated placement config: \"" + config.decorator.config().getClass() + "\"");
|
||||
// ClientProxy.LOGGER.debug("unknown decorated placement config: \"" + config.decorator.config().getClass() + "\"");
|
||||
return config;
|
||||
}
|
||||
|
||||
@@ -604,14 +604,14 @@ public class LodNodeGenWorker implements IWorker
|
||||
|
||||
/**
|
||||
* Stops the current genThreads if they are running
|
||||
* and then recreates the Executer service. <br><br>
|
||||
* and then recreates the Executor service. <br><br>
|
||||
*
|
||||
* This is done to clear any outstanding tasks
|
||||
* that may exist after the player leaves their current world.
|
||||
* If this isn't done unfinished tasks may be left in the queue
|
||||
* preventing new LodChunks form being generated.
|
||||
*/
|
||||
public static void restartExecuterService()
|
||||
public static void restartExecutorService()
|
||||
{
|
||||
if (genThreads != null && !genThreads.isShutdown())
|
||||
{
|
||||
@@ -648,6 +648,6 @@ public class LodNodeGenWorker implements IWorker
|
||||
At this point I would suggest using FEATURES, as it generates snow and trees
|
||||
(and any other object that is needed to make biomes distinct)
|
||||
|
||||
Otherwise if snow/trees aren't necessary SURFACE is the next fastest (although not by much)
|
||||
Otherwise, if snow/trees aren't necessary SURFACE is the next fastest (although not by much)
|
||||
*/
|
||||
}
|
||||
|
||||
@@ -39,10 +39,10 @@ public class LodWorldGenerator
|
||||
private boolean generatorThreadRunning = false;
|
||||
|
||||
/**
|
||||
* How many chunks to generate outside of the player's view distance at one
|
||||
* How many chunks to generate outside the player's view distance at one
|
||||
* time. (or more specifically how many requests to make at one time). I
|
||||
* multiply by 8 to make sure there is always a buffer of chunk requests, to
|
||||
* make sure the CPU is always busy and we can generate LODs as quickly as
|
||||
* make sure the CPU is always busy, and we can generate LODs as quickly as
|
||||
* possible.
|
||||
*/
|
||||
public int maxChunkGenRequests;
|
||||
@@ -77,7 +77,7 @@ public class LodWorldGenerator
|
||||
{
|
||||
if (LodConfig.CLIENT.worldGenerator.distanceGenerationMode.get() != DistanceGenerationMode.NONE
|
||||
&& !generatorThreadRunning
|
||||
&& mc.hasSingleplayerServer())
|
||||
&& mc.hasSinglePlayerServer())
|
||||
{
|
||||
// the thread is now running, don't queue up another thread
|
||||
generatorThreadRunning = true;
|
||||
@@ -115,7 +115,7 @@ public class LodWorldGenerator
|
||||
for (int i = 0; i < posToGenerate.getNumberOfPos(); i++)
|
||||
{
|
||||
// I wish there was a way to compress this code, but I'm not aware of
|
||||
// a easy way to do so.
|
||||
// an easy way to do so.
|
||||
|
||||
// add the near positions
|
||||
if (posToGenerate.getNthDetail(nearIndex, true) != 0 && nearIndex < posToGenerate.getNumberOfNearPos())
|
||||
|
||||
@@ -17,8 +17,6 @@
|
||||
*/
|
||||
package com.seibel.lod.enums;
|
||||
|
||||
import net.minecraftforge.common.ForgeConfigSpec;
|
||||
|
||||
/**
|
||||
* Near_First <br>
|
||||
* Far_First <br>
|
||||
@@ -37,13 +35,13 @@ public enum BufferRebuildTimes
|
||||
RARE(5000, 2000, 10000);
|
||||
|
||||
public int playerMoveTimeout;
|
||||
public int renderdChunkTimeout;
|
||||
public int renderedChunkTimeout;
|
||||
public int chunkChangeTimeout;
|
||||
|
||||
BufferRebuildTimes(int playerMoveTimeout, int renderdChunkTimeout, int chunkChangeTimeout)
|
||||
BufferRebuildTimes(int playerMoveTimeout, int renderedChunkTimeout, int chunkChangeTimeout)
|
||||
{
|
||||
this.playerMoveTimeout = playerMoveTimeout;
|
||||
this.renderdChunkTimeout = renderdChunkTimeout;
|
||||
this.renderedChunkTimeout = renderedChunkTimeout;
|
||||
this.chunkChangeTimeout = chunkChangeTimeout;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,6 +30,6 @@ public enum DetailDropOff
|
||||
/** quality is determined per-region, using the lowest quality that would be used in BY_CHUNK */
|
||||
FAST,
|
||||
|
||||
/** quality is determined per-block (best quality option, may cause stuttering when moving) */
|
||||
/** quality is determined per-block (the best quality option, may cause stuttering when moving) */
|
||||
FANCY,
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ package com.seibel.lod.enums;
|
||||
* Medium <br>
|
||||
* High <br>
|
||||
* <br>
|
||||
* this indicate the base of the quadratic function we use for the quality drop off
|
||||
* this indicates the base of the quadratic function we use for the quality drop off
|
||||
*
|
||||
* @author Leonardo Amato
|
||||
* @version 9-29-2021
|
||||
|
||||
@@ -51,7 +51,7 @@ public enum HorizontalResolution
|
||||
BLOCK(16, 0);
|
||||
|
||||
/** How many DataPoints should
|
||||
* be drawn per side per LodChunk */
|
||||
* be drawn per side, per LodChunk */
|
||||
public final int dataPointLengthCount;
|
||||
|
||||
/** How wide each LOD DataPoint is */
|
||||
@@ -155,8 +155,8 @@ public enum HorizontalResolution
|
||||
public static HorizontalResolution getDetailForDistance(HorizontalResolution maxDetailLevel, int distance, int maxDistance)
|
||||
{
|
||||
HorizontalResolution[] lowerDetails = getSelfAndLowerDetails(maxDetailLevel);
|
||||
int distaneBetweenDetails = maxDistance / lowerDetails.length;
|
||||
int index = LodUtil.clamp(0, distance / distaneBetweenDetails, lowerDetails.length - 1);
|
||||
int distanceBetweenDetails = maxDistance / lowerDetails.length;
|
||||
int index = LodUtil.clamp(0, distance / distanceBetweenDetails, lowerDetails.length - 1);
|
||||
|
||||
return lowerDetails[index];
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ public interface LevelContainer
|
||||
{
|
||||
/**With this you can add data to the level container
|
||||
*
|
||||
* @param data actual data to add in a array of long format.
|
||||
* @param data actual data to add in an array of long format.
|
||||
* @param posX x position in the detail level
|
||||
* @param posZ z position in the detail level
|
||||
* @param index z position in the detail level
|
||||
@@ -14,7 +14,7 @@ public interface LevelContainer
|
||||
|
||||
/**With this you can add data to the level container
|
||||
*
|
||||
* @param data actual data to add in a array of long format.
|
||||
* @param data actual data to add in an array of long format.
|
||||
* @param posX x position in the detail level
|
||||
* @param posZ z position in the detail level
|
||||
* @return true if correctly added, false otherwise
|
||||
@@ -45,7 +45,7 @@ public interface LevelContainer
|
||||
boolean doesItExist(int posX, int posZ);
|
||||
|
||||
/**
|
||||
* @return return the deatilLevel of this level container
|
||||
* @return return the detailLevel of this level container
|
||||
*/
|
||||
byte getDetailLevel();
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public class LodDimension
|
||||
try
|
||||
{
|
||||
File saveDir;
|
||||
if (mc.hasSingleplayerServer())
|
||||
if (mc.hasSinglePlayerServer())
|
||||
{
|
||||
// local world
|
||||
|
||||
|
||||
@@ -230,7 +230,7 @@ public class ClientProxy
|
||||
public void worldLoadEvent(WorldEvent.Load event)
|
||||
{
|
||||
DataPointUtil.worldHeight = event.getWorld().getHeight();
|
||||
//LodNodeGenWorker.restartExecuterService();
|
||||
//LodNodeGenWorker.restartExecutorService();
|
||||
//ThreadMapUtil.clearMaps();
|
||||
|
||||
// the player just loaded a new world/dimension
|
||||
@@ -254,7 +254,7 @@ public class ClientProxy
|
||||
|
||||
// if this isn't done unfinished tasks may be left in the queue
|
||||
// preventing new LodChunks form being generated
|
||||
//LodNodeGenWorker.restartExecuterService();
|
||||
//LodNodeGenWorker.restartExecutorService();
|
||||
//ThreadMapUtil.clearMaps();
|
||||
|
||||
LodWorldGenerator.INSTANCE.numberOfChunksWaitingToGenerate.set(0);
|
||||
@@ -379,7 +379,7 @@ public class ClientProxy
|
||||
private void resetMod()
|
||||
{
|
||||
ThreadMapUtil.clearMaps();
|
||||
LodNodeGenWorker.restartExecuterService();
|
||||
LodNodeGenWorker.restartExecutorService();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -816,7 +816,7 @@ public class LodRenderer
|
||||
|
||||
|
||||
// check if the vanilla rendered chunks changed
|
||||
if (newTime - prevVanillaChunkTime > LodConfig.CLIENT.buffers.rebuildTimes.get().renderdChunkTimeout)
|
||||
if (newTime - prevVanillaChunkTime > LodConfig.CLIENT.buffers.rebuildTimes.get().renderedChunkTimeout)
|
||||
{
|
||||
if (vanillaRenderedChunksChanged)
|
||||
{
|
||||
|
||||
@@ -137,7 +137,7 @@ public class LodUtil
|
||||
* <p>
|
||||
* https://stackoverflow.com/questions/50499238/bytebuffer-allocatedirect-and-xmx
|
||||
*/
|
||||
public static final int MAX_ALOCATEABLE_DIRECT_MEMORY = 64 * 1024 * 1024;
|
||||
public static final int MAX_ALLOCATABLE_DIRECT_MEMORY = 64 * 1024 * 1024;
|
||||
|
||||
|
||||
public static final VertexFormat LOD_VERTEX_FORMAT = DefaultVertexFormats.POSITION_COLOR;
|
||||
@@ -153,10 +153,10 @@ public class LodUtil
|
||||
*/
|
||||
public static ServerWorld getFirstValidServerWorld()
|
||||
{
|
||||
if (mc.hasSingleplayerServer())
|
||||
if (mc.hasSinglePlayerServer())
|
||||
return null;
|
||||
|
||||
Iterable<ServerWorld> worlds = mc.getSingleplayerServer().getAllLevels();
|
||||
Iterable<ServerWorld> worlds = mc.getSinglePlayerServer().getAllLevels();
|
||||
|
||||
for (ServerWorld world : worlds)
|
||||
return world;
|
||||
@@ -171,7 +171,7 @@ public class LodUtil
|
||||
*/
|
||||
public static ServerWorld getServerWorldFromDimension(DimensionType dimension)
|
||||
{
|
||||
IntegratedServer server = mc.getSingleplayerServer();
|
||||
IntegratedServer server = mc.getSinglePlayerServer();
|
||||
if (server == null)
|
||||
return null;
|
||||
|
||||
@@ -236,7 +236,7 @@ public class LodUtil
|
||||
*/
|
||||
public static String getWorldID(IWorld world)
|
||||
{
|
||||
if (mc.hasSingleplayerServer())
|
||||
if (mc.hasSinglePlayerServer())
|
||||
{
|
||||
// chop off the dimension ID as it is not needed/wanted
|
||||
String dimId = getDimensionIDFromWorld(world);
|
||||
@@ -264,7 +264,7 @@ public class LodUtil
|
||||
*/
|
||||
public static String getDimensionIDFromWorld(IWorld world)
|
||||
{
|
||||
if (mc.hasSingleplayerServer())
|
||||
if (mc.hasSinglePlayerServer())
|
||||
{
|
||||
// this will return the world save location
|
||||
// and the dimension folder
|
||||
|
||||
@@ -55,9 +55,9 @@ public class MinecraftWrapper
|
||||
* This should be called at the beginning of every frame to
|
||||
* clear any Minecraft data that becomes out of date after a frame. <br> <br>
|
||||
*
|
||||
* Lightmaps and other time sensitive objects fall in this category. <br> <br>
|
||||
* LightMaps and other time sensitive objects fall in this category. <br> <br>
|
||||
*
|
||||
* This doesn't effect OpenGL objects in any way.
|
||||
* This doesn't affect OpenGL objects in any way.
|
||||
*/
|
||||
public void clearFrameObjectCache()
|
||||
{
|
||||
@@ -75,7 +75,7 @@ public class MinecraftWrapper
|
||||
return mc.level.getShade(Direction.UP, true);
|
||||
}
|
||||
|
||||
public boolean hasSingleplayerServer()
|
||||
public boolean hasSinglePlayerServer()
|
||||
{
|
||||
return mc.hasSingleplayerServer();
|
||||
}
|
||||
@@ -131,7 +131,7 @@ public class MinecraftWrapper
|
||||
{
|
||||
if (lightMap == null)
|
||||
{
|
||||
// make sure the lightMap is up to date
|
||||
// make sure the lightMap is up-to-date
|
||||
getCurrentLightMap();
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ public class MinecraftWrapper
|
||||
return mc.level.getSkyDarken(partialTicks);
|
||||
}
|
||||
|
||||
public IntegratedServer getSingleplayerServer()
|
||||
public IntegratedServer getSinglePlayerServer()
|
||||
{
|
||||
return mc.getSingleplayerServer();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user