diff --git a/Readme.txt b/Readme.txt index 90bd5e270..9a81815d4 100644 --- a/Readme.txt +++ b/Readme.txt @@ -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. diff --git a/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilder.java b/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilder.java index 91e3f4b10..ed68d44d8 100644 --- a/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilder.java +++ b/src/main/java/com/seibel/lod/builders/bufferBuilding/LodBufferBuilder.java @@ -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]; diff --git a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilderConfig.java b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilderConfig.java index 32d099eda..d4b2d58d8 100644 --- a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilderConfig.java +++ b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilderConfig.java @@ -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) diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java index 1678bc50d..0038455fa 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodNodeGenWorker.java @@ -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.

+ * and then recreates the Executor service.

* * 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) */ } diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java index 1d2242354..192e33837 100644 --- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java +++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodWorldGenerator.java @@ -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()) diff --git a/src/main/java/com/seibel/lod/enums/BufferRebuildTimes.java b/src/main/java/com/seibel/lod/enums/BufferRebuildTimes.java index 026c6b17f..c89129fef 100644 --- a/src/main/java/com/seibel/lod/enums/BufferRebuildTimes.java +++ b/src/main/java/com/seibel/lod/enums/BufferRebuildTimes.java @@ -17,8 +17,6 @@ */ package com.seibel.lod.enums; -import net.minecraftforge.common.ForgeConfigSpec; - /** * Near_First
* Far_First
@@ -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; } } diff --git a/src/main/java/com/seibel/lod/enums/DetailDropOff.java b/src/main/java/com/seibel/lod/enums/DetailDropOff.java index 19ea60a32..b09ad34f4 100644 --- a/src/main/java/com/seibel/lod/enums/DetailDropOff.java +++ b/src/main/java/com/seibel/lod/enums/DetailDropOff.java @@ -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, } diff --git a/src/main/java/com/seibel/lod/enums/HorizontalQuality.java b/src/main/java/com/seibel/lod/enums/HorizontalQuality.java index 733d963a1..930cc0ec2 100644 --- a/src/main/java/com/seibel/lod/enums/HorizontalQuality.java +++ b/src/main/java/com/seibel/lod/enums/HorizontalQuality.java @@ -22,7 +22,7 @@ package com.seibel.lod.enums; * Medium
* High
*
- * 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 diff --git a/src/main/java/com/seibel/lod/enums/HorizontalResolution.java b/src/main/java/com/seibel/lod/enums/HorizontalResolution.java index 2853eee78..8382993cf 100644 --- a/src/main/java/com/seibel/lod/enums/HorizontalResolution.java +++ b/src/main/java/com/seibel/lod/enums/HorizontalResolution.java @@ -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]; diff --git a/src/main/java/com/seibel/lod/objects/LevelContainer.java b/src/main/java/com/seibel/lod/objects/LevelContainer.java index 4eb1f048f..0d1c83820 100644 --- a/src/main/java/com/seibel/lod/objects/LevelContainer.java +++ b/src/main/java/com/seibel/lod/objects/LevelContainer.java @@ -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(); diff --git a/src/main/java/com/seibel/lod/objects/LodDimension.java b/src/main/java/com/seibel/lod/objects/LodDimension.java index f699176e1..2cbf2f8a1 100644 --- a/src/main/java/com/seibel/lod/objects/LodDimension.java +++ b/src/main/java/com/seibel/lod/objects/LodDimension.java @@ -104,7 +104,7 @@ public class LodDimension try { File saveDir; - if (mc.hasSingleplayerServer()) + if (mc.hasSinglePlayerServer()) { // local world diff --git a/src/main/java/com/seibel/lod/proxy/ClientProxy.java b/src/main/java/com/seibel/lod/proxy/ClientProxy.java index 8721af8f3..b68e817e9 100644 --- a/src/main/java/com/seibel/lod/proxy/ClientProxy.java +++ b/src/main/java/com/seibel/lod/proxy/ClientProxy.java @@ -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(); } diff --git a/src/main/java/com/seibel/lod/render/LodRenderer.java b/src/main/java/com/seibel/lod/render/LodRenderer.java index 141b4307d..f62ade283 100644 --- a/src/main/java/com/seibel/lod/render/LodRenderer.java +++ b/src/main/java/com/seibel/lod/render/LodRenderer.java @@ -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) { diff --git a/src/main/java/com/seibel/lod/util/LodUtil.java b/src/main/java/com/seibel/lod/util/LodUtil.java index df04fa522..a3f203bd6 100644 --- a/src/main/java/com/seibel/lod/util/LodUtil.java +++ b/src/main/java/com/seibel/lod/util/LodUtil.java @@ -137,7 +137,7 @@ public class LodUtil *

* 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 worlds = mc.getSingleplayerServer().getAllLevels(); + Iterable 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 diff --git a/src/main/java/com/seibel/lod/wrappers/MinecraftWrapper.java b/src/main/java/com/seibel/lod/wrappers/MinecraftWrapper.java index 0a47d81d7..95bf657b8 100644 --- a/src/main/java/com/seibel/lod/wrappers/MinecraftWrapper.java +++ b/src/main/java/com/seibel/lod/wrappers/MinecraftWrapper.java @@ -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.

* - * Lightmaps and other time sensitive objects fall in this category.

+ * LightMaps and other time sensitive objects fall in this category.

* - * 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(); }