* Causes concurrentModification Exceptions, * which could cause instability or world generation bugs */ @@ -506,9 +507,9 @@ public class LodNodeGenWorker implements IWorker /** * on pre generated chunks 0 - 1 ms * on un generated chunks 0 - 50 ms - * with the median seeming to hover around 15 - 30 ms - * and outliers in the 100 - 200 ms range - * + * with the median seeming to hover around 15 - 30 ms + * and outliers in the 100 - 200 ms range + *
* Note this should not be multithreaded and does cause server/simulation lag
* (Higher lag for generating than loading)
*/
@@ -606,7 +607,7 @@ public class LodNodeGenWorker implements IWorker
/**
* Stops the current genThreads if they are running
* 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
diff --git a/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java b/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java
index 686b9d659..835641937 100644
--- a/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java
+++ b/src/main/java/com/seibel/lod/builders/worldGeneration/LodServerWorld.java
@@ -15,16 +15,10 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* In order of fastest to slowest.
- *
* @author James Seibel
* @author Leonardo Amato
* @version 8-7-2021
@@ -37,7 +37,7 @@ public enum DistanceGenerationMode
* Don't generate anything
*/
NONE((byte) 0),
-
+
/**
* Only generate the biomes and use biome
* grass/foliage color, water color, or ice color
@@ -46,7 +46,7 @@ public enum DistanceGenerationMode
* Multithreaded - Fastest (2-5 ms)
*/
BIOME_ONLY((byte) 1),
-
+
/**
* Same as BIOME_ONLY, except instead
* of always using sea level as the LOD height
@@ -54,7 +54,7 @@ public enum DistanceGenerationMode
* use predetermined heights to simulate having height data.
*/
BIOME_ONLY_SIMULATE_HEIGHT((byte) 2),
-
+
/**
* Generate the world surface,
* this does NOT include caves, trees,
@@ -62,7 +62,7 @@ public enum DistanceGenerationMode
* Multithreaded - Faster (10-20 ms)
*/
SURFACE((byte) 3),
-
+
/**
* Generate everything except structures.
* NOTE: This may cause world generation bugs or instability,
@@ -70,7 +70,7 @@ public enum DistanceGenerationMode
* Multithreaded - Fast (15-20 ms)
*/
FEATURES((byte) 4),
-
+
/**
* Ask the server to generate/load each chunk.
* This is the most compatible, but causes server/simulation lag.
@@ -79,13 +79,13 @@ public enum DistanceGenerationMode
* Singlethreaded - Slow (15-50 ms, with spikes up to 200 ms)
*/
SERVER((byte) 5);
-
-
+
+
/**
* The higher the number the more complete the generation is.
*/
public final byte complexity;
-
+
DistanceGenerationMode(byte complexity)
{
this.complexity = complexity;
diff --git a/src/main/java/com/seibel/lod/enums/FogDistance.java b/src/main/java/com/seibel/lod/enums/FogDistance.java
index 96baf7b72..cc9afce05 100644
--- a/src/main/java/com/seibel/lod/enums/FogDistance.java
+++ b/src/main/java/com/seibel/lod/enums/FogDistance.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* This represents how far the LODs should overlap with
* the vanilla Minecraft terrain.
- *
* @author James Seibel
* @version 10-11-2021
*/
diff --git a/src/main/java/com/seibel/lod/enums/VerticalQuality.java b/src/main/java/com/seibel/lod/enums/VerticalQuality.java
index a709854c4..99df919c1 100644
--- a/src/main/java/com/seibel/lod/enums/VerticalQuality.java
+++ b/src/main/java/com/seibel/lod/enums/VerticalQuality.java
@@ -15,19 +15,19 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* TODO why isn't posToRender returned? it would make it a bit more clear what is happening
*/
public void getPosToRender(PosToRenderContainer posToRender, RegionPos regionPos, int playerPosX,
@@ -609,7 +601,7 @@ public class LodDimension
}
/**
- * Determines how many vertical LODs could be used
+ * Determines how many vertical LODs could be used
* for the given region at the given detail level
*/
public int getMaxVerticalData(byte detailLevel, int posX, int posZ)
@@ -688,7 +680,7 @@ public class LodDimension
/**
* TODO we aren't currently using this, is there a reason for that?
* is this significantly different than regenRegionBuffer?
- *
+ *
* Returns if the buffer at the given array index needs
* to have its buffer resized.
*/
diff --git a/src/main/java/com/seibel/lod/objects/LodRegion.java b/src/main/java/com/seibel/lod/objects/LodRegion.java
index 358a39d2c..562cb9898 100644
--- a/src/main/java/com/seibel/lod/objects/LodRegion.java
+++ b/src/main/java/com/seibel/lod/objects/LodRegion.java
@@ -16,7 +16,6 @@ import com.seibel.lod.util.LodUtil;
* Coordinate Standard:
* TODO this will always return true unless it has
- *
* @return true if the data was added successfully
*/
public boolean addData(byte detailLevel, int posX, int posZ, int verticalIndex, long data)
@@ -109,7 +107,6 @@ public class LodRegion
/**
* Get the dataPoint at the given relative position.
- *
* @return the data at the relative pos and detail level,
* 0 if the data doesn't exist.
*/
@@ -120,7 +117,6 @@ public class LodRegion
/**
* Get the dataPoint at the given relative position.
- *
* @return the data at the relative pos and detail level,
* 0 if the data doesn't exist.
*/
@@ -434,7 +430,6 @@ public class LodRegion
/**
* Returns the LevelContainer for the detailLevel
- *
* @throws IllegalArgumentException if the detailLevel is less than minDetailLevel
*/
public LevelContainer getLevel(byte detailLevel)
@@ -448,10 +443,9 @@ public class LodRegion
/**
* Add the levelContainer to this Region, updating the minDetailLevel
* if necessary.
- *
* @throws IllegalArgumentException if the LevelContainer's detailLevel
- * is 2 or more detail levels lower than the
- * minDetailLevel of this region.
+ * is 2 or more detail levels lower than the
+ * minDetailLevel of this region.
*/
public void addLevelContainer(LevelContainer levelContainer)
{
diff --git a/src/main/java/com/seibel/lod/objects/LodWorld.java b/src/main/java/com/seibel/lod/objects/LodWorld.java
index 257e9dced..6c38ef78c 100644
--- a/src/main/java/com/seibel/lod/objects/LodWorld.java
+++ b/src/main/java/com/seibel/lod/objects/LodWorld.java
@@ -26,7 +26,6 @@ import java.util.Map;
/**
* This stores all LODs for a given world.
- *
* @author James Seibel
* @author Leonardo Amato
* @version 9-27-2021
@@ -57,10 +56,9 @@ public class LodWorld
/**
* Set up the LodWorld with the given newWorldName.
* Note a System.gc() call may be in order after calling this
* Note a System.gc() call may be in order after calling this
* Sets x and z to 0
*/
public RegionPos()
@@ -69,7 +68,7 @@ public class RegionPos
public ChunkPos chunkPos()
{
return new ChunkPos(
- (x * LodUtil.REGION_WIDTH_IN_CHUNKS) + LodUtil.REGION_WIDTH_IN_CHUNKS / 2,
+ (x * LodUtil.REGION_WIDTH_IN_CHUNKS) + LodUtil.REGION_WIDTH_IN_CHUNKS / 2,
(z * LodUtil.REGION_WIDTH_IN_CHUNKS) + LodUtil.REGION_WIDTH_IN_CHUNKS / 2);
}
diff --git a/src/main/java/com/seibel/lod/objects/VerticalLevelContainer.java b/src/main/java/com/seibel/lod/objects/VerticalLevelContainer.java
index 2526b5523..fe6777612 100644
--- a/src/main/java/com/seibel/lod/objects/VerticalLevelContainer.java
+++ b/src/main/java/com/seibel/lod/objects/VerticalLevelContainer.java
@@ -1,22 +1,18 @@
package com.seibel.lod.objects;
+import com.seibel.lod.util.*;
+
import java.util.Arrays;
-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.util.ThreadMapUtil;
-
public class VerticalLevelContainer implements LevelContainer
{
-
+
public final byte detailLevel;
public final int size;
public final int maxVerticalData;
-
+
public final long[] dataContainer;
-
+
public VerticalLevelContainer(byte detailLevel)
{
this.detailLevel = detailLevel;
@@ -24,65 +20,74 @@ public class VerticalLevelContainer implements LevelContainer
maxVerticalData = DetailDistanceUtil.getMaxVerticalData(detailLevel);
dataContainer = new long[size * size * DetailDistanceUtil.getMaxVerticalData(detailLevel)];
}
-
+
@Override
public byte getDetailLevel()
{
return detailLevel;
}
-
+
@Override
- public void clear(int posX, int posZ){
-
+ public void clear(int posX, int posZ)
+ {
+
posX = LevelPosUtil.getRegionModule(detailLevel, posX);
posZ = LevelPosUtil.getRegionModule(detailLevel, posZ);
- for(int verticalIndex = 0; verticalIndex < maxVerticalData; verticalIndex++){
- dataContainer[posX*size*maxVerticalData + posZ*maxVerticalData + verticalIndex] = DataPointUtil.EMPTY_DATA;
+ for (int verticalIndex = 0; verticalIndex < maxVerticalData; verticalIndex++)
+ {
+ dataContainer[posX * size * maxVerticalData + posZ * maxVerticalData + verticalIndex] = DataPointUtil.EMPTY_DATA;
}
}
-
+
@Override
- public boolean addData(long data, int posX, int posZ, int verticalIndex){
-
+ public boolean addData(long data, int posX, int posZ, int verticalIndex)
+ {
+
posX = LevelPosUtil.getRegionModule(detailLevel, posX);
posZ = LevelPosUtil.getRegionModule(detailLevel, posZ);
- dataContainer[posX*size*maxVerticalData + posZ*maxVerticalData + verticalIndex] = data;
+ dataContainer[posX * size * maxVerticalData + posZ * maxVerticalData + verticalIndex] = data;
return true;
}
-
+
@Override
- public boolean addSingleData(long data, int posX, int posZ){
+ public boolean addSingleData(long data, int posX, int posZ)
+ {
return addData(data, posX, posZ, 0);
}
-
+
@Override
- public long getData(int posX, int posZ, int verticalIndex){
+ public long getData(int posX, int posZ, int verticalIndex)
+ {
posX = LevelPosUtil.getRegionModule(detailLevel, posX);
posZ = LevelPosUtil.getRegionModule(detailLevel, posZ);
- return dataContainer[posX*size*maxVerticalData + posZ*maxVerticalData + verticalIndex];
+ return dataContainer[posX * size * maxVerticalData + posZ * maxVerticalData + verticalIndex];
}
-
+
@Override
- public long getSingleData(int posX, int posZ){
- return getData(posX,posZ,0);
+ public long getSingleData(int posX, int posZ)
+ {
+ return getData(posX, posZ, 0);
}
-
+
@Override
- public int getMaxVerticalData(){
+ public int getMaxVerticalData()
+ {
return maxVerticalData;
}
-
- public int getSize(){
+
+ public int getSize()
+ {
return size;
}
-
+
@Override
- public boolean doesItExist(int posX, int posZ){
+ public boolean doesItExist(int posX, int posZ)
+ {
posX = LevelPosUtil.getRegionModule(detailLevel, posX);
posZ = LevelPosUtil.getRegionModule(detailLevel, posZ);
- return DataPointUtil.doesItExist(getSingleData(posX,posZ));
+ return DataPointUtil.doesItExist(getSingleData(posX, posZ));
}
-
+
public VerticalLevelContainer(byte[] inputData)
{
int tempIndex;
@@ -97,7 +102,7 @@ public class VerticalLevelContainer implements LevelContainer
size = (int) Math.pow(2, LodUtil.REGION_DETAIL_LEVEL - detailLevel);
int x = size * size * maxVerticalData;
this.dataContainer = new long[x];
- for ( int i = 0; i < x; i++)
+ for (int i = 0; i < x; i++)
{
newData = 0;
if (counter > -1)
@@ -105,15 +110,17 @@ public class VerticalLevelContainer implements LevelContainer
dataContainer[i] = last;
if (last == 3)
{ //skip rest of void chunk
- for (tempIndex = 1; tempIndex < maxVerticalData; tempIndex++) {
+ for (tempIndex = 1; tempIndex < maxVerticalData; tempIndex++)
+ {
dataContainer[i + tempIndex] = 0;
}
i += maxVerticalData - 1;
}
counter--;
- } else if ((inputData[index] & 0x3) == 0 || (inputData[index] & 0x3) == 3)
+ }
+ else if ((inputData[index] & 0x3) == 0 || (inputData[index] & 0x3) == 3)
{
- last = (byte)(inputData[index] & 0x3);
+ last = (byte) (inputData[index] & 0x3);
//recover counter
counter = (inputData[index] & 0x7c) >>> 2;
tempIndex = 0;
@@ -126,9 +133,11 @@ public class VerticalLevelContainer implements LevelContainer
index++;
//since loop expects from us to put some data in, we just make it rerun it with new counter;
i--;
- } else if (index + 7 >= inputData.length)
+ }
+ else if (index + 7 >= inputData.length)
break;
- else {
+ else
+ {
for (tempIndex = 0; tempIndex < 8; tempIndex++)
newData += (((long) inputData[index + tempIndex]) & 0xff) << (8 * tempIndex);
index = index + 8;
@@ -136,19 +145,20 @@ public class VerticalLevelContainer implements LevelContainer
}
}
}
-
+
@Override
- public LevelContainer expand(){
+ public LevelContainer expand()
+ {
return new VerticalLevelContainer((byte) (getDetailLevel() - 1));
}
-
+
@Override
public void updateData(LevelContainer lowerLevelContainer, int posX, int posZ)
{
//We reset the array
long[] dataToMerge = ThreadMapUtil.getVerticalUpdateArray(detailLevel);
-
- int lowerMaxVertical = dataToMerge.length/4;
+
+ int lowerMaxVertical = dataToMerge.length / 4;
int childPosX;
int childPosZ;
long[] data;
@@ -160,13 +170,13 @@ public class VerticalLevelContainer implements LevelContainer
{
childPosX = 2 * posX + x;
childPosZ = 2 * posZ + z;
- for(int verticalIndex = 0; verticalIndex < lowerMaxVertical; verticalIndex++)
- dataToMerge[(z*2+x)*lowerMaxVertical + verticalIndex] = lowerLevelContainer.getData(childPosX, childPosZ, verticalIndex);
+ for (int verticalIndex = 0; verticalIndex < lowerMaxVertical; verticalIndex++)
+ dataToMerge[(z * 2 + x) * lowerMaxVertical + verticalIndex] = lowerLevelContainer.getData(childPosX, childPosZ, verticalIndex);
}
}
data = DataPointUtil.mergeMultiData(dataToMerge, lowerMaxVertical, getMaxVerticalData());
- for(int verticalIndex = 0; (verticalIndex < data.length) && (verticalIndex < maxVerticalData); verticalIndex++)
+ for (int verticalIndex = 0; (verticalIndex < data.length) && (verticalIndex < maxVerticalData); verticalIndex++)
{
addData(data[verticalIndex],
posX,
@@ -174,7 +184,7 @@ public class VerticalLevelContainer implements LevelContainer
verticalIndex);
}
}
-
+
@Override
public byte[] toDataString()
{
@@ -186,12 +196,12 @@ public class VerticalLevelContainer implements LevelContainer
long current;
byte[] tempData = ThreadMapUtil.getSaveContainer(2 + (x * 8));
-
+
tempData[index] = detailLevel;
index++;
tempData[index] = (byte) maxVerticalData;
index++;
-
+
for (int i = 0; i < x; i++)
{
current = dataContainer[i];
@@ -202,21 +212,23 @@ public class VerticalLevelContainer implements LevelContainer
if (current == 3) //skip rest of void chunk
i += maxVerticalData - 1;
counter++;
- } else {
+ }
+ else
+ {
for (tempIndex = 0; tempIndex < 8; tempIndex++)
tempData[index + tempIndex] = (byte) (current >>> (8 * tempIndex));
index += 8;
}
- if (last != -1 && ( i == x - 1 || last != ((dataContainer[i + 1]) & 0b11)))
+ if (last != -1 && (i == x - 1 || last != ((dataContainer[i + 1]) & 0b11)))
{ //save compressed data if next is different or if we reached onf of the data
- tempData[index] = (byte)(0x7f & ((counter << 2) + last)); //save 5 bits of counter and compressed block
-
+ tempData[index] = (byte) (0x7f & ((counter << 2) + last)); //save 5 bits of counter and compressed block
+
tempIndex = 0;
while ((counter >>> (5 + 7 * tempIndex)) != 0) //there is more of that counter
{
- tempData[index] = (byte)(tempData[index] | 0x80); //set overflow bit to true
+ tempData[index] = (byte) (tempData[index] | 0x80); //set overflow bit to true
index++; // after setting overflow bit w can actually index++
- tempData[index] = (byte)(0x7f & (counter >>> (5 + 7 * tempIndex))); // save 7 bits of counter
+ tempData[index] = (byte) (0x7f & (counter >>> (5 + 7 * tempIndex))); // save 7 bits of counter
tempIndex++;
}
index++;
@@ -226,7 +238,7 @@ public class VerticalLevelContainer implements LevelContainer
}
return Arrays.copyOfRange(tempData, 0, index);
}
-
+
@Override
public String toString()
{
@@ -248,14 +260,16 @@ public class VerticalLevelContainer implements LevelContainer
*/
return " ";
}
-
+
@Override
- public int getMaxNumberOfLods(){
- return size*size*getMaxVerticalData();
+ public int getMaxNumberOfLods()
+ {
+ return size * size * getMaxVerticalData();
}
-
+
@Override
- public int getMaxMemoryUse(){
+ public int getMaxMemoryUse()
+ {
return getMaxNumberOfLods() * 2; //2 byte
}
}
diff --git a/src/main/java/com/seibel/lod/proxy/ClientProxy.java b/src/main/java/com/seibel/lod/proxy/ClientProxy.java
index d4728ee01..463fd9baf 100644
--- a/src/main/java/com/seibel/lod/proxy/ClientProxy.java
+++ b/src/main/java/com/seibel/lod/proxy/ClientProxy.java
@@ -18,10 +18,6 @@
package com.seibel.lod.proxy;
-import org.apache.logging.log4j.LogManager;
-import org.apache.logging.log4j.Logger;
-import org.lwjgl.glfw.GLFW;
-
import com.mojang.blaze3d.matrix.MatrixStack;
import com.seibel.lod.builders.bufferBuilding.LodBufferBuilder;
import com.seibel.lod.builders.lodBuilding.LodBuilder;
@@ -38,7 +34,6 @@ import com.seibel.lod.util.DetailDistanceUtil;
import com.seibel.lod.util.LodUtil;
import com.seibel.lod.util.ThreadMapUtil;
import com.seibel.lod.wrappers.MinecraftWrapper;
-
import net.minecraft.profiler.IProfiler;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.client.event.InputEvent;
@@ -47,11 +42,13 @@ import net.minecraftforge.event.world.BlockEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+import org.lwjgl.glfw.GLFW;
/**
* This handles all events sent to the client,
* and is the starting point for most of the mod.
- *
* @author James_Seibel
* @version 9-26-2021
*/
diff --git a/src/main/java/com/seibel/lod/proxy/GlProxy.java b/src/main/java/com/seibel/lod/proxy/GlProxy.java
index fc9e8200d..bc1bc8b3b 100644
--- a/src/main/java/com/seibel/lod/proxy/GlProxy.java
+++ b/src/main/java/com/seibel/lod/proxy/GlProxy.java
@@ -12,12 +12,10 @@ import org.lwjgl.opengl.GLCapabilities;
*
*
* Helpful OpenGL resources:
* https://www.seas.upenn.edu/~pcozzi/OpenGLInsights/OpenGLInsights-AsynchronousBufferTransfers.pdf
* LightMaps and other time sensitive objects fall in this category.
* This doesn't affect OpenGL objects in any way.
*/
public void clearFrameObjectCache()
@@ -90,7 +90,7 @@ public class MinecraftWrapper
return LodUtil.getDimensionIDFromWorld(mc.level);
}
- /**
+ /**
* This texture changes every frame
*/
public NativeImage getCurrentLightMap()
@@ -101,7 +101,7 @@ public class MinecraftWrapper
LightTexture tex = mc.gameRenderer.lightTexture();
lightMap = tex.lightPixels;
}
-
+
// // hotswap this to true, then back to false to write a file
// // (and not write a file every frame)
// if (false)
@@ -123,7 +123,6 @@ public class MinecraftWrapper
/**
* Returns the color int at the given pixel coordinates
* from the current lightmap.
- *
* @param u x location in texture space
* @param v z location in texture space
*/
@@ -141,7 +140,6 @@ public class MinecraftWrapper
/**
* Returns the Color at the given pixel coordinates
* from the current lightmap.
- *
* @param u x location in texture space
* @param v z location in texture space
*/
@@ -166,7 +164,7 @@ public class MinecraftWrapper
{
return mc.options;
}
-
+
public ModelManager getModelManager()
{
return mc.getModelManager();
@@ -174,9 +172,9 @@ public class MinecraftWrapper
public ClientWorld getClientWorld()
{
- return mc.level;
+ return mc.level;
}
-
+
/** Measured in chunks */
public int getRenderDistance()
{
*
* Determines how fast the buffers need to be regenerated
- *
* @author Leonardo Amato
* @version 9-25-2021
*/
public enum BufferRebuildTimes
{
FREQUENT(1000, 500, 2500),
-
+
NORMAL(2000, 1000, 5000),
-
+
RARE(5000, 2000, 10000);
-
+
public final int playerMoveTimeout;
public final int renderedChunkTimeout;
public final int chunkChangeTimeout;
-
+
BufferRebuildTimes(int playerMoveTimeout, int renderedChunkTimeout, int chunkChangeTimeout)
{
this.playerMoveTimeout = playerMoveTimeout;
diff --git a/src/main/java/com/seibel/lod/enums/DebugMode.java b/src/main/java/com/seibel/lod/enums/DebugMode.java
index bcc02cb0b..7f210b836 100644
--- a/src/main/java/com/seibel/lod/enums/DebugMode.java
+++ b/src/main/java/com/seibel/lod/enums/DebugMode.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* By_Region_Fancy,
* By_Chunk
- *
* @author Leonardo Amato
* @version 9-25-2021
*/
@@ -29,7 +29,7 @@ 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 (the best quality option, may cause stuttering when moving) */
FANCY,
}
diff --git a/src/main/java/com/seibel/lod/enums/DistanceGenerationMode.java b/src/main/java/com/seibel/lod/enums/DistanceGenerationMode.java
index fb88826dc..2d23dedb4 100644
--- a/src/main/java/com/seibel/lod/enums/DistanceGenerationMode.java
+++ b/src/main/java/com/seibel/lod/enums/DistanceGenerationMode.java
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
*
* ALWAYS_DRAW_FOG_FAST,
* ALWAYS_DRAW_FOG_FANCY
- *
* @author James Seibel
* @version 7-3-2021
*/
public enum FogDrawOverride
{
- /** Use whatever Fog setting optifine is using.
- * If optifine isn't installed this defaults to ALWAYS_DRAW_FOG. */
+ /**
+ * Use whatever Fog setting optifine is using.
+ * If optifine isn't installed this defaults to ALWAYS_DRAW_FOG.
+ */
USE_OPTIFINE_FOG_SETTING,
/** Never draw fog on the LODs */
diff --git a/src/main/java/com/seibel/lod/enums/FogQuality.java b/src/main/java/com/seibel/lod/enums/FogQuality.java
index 641117066..e1d5493f3 100644
--- a/src/main/java/com/seibel/lod/enums/FogQuality.java
+++ b/src/main/java/com/seibel/lod/enums/FogQuality.java
@@ -15,11 +15,11 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* Determines which LODs should have priority when generating
* outside the normal view distance.
- *
* @author Leonardo Amato
* @version 9-25-2021
*/
diff --git a/src/main/java/com/seibel/lod/enums/GlProxyContext.java b/src/main/java/com/seibel/lod/enums/GlProxyContext.java
index 52f0b16b9..aece5458b 100644
--- a/src/main/java/com/seibel/lod/enums/GlProxyContext.java
+++ b/src/main/java/com/seibel/lod/enums/GlProxyContext.java
@@ -1,8 +1,7 @@
package com.seibel.lod.enums;
-/**
+/**
* Minecraft, Lod_Builder, None
- *
* @author James Seibel
* @version 10-1-2021
*/
diff --git a/src/main/java/com/seibel/lod/enums/HorizontalQuality.java b/src/main/java/com/seibel/lod/enums/HorizontalQuality.java
index 1c64d63a8..08ec328a0 100644
--- a/src/main/java/com/seibel/lod/enums/HorizontalQuality.java
+++ b/src/main/java/com/seibel/lod/enums/HorizontalQuality.java
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
*
* this indicates the base of the quadratic function we use for the quality drop off
- *
* @author Leonardo Amato
* @version 9-29-2021
*/
@@ -31,18 +31,18 @@ public enum HorizontalQuality
{
/** Lods are 2D with heightMap */
LINEAR(1.0f),
-
+
/** Lods are 2D with heightMap */
LOW(1.5f),
-
+
/** Lods expand in three dimension */
MEDIUM(2.0f),
-
+
/** Lods expand in three dimension */
HIGH(2.2f);
-
+
public final double quadraticBase;
-
+
HorizontalQuality(double distanceUnit)
{
this.quadraticBase = distanceUnit;
diff --git a/src/main/java/com/seibel/lod/enums/HorizontalResolution.java b/src/main/java/com/seibel/lod/enums/HorizontalResolution.java
index e1bb023dc..0aff880aa 100644
--- a/src/main/java/com/seibel/lod/enums/HorizontalResolution.java
+++ b/src/main/java/com/seibel/lod/enums/HorizontalResolution.java
@@ -15,20 +15,20 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* half_chunk
* four_blocks
* two_blocks
* block
- *
* @author James Seibel
* @author Leonardo Amato
* @version 9-25-2021
@@ -49,16 +49,20 @@ public enum HorizontalResolution
/** render 256 LODs for each chunk */
BLOCK(16, 0);
-
- /** How many DataPoints should
- * be drawn per side, per LodChunk */
+
+ /**
+ * How many DataPoints should
+ * be drawn per side, per LodChunk
+ */
public final int dataPointLengthCount;
/** How wide each LOD DataPoint is */
public final int dataPointWidth;
- /** This is the same as detailLevel in LodQuadTreeNode,
- * lowest is 0 highest is 9 */
+ /**
+ * This is the same as detailLevel in LodQuadTreeNode,
+ * lowest is 0 highest is 9
+ */
public final byte detailLevel;
/* Start/End X/Z give the block positions
@@ -68,12 +72,12 @@ public enum HorizontalResolution
public final int[] endX;
public final int[] endZ;
-
- /**
+
+ /**
* 1st dimension: LodDetail.detailLevel
* 2nd dimension: An array of all LodDetails that are less than or
- * equal to that detailLevel
+ * equal to that detailLevel
*/
private static HorizontalResolution[][] lowerDetailArrays;
@@ -94,15 +98,15 @@ public enum HorizontalResolution
int index = 0;
- for(int x = 0; x < newLengthCount; x++)
+ for (int x = 0; x < newLengthCount; x++)
{
- for(int z = 0; z < newLengthCount; z++)
+ for (int z = 0; z < newLengthCount; z++)
{
startX[index] = x * dataPointWidth;
startZ[index] = z * dataPointWidth;
- endX[index] = (x*dataPointWidth) + dataPointWidth;
- endZ[index] = (z*dataPointWidth) + dataPointWidth;
+ endX[index] = (x * dataPointWidth) + dataPointWidth;
+ endZ[index] = (z * dataPointWidth) + dataPointWidth;
index++;
}
@@ -115,7 +119,7 @@ public enum HorizontalResolution
- /**
+ /**
* Returns an array of all LodDetails that have a detail level
* that is less than or equal to the given LodDetail
*/
@@ -127,12 +131,12 @@ public enum HorizontalResolution
lowerDetailArrays = new HorizontalResolution[HorizontalResolution.values().length][];
// go through each LodDetail
- for(HorizontalResolution currentDetail : HorizontalResolution.values())
+ for (HorizontalResolution currentDetail : HorizontalResolution.values())
{
ArrayList
*
* this is a quality scale for the detail drop-off
- *
* @author Leonardo Amato
* @version 9-25-2021
*/
diff --git a/src/main/java/com/seibel/lod/enums/LodTemplate.java b/src/main/java/com/seibel/lod/enums/LodTemplate.java
index e82758d4a..6d2ad43be 100644
--- a/src/main/java/com/seibel/lod/enums/LodTemplate.java
+++ b/src/main/java/com/seibel/lod/enums/LodTemplate.java
@@ -15,6 +15,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
* multi_lod
- *
* @author Leonardo Amato
* @version 10-07-2021
*/
public enum VerticalQuality
{
LOW(
- new int[]{2,
+ new int[] { 2,
2,
2,
2,
@@ -37,11 +37,11 @@ public enum VerticalQuality
1,
1,
1,
- 1}
+ 1 }
),
MEDIUM(
- new int[]{4,
+ new int[] { 4,
4,
2,
2,
@@ -51,11 +51,11 @@ public enum VerticalQuality
1,
1,
1,
- 1}
+ 1 }
),
HIGH(
- new int[]{
+ new int[] {
8,
8,
4,
@@ -66,7 +66,7 @@ public enum VerticalQuality
1,
1,
1,
- 1}
+ 1 }
);
public final int[] maxVerticalData;
diff --git a/src/main/java/com/seibel/lod/handlers/LodDimensionFileHandler.java b/src/main/java/com/seibel/lod/handlers/LodDimensionFileHandler.java
index 12f9b4822..31a8a42d7 100644
--- a/src/main/java/com/seibel/lod/handlers/LodDimensionFileHandler.java
+++ b/src/main/java/com/seibel/lod/handlers/LodDimensionFileHandler.java
@@ -38,7 +38,6 @@ import java.util.concurrent.Executors;
* This object handles creating LodRegions
* from files and saving LodRegion objects
* to file.
- *
* @author James Seibel
* @author Cola
* @version 9-25-2021
@@ -130,14 +129,20 @@ public class LodDimensionFileHandler
if (fileName != null)
{
file = new File(fileName);
- if (file.exists()) break;
+ if (file.exists())
+ break;
}
//decrease gen mode
- if (tempGenMode == DistanceGenerationMode.SERVER) tempGenMode = DistanceGenerationMode.FEATURES;
- else if (tempGenMode == DistanceGenerationMode.FEATURES) tempGenMode = DistanceGenerationMode.SURFACE;
- else if (tempGenMode == DistanceGenerationMode.SURFACE) tempGenMode = DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
- else if (tempGenMode == DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT) tempGenMode = DistanceGenerationMode.BIOME_ONLY;
- else if (tempGenMode == DistanceGenerationMode.BIOME_ONLY) tempGenMode = DistanceGenerationMode.NONE;
+ if (tempGenMode == DistanceGenerationMode.SERVER)
+ tempGenMode = DistanceGenerationMode.FEATURES;
+ else if (tempGenMode == DistanceGenerationMode.FEATURES)
+ tempGenMode = DistanceGenerationMode.SURFACE;
+ else if (tempGenMode == DistanceGenerationMode.SURFACE)
+ tempGenMode = DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT;
+ else if (tempGenMode == DistanceGenerationMode.BIOME_ONLY_SIMULATE_HEIGHT)
+ tempGenMode = DistanceGenerationMode.BIOME_ONLY;
+ else if (tempGenMode == DistanceGenerationMode.BIOME_ONLY)
+ tempGenMode = DistanceGenerationMode.NONE;
}
if (!file.exists())
//there wasn't a file, don't return anything
@@ -200,7 +205,7 @@ public class LodDimensionFileHandler
ClientProxy.LOGGER.error("LOD file read error. Unable to read to [" + fileName + "] error [" + ioEx.getMessage() + "]: ");
ioEx.printStackTrace();
}
- }// file datasize > 0
+ }
}
catch (Exception e)
{
diff --git a/src/main/java/com/seibel/lod/handlers/ReflectionHandler.java b/src/main/java/com/seibel/lod/handlers/ReflectionHandler.java
index a6f54899e..9c2f6eafd 100644
--- a/src/main/java/com/seibel/lod/handlers/ReflectionHandler.java
+++ b/src/main/java/com/seibel/lod/handlers/ReflectionHandler.java
@@ -29,7 +29,6 @@ import java.lang.reflect.Method;
* This object is used to get variables from methods
* where they are private. Specifically the fog setting
* in Optifine.
- *
* @author James Seibel
* @version 9-25-2021
*/
diff --git a/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java b/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java
index 234a02031..2ea118a60 100644
--- a/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java
+++ b/src/main/java/com/seibel/lod/mixin/MixinWorldRenderer.java
@@ -34,7 +34,6 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
* If this wasn't done, and we used Forge's
* render last event, the LODs would render on top
* of the normal terrain.
- *
* @author James Seibel
* @version 9-19-2021
*/
diff --git a/src/main/java/com/seibel/lod/objects/LevelContainer.java b/src/main/java/com/seibel/lod/objects/LevelContainer.java
index 0d1c83820..ecba0d4d8 100644
--- a/src/main/java/com/seibel/lod/objects/LevelContainer.java
+++ b/src/main/java/com/seibel/lod/objects/LevelContainer.java
@@ -2,8 +2,8 @@ package com.seibel.lod.objects;
public interface LevelContainer
{
- /**With this you can add data to the level container
- *
+ /**
+ * With this you can add data to the level container
* @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
@@ -12,8 +12,8 @@ public interface LevelContainer
*/
boolean addData(long data, int posX, int posZ, int index);
- /**With this you can add data to the level container
- *
+ /**
+ * With this you can add data to the level container
* @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
@@ -21,16 +21,16 @@ public interface LevelContainer
*/
boolean addSingleData(long data, int posX, int posZ);
- /**With this you can get data from the level container
- *
+ /**
+ * With this you can get data from the level container
* @param posX x position in the detail level
* @param posZ z position in the detail level
* @return the data in long array format
*/
long getData(int posX, int posZ, int index);
- /**With this you can get data from the level container
- *
+ /**
+ * With this you can get data from the level container
* @param posX x position in the detail level
* @param posZ z position in the detail level
* @return the data in long array format
@@ -55,14 +55,14 @@ public interface LevelContainer
/** Clears the dataPoint at the given array index */
void clear(int posX, int posZ);
- /**This return a level container with detail level lower than the current level.
+ /**
+ * This return a level container with detail level lower than the current level.
* The new level container may use information of this level.
* @return the new level container
*/
LevelContainer expand();
/**
- *
* @param lowerLevelContainer lower level where we extract the data
* @param posX x position in the detail level to update
* @param posZ z position in the detail level to update
diff --git a/src/main/java/com/seibel/lod/objects/LodDimension.java b/src/main/java/com/seibel/lod/objects/LodDimension.java
index 2d0702f25..58eaad3ab 100644
--- a/src/main/java/com/seibel/lod/objects/LodDimension.java
+++ b/src/main/java/com/seibel/lod/objects/LodDimension.java
@@ -18,28 +18,23 @@
package com.seibel.lod.objects;
-import java.io.File;
-import java.io.IOException;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
import com.seibel.lod.config.LodConfig;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.GenerationPriority;
import com.seibel.lod.enums.VerticalQuality;
import com.seibel.lod.handlers.LodDimensionFileHandler;
-import com.seibel.lod.util.DataPointUtil;
-import com.seibel.lod.util.DetailDistanceUtil;
-import com.seibel.lod.util.LevelPosUtil;
-import com.seibel.lod.util.LodThreadFactory;
-import com.seibel.lod.util.LodUtil;
+import com.seibel.lod.util.*;
import com.seibel.lod.wrappers.MinecraftWrapper;
-
import net.minecraft.util.math.ChunkPos;
import net.minecraft.world.DimensionType;
import net.minecraft.world.server.ServerChunkProvider;
import net.minecraft.world.server.ServerWorld;
+import java.io.File;
+import java.io.IOException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
/**
* This object holds all loaded LOD regions
@@ -48,7 +43,6 @@ import net.minecraft.world.server.ServerWorld;
* Coordinate Standard:
* Coordinate called posX or posZ are relative LevelPos coordinates
* unless stated otherwise.
- *
* @author Leonardo Amato
* @author James Seibel
* @version 10-10-2021
@@ -92,7 +86,6 @@ public class LodDimension
/**
* Creates the dimension centered at (0,0)
- *
* @param newWidth in regions
*/
public LodDimension(DimensionType newDimension, LodWorld lodWorld, int newWidth)
@@ -294,7 +287,6 @@ public class LodDimension
/**
* Overwrite the LodRegion at the location of newRegion with newRegion.
- *
* @throws ArrayIndexOutOfBoundsException if newRegion is outside what can be stored in this LodDimension.
*/
public synchronized void addOrOverwriteRegion(LodRegion newRegion) throws ArrayIndexOutOfBoundsException
@@ -597,7 +589,7 @@ public class LodDimension
/**
* Returns every node that should be rendered based on the position of the player.
- *
+ *
* Coordinate called posX or posZ are relative LevelPos coordinates
* unless stated otherwise.
- *
* @author Leonardo Amato
* @version 10-10-2021
*/
@@ -87,7 +86,6 @@ public class LodRegion
* Inserts the data point into the region.
*
* This should be done whenever loading a new world.
- *
+ *
* since a lot of LOD data is now homeless.
- *
* @param newWorldName name of the world
*/
public void selectWorld(String newWorldName)
@@ -85,7 +83,7 @@ public class LodWorld
* Set the worldName to "No world loaded"
* and clear the lodDimensions Map.
* This should be done whenever unloaded a world.
- *
+ *
* since a lot of LOD data is now homeless.
*/
diff --git a/src/main/java/com/seibel/lod/objects/NearFarFogSettings.java b/src/main/java/com/seibel/lod/objects/NearFarFogSettings.java
index 3c9de73d6..fb9565c76 100644
--- a/src/main/java/com/seibel/lod/objects/NearFarFogSettings.java
+++ b/src/main/java/com/seibel/lod/objects/NearFarFogSettings.java
@@ -24,7 +24,6 @@ import com.seibel.lod.enums.FogQuality;
/**
* This object is just a replacement for an array
* to make things easier to understand in the LodRenderer.
- *
* @author James Seibel
* @version 7-03-2021
*/
@@ -33,8 +32,10 @@ public class NearFarFogSettings
public final NearOrFarSetting near = new NearOrFarSetting(FogDistance.NEAR);
public final NearOrFarSetting far = new NearOrFarSetting(FogDistance.FAR);
- /** If true that means Minecraft is
- * rendering fog alongside us */
+ /**
+ * If true that means Minecraft is
+ * rendering fog alongside us
+ */
public boolean vanillaIsRenderingFog = true;
public NearFarFogSettings()
diff --git a/src/main/java/com/seibel/lod/objects/PosToGenerateContainer.java b/src/main/java/com/seibel/lod/objects/PosToGenerateContainer.java
index 66a9d5c3a..735210f1a 100644
--- a/src/main/java/com/seibel/lod/objects/PosToGenerateContainer.java
+++ b/src/main/java/com/seibel/lod/objects/PosToGenerateContainer.java
@@ -5,7 +5,6 @@ import com.seibel.lod.util.LevelPosUtil;
/**
* Holds the levelPos that need to be generated.
* TODO is that correct?
- *
* @author Leonardo Amato
* @version 9-27-2021
*/
diff --git a/src/main/java/com/seibel/lod/objects/PosToRenderContainer.java b/src/main/java/com/seibel/lod/objects/PosToRenderContainer.java
index 0ec131584..bfbf30bf2 100644
--- a/src/main/java/com/seibel/lod/objects/PosToRenderContainer.java
+++ b/src/main/java/com/seibel/lod/objects/PosToRenderContainer.java
@@ -7,7 +7,6 @@ import com.seibel.lod.util.LodUtil;
import java.util.Arrays;
/**
- *
* @author Leonardo Amato
* @version 9-18-2021
*/
@@ -20,7 +19,7 @@ public class PosToRenderContainer
private int numberOfPosToRender;
private int[] posToRender;
/*TODO this population matrix could be converted to boolean to improve memory use
- * no since bools are stored as bytes anyway - cola*/
+ * no since bools are stored as bytes anyway - cola*/
private byte[][] population;
public PosToRenderContainer(byte minDetail, int regionPosX, int regionPosZ)
diff --git a/src/main/java/com/seibel/lod/objects/RegionPos.java b/src/main/java/com/seibel/lod/objects/RegionPos.java
index 5adf4becb..b586090a0 100644
--- a/src/main/java/com/seibel/lod/objects/RegionPos.java
+++ b/src/main/java/com/seibel/lod/objects/RegionPos.java
@@ -15,16 +15,15 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see
- *
+ *
- *
+ *
* https://learnopengl.com/Advanced-OpenGL/Advanced-Data
* https://gamedev.stackexchange.com/questions/91995/edit-vbo-data-or-create-a-new-one
- *
- *
* @author James Seibel
* @version 10-2-2021
*/
@@ -35,8 +33,10 @@ public class GlProxy
/** the LodBuilder's GL context */
public final GLCapabilities lodBuilderGlCapabilities;
- /** This is just used for debugging, hopefully it can be removed once
- * the context switching is more stable. */
+ /**
+ * This is just used for debugging, hopefully it can be removed once
+ * the context switching is more stable.
+ */
public Thread lodBuilderOwnerThread = null;
/** Does this computer's GPU support fancy fog? */
@@ -88,9 +88,7 @@ public class GlProxy
fancyFogAvailable = GL.getCapabilities().GL_NV_fog_distance;
if (!fancyFogAvailable)
- {
ClientProxy.LOGGER.info("This GPU does not support GL_NV_fog_distance. This means that the fancy fog option will not be available.");
- }
}
diff --git a/src/main/java/com/seibel/lod/render/LodRenderer.java b/src/main/java/com/seibel/lod/render/LodRenderer.java
index 070435c4e..abcf8978d 100644
--- a/src/main/java/com/seibel/lod/render/LodRenderer.java
+++ b/src/main/java/com/seibel/lod/render/LodRenderer.java
@@ -18,24 +18,13 @@
package com.seibel.lod.render;
-import java.util.HashSet;
-
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL15;
-import org.lwjgl.opengl.GL15C;
-import org.lwjgl.opengl.NVFogDistance;
-
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import com.mojang.blaze3d.systems.RenderSystem;
import com.seibel.lod.builders.bufferBuilding.LodBufferBuilder;
import com.seibel.lod.builders.bufferBuilding.LodBufferBuilder.VertexBuffersAndOffset;
import com.seibel.lod.config.LodConfig;
-import com.seibel.lod.enums.DebugMode;
-import com.seibel.lod.enums.DetailDropOff;
-import com.seibel.lod.enums.FogDistance;
-import com.seibel.lod.enums.FogDrawOverride;
-import com.seibel.lod.enums.FogQuality;
+import com.seibel.lod.enums.*;
import com.seibel.lod.handlers.ReflectionHandler;
import com.seibel.lod.objects.LodDimension;
import com.seibel.lod.objects.NearFarFogSettings;
@@ -46,7 +35,6 @@ 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.client.renderer.ActiveRenderInfo;
import net.minecraft.client.renderer.FogRenderer;
import net.minecraft.client.renderer.GameRenderer;
@@ -57,12 +45,17 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.vector.Matrix4f;
import net.minecraft.util.math.vector.Vector3d;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL15;
+import org.lwjgl.opengl.GL15C;
+import org.lwjgl.opengl.NVFogDistance;
+
+import java.util.HashSet;
/**
* This is where all the magic happens.
* This is where LODs are draw to the world.
- *
* @author James Seibel
* @version 10-11-2021
*/
@@ -152,10 +145,9 @@ public class LodRenderer
/**
* Besides drawing the LODs this method also starts
* the async process of generating the Buffers that hold those LODs.
- *
- * @param lodDim The dimension to draw, if null doesn't replace the current dimension.
+ * @param lodDim The dimension to draw, if null doesn't replace the current dimension.
* @param mcMatrixStack This matrix stack should come straight from MC's renderChunkLayer (or future equivalent) method
- * @param partialTicks how far into the current tick this method was called.
+ * @param partialTicks how far into the current tick this method was called.
*/
@SuppressWarnings("deprecation")
public void drawLODs(LodDimension lodDim, MatrixStack mcMatrixStack, float partialTicks, IProfiler newProfiler)
@@ -517,9 +509,8 @@ public class LodRenderer
/**
* create a new projection matrix and send it over to the GPU
- *
* @param currentProjectionMatrix this is Minecraft's current projection matrix
- * @param partialTicks how many ticks into the frame we are
+ * @param partialTicks how many ticks into the frame we are
*/
private void setupProjectionMatrix(Matrix4f currentProjectionMatrix, float partialTicks)
{
diff --git a/src/main/java/com/seibel/lod/render/RenderUtil.java b/src/main/java/com/seibel/lod/render/RenderUtil.java
index c571d2bda..3218db85f 100644
--- a/src/main/java/com/seibel/lod/render/RenderUtil.java
+++ b/src/main/java/com/seibel/lod/render/RenderUtil.java
@@ -20,7 +20,6 @@ package com.seibel.lod.render;
import com.seibel.lod.util.LodUtil;
import com.seibel.lod.wrappers.MinecraftWrapper;
-
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.ChunkPos;
import net.minecraft.util.math.vector.Vector3d;
@@ -28,7 +27,6 @@ import net.minecraft.util.math.vector.Vector3d;
/**
* This holds miscellaneous helper code
* to be used in the rendering process.
- *
* @author James Seibel
* @version 10-10-2021
*/
@@ -47,7 +45,7 @@ public class RenderUtil
&& pos.x <= center.x + mc.getRenderDistance())
&&
(pos.z >= center.z - mc.getRenderDistance()
- && pos.z <= center.z + mc.getRenderDistance());
+ && pos.z <= center.z + mc.getRenderDistance());
}
/**
@@ -60,7 +58,7 @@ public class RenderUtil
&& x <= centerCoordinate + mc.getRenderDistance())
&&
(z >= centerCoordinate - mc.getRenderDistance()
- && z <= centerCoordinate + mc.getRenderDistance());
+ && z <= centerCoordinate + mc.getRenderDistance());
}
@@ -76,7 +74,7 @@ public class RenderUtil
&& i <= lodRadius + halfRadius)
&&
(j >= lodRadius - halfRadius
- && j <= lodRadius + halfRadius);
+ && j <= lodRadius + halfRadius);
}
diff --git a/src/main/java/com/seibel/lod/util/ColorUtil.java b/src/main/java/com/seibel/lod/util/ColorUtil.java
index 3972ee651..ecb6c5990 100644
--- a/src/main/java/com/seibel/lod/util/ColorUtil.java
+++ b/src/main/java/com/seibel/lod/util/ColorUtil.java
@@ -8,54 +8,56 @@ public class ColorUtil
{
return (0xFF << 24) | (red << 16) | (green << 8) | blue;
}
-
+
public static int rgbToInt(int alpha, int red, int green, int blue)
{
return (alpha << 24) | (red << 16) | (green << 8) | blue;
}
-
+
public static int getAlpha(int color)
{
return (color >> 24) & 0xFF;
}
-
+
public static int getRed(int color)
{
return (color >> 16) & 0xFF;
}
-
+
public static int getGreen(int color)
{
return (color >> 8) & 0xFF;
}
-
+
public static int getBlue(int color)
{
return color & 0xFF;
}
-
+
public static int applyShade(int color, int shade)
{
if (shade < 0)
{
return (getAlpha(color) << 24) | (Math.max(getRed(color) + shade, 0) << 16) | (Math.max(getGreen(color) + shade, 0) << 8) | Math.max(getBlue(color) + shade, 0);
- } else
+ }
+ else
{
return (getAlpha(color) << 24) | (Math.min(getRed(color) + shade, 255) << 16) | (Math.min(getGreen(color) + shade, 255) << 8) | Math.min(getBlue(color) + shade, 255);
}
}
-
+
public static int applyShade(int color, float shade)
{
if (shade < 1)
{
return (getAlpha(color) << 24) | ((int) Math.max(getRed(color) * shade, 0) << 16) | ((int) Math.max(getGreen(color) * shade, 0) << 8) | (int) Math.max(getBlue(color) * shade, 0);
- } else
+ }
+ else
{
return (getAlpha(color) << 24) | ((int) Math.min(getRed(color) * shade, 255) << 16) | ((int) Math.min(getGreen(color) * shade, 255) << 8) | (int) Math.min(getBlue(color) * shade, 255);
}
}
-
+
/**
* Edit the given color as an HSV (Hue Saturation Value) color.
*/
@@ -67,7 +69,7 @@ public class ColorUtil
LodUtil.clamp(0.0f, hsv[1] * saturationMultiplier, 1.0f),
LodUtil.clamp(0.0f, hsv[2] * brightnessMultiplier, 1.0f)).getRGB();
}
-
+
/**
* Edit the given color as an HSV (Hue Saturation Value) color.
*/
@@ -79,7 +81,7 @@ public class ColorUtil
hsv[1],
brightness).getRGB();
}
-
+
/**
* Edit the given color as an HSV (Hue Saturation Value) color.
*/
@@ -92,12 +94,13 @@ public class ColorUtil
hsv[1],
brightness).getRGB();
}
+
public static int multiplyRGBcolors(int color1, int color2)
{
return ((getAlpha(color1) * getAlpha(color2) / 255) << 24) | ((getRed(color1) * getRed(color2) / 255) << 16) | ((getGreen(color1) * getGreen(color2) / 255) << 8) | (getBlue(color1) * getBlue(color2) / 255);
}
-
-
+
+
public static String toString(int color)
{
return Integer.toHexString(getAlpha(color)) +
diff --git a/src/main/java/com/seibel/lod/util/DataPointUtil.java b/src/main/java/com/seibel/lod/util/DataPointUtil.java
index d474306b7..67e12b2de 100644
--- a/src/main/java/com/seibel/lod/util/DataPointUtil.java
+++ b/src/main/java/com/seibel/lod/util/DataPointUtil.java
@@ -173,7 +173,7 @@ public class DataPointUtil
{
return (int) (((dataPoint >>> COLOR_SHIFT) & COLOR_MASK) | (((dataPoint >>> (ALPHA_SHIFT - ALPHA_DOWNSIZE_SHIFT)) | 0b1111) << 24));
}
-
+
/** This method apply the lightmap to the color to use */
public static int getLightColor(long dataPoint, NativeImage lightMap)
{
@@ -186,7 +186,7 @@ public class DataPointUtil
return ColorUtil.multiplyRGBcolors(getColor(dataPoint), ColorUtil.rgbToInt(red, green, blue));
}
-
+
/** This is used to convert a dataPoint to string (useful for the print function) */
public static String toString(long dataPoint)
{
@@ -227,7 +227,7 @@ public class DataPointUtil
array[start + i] = 0;
}
}
-
+
/**
* This method merge column of multiple data together
* @param dataToMerge one or more columns of data
@@ -405,7 +405,7 @@ public class DataPointUtil
ii = worldHeight;
for (i = 0; i < count - 1; i++)
{
- if (heightAndDepth[i * 2 + 1] - heightAndDepth[(i + 1) * 2]< ii)
+ if (heightAndDepth[i * 2 + 1] - heightAndDepth[(i + 1) * 2] < ii)
{
ii = heightAndDepth[i * 2 + 1] - heightAndDepth[(i + 1) * 2];
j = i;
@@ -428,7 +428,7 @@ public class DataPointUtil
if ((depth == 0 && height == 0) || j >= heightAndDepth.length / 2)
break;
-
+
int numberOfChildren = 0;
int tempAlpha = 0;
int tempRed = 0;
@@ -448,7 +448,7 @@ public class DataPointUtil
singleData = dataToMerge[index * inputVerticalData + dataIndex];
if (doesItExist(singleData) && !isVoid(singleData))
{
-
+
if ((depth <= getDepth(singleData) && getDepth(singleData) <= height)
|| (depth <= getHeight(singleData) && getHeight(singleData) <= height))
{
@@ -459,7 +459,8 @@ public class DataPointUtil
else
break;
}
- if(!doesItExist(data)){
+ if (!doesItExist(data))
+ {
singleData = dataToMerge[index * inputVerticalData];
data = createVoidDataPoint(getGenerationMode(singleData));
}
diff --git a/src/main/java/com/seibel/lod/util/LodThreadFactory.java b/src/main/java/com/seibel/lod/util/LodThreadFactory.java
index 3d5bc2889..1c861564c 100644
--- a/src/main/java/com/seibel/lod/util/LodThreadFactory.java
+++ b/src/main/java/com/seibel/lod/util/LodThreadFactory.java
@@ -5,7 +5,6 @@ import java.util.concurrent.ThreadFactory;
/**
* Just a simple ThreadFactory to name ExecutorService
* threads, which can be helpful when debugging.
- *
* @author James Seibel
* @version 8-15-2021
*/
@@ -22,7 +21,7 @@ public class LodThreadFactory implements ThreadFactory
@Override
public Thread newThread(Runnable r)
{
- return new Thread(r, threadName);
+ return new Thread(r, threadName);
}
}
diff --git a/src/main/java/com/seibel/lod/util/LodUtil.java b/src/main/java/com/seibel/lod/util/LodUtil.java
index 4d02eb5ab..176f690f6 100644
--- a/src/main/java/com/seibel/lod/util/LodUtil.java
+++ b/src/main/java/com/seibel/lod/util/LodUtil.java
@@ -18,17 +18,12 @@
package com.seibel.lod.util;
-import java.awt.Color;
-import java.io.File;
-import java.util.HashSet;
-
import com.seibel.lod.builders.bufferBuilding.lodTemplates.Box;
import com.seibel.lod.config.LodConfig;
import com.seibel.lod.enums.VanillaOverdraw;
import com.seibel.lod.objects.LodDimension;
import com.seibel.lod.objects.RegionPos;
import com.seibel.lod.wrappers.MinecraftWrapper;
-
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.client.renderer.WorldRenderer;
import net.minecraft.client.renderer.chunk.ChunkRenderDispatcher.CompiledChunk;
@@ -46,9 +41,12 @@ import net.minecraft.world.gen.Heightmap;
import net.minecraft.world.server.ServerChunkProvider;
import net.minecraft.world.server.ServerWorld;
+import java.awt.*;
+import java.io.File;
+import java.util.HashSet;
+
/**
* This class holds methods and constants that may be used in multiple places.
- *
* @author James Seibel
* @version 10-11-2021
*/
@@ -58,7 +56,7 @@ public class LodUtil
/**
* vanilla render distances less than or equal to this will not allow partial
- * overdraw. The VanillaOverdraw with either be ALWAYS or NEVER.
+ * overdraw. The VanillaOverdraw with either be ALWAYS or NEVER.
*/
public static final int MINIMUM_RENDER_DISTANCE_FOR_PARTIAL_OVERDRAW = 5;
@@ -156,7 +154,6 @@ public class LodUtil
/**
* Gets the first valid ServerWorld.
- *
* @return null if there are no ServerWorlds
*/
public static ServerWorld getFirstValidServerWorld()
@@ -174,7 +171,6 @@ public class LodUtil
/**
* Gets the ServerWorld for the relevant dimension.
- *
* @return null if there is no ServerWorld for the given dimension
*/
public static ServerWorld getServerWorldFromDimension(DimensionType dimension)
@@ -371,7 +367,7 @@ public class LodUtil
VanillaOverdraw overdraw = LodConfig.CLIENT.graphics.vanillaOverdraw.get();
// apply distance based rules for dynamic
- if (overdraw == VanillaOverdraw.DYNAMIC
+ if (overdraw == VanillaOverdraw.DYNAMIC
&& chunkRenderDist <= MINIMUM_RENDER_DISTANCE_FOR_PARTIAL_OVERDRAW)
{
// The vanilla render distance isn't far enough
@@ -399,13 +395,13 @@ public class LodUtil
case ALWAYS:
// don't skip any positions
return new HashSet
- *
+ *
- *
+ *