resolved warnings. part 2

This commit is contained in:
cola98765
2022-01-18 11:00:07 +01:00
parent 7bf54d20c0
commit 6b6d011cd5
12 changed files with 37 additions and 42 deletions
@@ -76,8 +76,8 @@ public class ClientApi
}
private ConcurrentHashMap.KeySetView<Long,Boolean> generating = ConcurrentHashMap.newKeySet();
private ConcurrentHashMap.KeySetView<Long,Boolean> toBeLoaded = ConcurrentHashMap.newKeySet();
private final ConcurrentHashMap.KeySetView<Long,Boolean> generating = ConcurrentHashMap.newKeySet();
private final ConcurrentHashMap.KeySetView<Long,Boolean> toBeLoaded = ConcurrentHashMap.newKeySet();
public void clientChunkLoadEvent(IChunkWrapper chunk, IWorldWrapper world)
{
@@ -665,8 +665,7 @@ public class LodBufferBuilderFactory
GpuUploadMethod uploadMethod = glProxy.getGpuUploadMethod();
// determine the upload timeout
int MBPerMS = CONFIG.client().advanced().buffers().getGpuUploadPerMegabyteInMilliseconds();
long BPerNS = MBPerMS; // MB -> B = 1/1,000,000. MS -> NS = 1,000,000. So, MBPerMS = BPerNS.
long BPerNS = CONFIG.client().advanced().buffers().getGpuUploadPerMegabyteInMilliseconds(); // MB -> B = 1/1,000,000. MS -> NS = 1,000,000. So, MBPerMS = BPerNS.
long remainingNS = 0; // We don't want to pause for like 0.1 ms... so we store those tiny MS.
long bytesUploaded = 0;
@@ -57,7 +57,7 @@ import com.seibel.lod.core.util.LodUtil;
public class LodDimensionFileHandler
{
/** This is the dimension that owns this file handler */
private LodDimension lodDimension;
private final LodDimension lodDimension;
private final File dimensionDataSaveFolder;
@@ -88,10 +88,10 @@ public class LodDimensionFileHandler
* Allow saving asynchronously, but never try to save multiple regions
* at a time
*/
private AtomicBoolean isFileWritingThreadRunning = new AtomicBoolean(false);
private final AtomicBoolean isFileWritingThreadRunning = new AtomicBoolean(false);
private ExecutorService fileWritingThreadPool = Executors.newSingleThreadExecutor(new LodThreadFactory(this.getClass().getSimpleName()));
private ConcurrentHashMap<RegionPos, LodRegion> regionToSave = new ConcurrentHashMap<RegionPos, LodRegion>();
private final ConcurrentHashMap<RegionPos, LodRegion> regionToSave = new ConcurrentHashMap<RegionPos, LodRegion>();
public LodDimensionFileHandler(File newSaveFolder, LodDimension newLodDimension)
@@ -157,10 +157,8 @@ public class LodDimension
}
}
Arrays.sort(list, (a, b) -> {
RegionPos posA = a;
RegionPos posB = b;
double disSqrA = posA.x*posA.x+posA.z*posA.z;
double disSqrB = posB.x*posB.x+posB.z*posB.z;
double disSqrA = a.x* a.x+ a.z* a.z;
double disSqrB = b.x* b.x+ b.z* b.z;
return Double.compare(disSqrA, disSqrB);
});
iteratorList = list;
@@ -404,10 +404,8 @@ public class LodRenderer
// accuracy vs the model view matrix, which only uses floats)
//int bufferPosX = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterX, LodUtil.BLOCK_DETAIL_LEVEL);
//int bufferPosZ = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterZ, LodUtil.BLOCK_DETAIL_LEVEL);
int bufferPosX = vbosCenterX;
int bufferPosZ = vbosCenterZ;
double xDiff = projectedView.x - bufferPosX;
double zDiff = projectedView.z - bufferPosZ;
double xDiff = projectedView.x - vbosCenterX;
double zDiff = projectedView.z - vbosCenterZ;
mcModelViewMatrix.multiplyTranslationMatrix(-xDiff, -projectedView.y, -zDiff);
return mcModelViewMatrix;
@@ -421,10 +419,8 @@ public class LodRenderer
{
//int worldCenterX = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterX, LodUtil.BLOCK_DETAIL_LEVEL);
//int worldCenterZ = LevelPosUtil.convert(LodUtil.CHUNK_DETAIL_LEVEL, vbosCenterZ, LodUtil.BLOCK_DETAIL_LEVEL);
int worldCenterX = vbosCenterX;
int worldCenterZ = vbosCenterZ;
Vec3d cameraPos = MC_RENDER.getCameraExactPosition();
return new Vec3f((float)cameraPos.x - worldCenterX, (float)cameraPos.y, (float)cameraPos.z - worldCenterZ);
return new Vec3f((float)cameraPos.x - vbosCenterX, (float)cameraPos.y, (float)cameraPos.z - vbosCenterZ);
}
/**
@@ -48,14 +48,16 @@ public final class VertexAttributePreGL43 extends VertexAttribute {
public void bindBufferToBindingPoint(int buffer, int bindingPoint) {
int[] toBind = bindingPointsToIndex[bindingPoint];
for (int i=0; i<toBind.length; i++)
GL32.glEnableVertexAttribArray(toBind[i]);
for (int k : toBind)
GL32.glEnableVertexAttribArray(k);
for (int i=0; i< toBind.length; i++) {
VertexPointer pointer = pointers[toBind[i]];
if (pointer==null) continue;
GL32.glVertexAttribPointer(toBind[i], pointer.elementCount, pointer.glType,
pointer.normalized, strideSize, pointersOffset[toBind[i]]);
for (int j : toBind)
{
VertexPointer pointer = pointers[j];
if (pointer == null)
continue;
GL32.glVertexAttribPointer(j, pointer.elementCount, pointer.glType,
pointer.normalized, strideSize, pointersOffset[j]);
}
}
@@ -71,8 +73,8 @@ public final class VertexAttributePreGL43 extends VertexAttribute {
public void unbindBuffersFromBindingPoint(int bindingPoint) {
int[] toBind = bindingPointsToIndex[bindingPoint];
for (int i=0; i<toBind.length; i++)
GL32.glDisableVertexAttribArray(toBind[i]);
for (int j : toBind)
GL32.glDisableVertexAttribArray(j);
}
@Override
@@ -71,15 +71,15 @@ public class BooleanMovableGridList {
return _swapDirect(x,y, t);
}
private final boolean _getDirect(int x, int y) {
private boolean _getDirect(int x, int y) {
assertIndex(x,y);
return b[x + y * gridSize];
}
private final void _setDirect(int x, int y, boolean t) {
private void _setDirect(int x, int y, boolean t) {
assertIndex(x,y);
b[x + y * gridSize] = t;
}
private final boolean _swapDirect(int x, int y, boolean t) {
private boolean _swapDirect(int x, int y, boolean t) {
assertIndex(x,y);
boolean r = b[x + y * gridSize];
b[x + y * gridSize] = t;
@@ -94,16 +94,16 @@ public class MovableGridList<T> extends ArrayList<T> implements List<T> {
return (x>=0 && x<gridSize && y>=0 && y<gridSize);
}
private final T _getDirect(int x, int y) {
private T _getDirect(int x, int y) {
if (x<0 || x>=gridSize || y<0 || y>=gridSize) return null;
return super.get(x + y * gridSize);
}
private final boolean _setDirect(int x, int y, T t) {
private boolean _setDirect(int x, int y, T t) {
if (x<0 || x>=gridSize || y<0 || y>=gridSize) return false;
super.set(x + y * gridSize, t);
return true;
}
private final T _swapDirect(int x, int y, T t) {
private T _swapDirect(int x, int y, T t) {
if (x<0 || x>=gridSize || y<0 || y>=gridSize) return null;
return super.set(x + y * gridSize, t);
}
@@ -48,7 +48,7 @@ public interface IWrapperFactory
AbstractWorldGeneratorWrapper createWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper);
// Return null to signal that there is no AbstractWorldGenerator
public default AbstractExperimentalWorldGeneratorWrapper createExperimentalWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
default AbstractExperimentalWorldGeneratorWrapper createExperimentalWorldGenerator(LodBuilder newLodBuilder, LodDimension newLodDimension, IWorldWrapper worldWrapper) {
return null;
}
}
@@ -345,7 +345,7 @@ public interface ILodConfigWrapperSingleton
void setGenerationPriority(GenerationPriority newGenerationPriority);
DistanceGenerationMode DISTANCE_GENERATION_MODE_DEFAULT = DistanceGenerationMode.SURFACE;
public static String getDistanceGenerationModeDesc(IVersionConstants versionConstants)
static String getDistanceGenerationModeDesc(IVersionConstants versionConstants)
{
return ""
+ " How detailed should fake chunks be generated outside the vanilla render distance? \n"
@@ -55,9 +55,9 @@ public interface IMinecraftRenderWrapper
Color getFogColor(float partialTicks);
public default Color getUnderWaterFogColor(float partialTicks) {return getFogColor(partialTicks);}
default Color getUnderWaterFogColor(float partialTicks) {return getFogColor(partialTicks);}
public default boolean isFogStateInUnderWater() {
default boolean isFogStateInUnderWater() {
return false;
}
@@ -77,7 +77,7 @@ public interface IMinecraftRenderWrapper
* <br>
* If not implemented this calls {@link #getMaximumRenderedChunks()}.
*/
public default HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
default HashSet<AbstractChunkPosWrapper> getVanillaRenderedChunks()
{
ISodiumAccessor sodium = ModAccessorApi.get(ISodiumAccessor.class);
return sodium==null ? getMaximumRenderedChunks() : sodium.getNormalRenderedChunks();
@@ -87,7 +87,7 @@ public interface IMinecraftRenderWrapper
* <strong>Doesn't need to be implemented.</strong> <br>
* Returns every chunk position within the vanilla render distance.
*/
public default HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
default HashSet<AbstractChunkPosWrapper> getMaximumRenderedChunks()
{
IMinecraftWrapper mcWrapper = SingletonHandler.get(IMinecraftWrapper.class);
IWrapperFactory factory = SingletonHandler.get(IWrapperFactory.class);
@@ -119,9 +119,9 @@ public interface IMinecraftRenderWrapper
/** @returns -1 if there was an issue getting the lightmap */
int getLightmapTextureWidth();
/** @returns -1 if there was an issue getting the lightmap */
public int getLightmapGLFormat();
int getLightmapGLFormat();
// Try and disable vanilla fog. Return true if successful, or false if not able to.
public boolean tryDisableVanillaFog();
boolean tryDisableVanillaFog();
}
@@ -1,5 +1,5 @@
package com.seibel.lod.core.wrapperInterfaces.modAccessor;
public abstract interface IModAccessor {
public interface IModAccessor {
String getModName();
}