Clean up a lot of warnings related to: type casting, unused variables, and unused imports

This commit is contained in:
James Seibel
2021-09-18 17:06:41 -05:00
parent aa95361866
commit 1c9c72cfe3
13 changed files with 57 additions and 69 deletions
+7 -5
View File
@@ -1,19 +1,21 @@
package com.seibel.lod;
import com.seibel.lod.builders.lodTemplates.Box;
import com.seibel.lod.util.DataPointUtil;
import net.minecraft.util.Direction;
import java.util.HashMap;
import java.util.Map;
import com.seibel.lod.builders.lodTemplates.Box;
import com.seibel.lod.util.DataPointUtil;
import net.minecraft.util.Direction;
public class Main
{
public static void main(String[] args)
{
try
{
Map<Direction, long[]> adjData = new HashMap()
@SuppressWarnings("serial")
Map<Direction, long[]> adjData = new HashMap<Direction, long[]>()
{{
put(Direction.EAST, new long[]{DataPointUtil.createDataPoint(60, 30, 0, 0, 0, 0), DataPointUtil.createDataPoint(25, 10, 0, 0, 0, 0)});
put(Direction.WEST, new long[]{DataPointUtil.createDataPoint(60, 10, 0, 0, 0, 0)});
@@ -198,10 +198,6 @@ public class LodBuilder
int startZ;
int endX;
int endZ;
int color;
byte light;
short height;
short depth;
try
{
LodDetail detail;
@@ -705,9 +701,6 @@ public class LodBuilder
int z = blockPos.getZ();
Biome biome = chunk.getBiomes().getNoiseBiome(xRel >> 2, y >> 2, zRel >> 2);
int brightness;
int red = 0;
int green = 0;
int blue = 0;
BlockState blockState = chunk.getBlockState(blockPos);
int colorInt = 0;
@@ -17,17 +17,15 @@
*/
package com.seibel.lod.builders.lodTemplates;
import com.seibel.lod.enums.DebugMode;
import java.util.Map;
import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.util.ColorUtil;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import java.awt.*;
import java.util.Map;
/**
* This is the abstract class used to create different
@@ -1,18 +1,16 @@
package com.seibel.lod.builders.lodTemplates;
import java.util.HashMap;
import java.util.Map;
import com.seibel.lod.config.LodConfig;
import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.util.ColorUtil;
import com.seibel.lod.util.DataPointUtil;
import com.seibel.lod.wrappers.MinecraftWrapper;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.vector.Vector3d;
import org.lwjgl.system.CallbackI;
import java.util.HashMap;
import java.util.Map;
import java.util.Vector;
import net.minecraft.util.Direction;
import net.minecraft.util.math.vector.Vector3d;
public class Box
{
@@ -43,7 +41,8 @@ public class Box
Direction.SOUTH,
Direction.NORTH};
public static final Map<Direction, int[][]> DIRECTION_VERTEX_MAP = new HashMap()
@SuppressWarnings("serial")
public static final Map<Direction, int[][]> DIRECTION_VERTEX_MAP = new HashMap<Direction, int[][]>()
{{
put(Direction.UP, new int[][]{
{0, 1, 0},
@@ -76,7 +75,10 @@ public class Box
{1, 1, 0},
{1, 0, 0}});
}};
public static final Map<Direction, int[]> FACE_DIRECTION = new HashMap()
@SuppressWarnings("serial")
public static final Map<Direction, int[]> FACE_DIRECTION = new HashMap<Direction, int[]>()
{{
put(Direction.UP, new int[]{Y, MAX});
put(Direction.DOWN, new int[]{Y, MIN});
@@ -86,7 +88,8 @@ public class Box
put(Direction.NORTH, new int[]{Z, MIN});
}};
public static final Map<Direction, int[][]> DIRECTION_NORMAL_MAP = new HashMap()
@SuppressWarnings("serial")
public static final Map<Direction, int[]> DIRECTION_NORMAL_MAP = new HashMap<Direction, int[]>()
{{
put(Direction.UP, new int[]{0, 1, 0});
put(Direction.DOWN, new int[]{0, -1, 0});
@@ -102,11 +105,12 @@ public class Box
public Map<Direction, int[][]> adjHeightAndDepth;
public Map<Direction, boolean[]> culling;
@SuppressWarnings("serial")
public Box()
{
box = new int[2][3];
//order = new long[32];
colorMap = new HashMap()
colorMap = new HashMap<Direction, int[]>()
{{
put(Direction.UP, new int[1]);
put(Direction.DOWN, new int[1]);
@@ -115,14 +119,14 @@ public class Box
put(Direction.SOUTH, new int[1]);
put(Direction.NORTH, new int[1]);
}};
adjHeightAndDepth = new HashMap()
adjHeightAndDepth = new HashMap<Direction, int[][]>()
{{
put(Direction.EAST, new int[32][2]);
put(Direction.WEST, new int[32][2]);
put(Direction.SOUTH, new int[32][2]);
put(Direction.NORTH, new int[32][2]);
}};
culling = new HashMap()
culling = new HashMap<Direction, boolean[]>()
{{
put(Direction.UP, new boolean[1]);
put(Direction.DOWN, new boolean[1]);
@@ -17,6 +17,8 @@
*/
package com.seibel.lod.builders.lodTemplates;
import java.util.Map;
import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.util.DataPointUtil;
import com.seibel.lod.util.LodUtil;
@@ -26,8 +28,6 @@ import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import java.util.Map;
/**
* Builds LODs as rectangular prisms.
*
@@ -36,8 +36,7 @@ import java.util.Map;
*/
public class CubicLodTemplate extends AbstractLodTemplate
{
private final int CULL_OFFSET = 16;
public CubicLodTemplate()
{
@@ -17,15 +17,15 @@
*/
package com.seibel.lod.builders.lodTemplates;
import java.util.Map;
import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.proxy.ClientProxy;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import java.util.Map;
/**
* TODO DynamicLodTemplate
@@ -42,7 +42,7 @@ public class DynamicLodTemplate extends AbstractLodTemplate
public void addLodToBuffer(BufferBuilder buffer, BlockPos bufferCenterBlockPos, long data, Map<Direction, long[]> adjData,
byte detailLevel, int posX, int posZ, Box box, DebugMode debugging, NativeImage lightMap)
{
System.err.println("DynamicLodTemplate not implemented!");
ClientProxy.LOGGER.error(DynamicLodTemplate.class.getSimpleName() + " is not implemented!");
}
@Override
@@ -17,15 +17,15 @@
*/
package com.seibel.lod.builders.lodTemplates;
import java.util.Map;
import com.seibel.lod.enums.DebugMode;
import com.seibel.lod.proxy.ClientProxy;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.texture.NativeImage;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DimensionType;
import java.util.Map;
/**
* TODO #21 TriangularLodTemplate
@@ -40,7 +40,7 @@ public class TriangularLodTemplate extends AbstractLodTemplate
public void addLodToBuffer(BufferBuilder buffer, BlockPos bufferCenterBlockPos, long data, Map<Direction, long[]> adjData,
byte detailLevel, int posX, int posZ, Box box, DebugMode debugging, NativeImage lightMap)
{
System.err.println("DynamicLodTemplate not implemented!");
ClientProxy.LOGGER.error(DynamicLodTemplate.class.getSimpleName() + " is not implemented!");
}
@Override
@@ -24,7 +24,6 @@ import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadFactory;
import java.util.function.Supplier;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
@@ -1,7 +1,6 @@
package com.seibel.lod.objects;
import com.seibel.lod.builders.LodBuilder;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.LodQualityMode;
import com.seibel.lod.util.DataPointUtil;
@@ -15,8 +14,9 @@ import com.seibel.lod.util.LodUtil;
* if an array contain coordinate the order is the following
* 0 for x, 1 for z in 2D
* 0 for x, 1 for y, 2 for z in 3D
*
*
*/
public class LodRegion
{
//x coord,
@@ -544,7 +544,7 @@ public class LodRenderer
/**
* setup the lighting to be used for the LODs
*/
@SuppressWarnings("deprecation")
@SuppressWarnings({ "deprecation", "unused" })
private void setupLighting(LodDimension lodDimension, float partialTicks)
{
// Determine if the player has night vision
@@ -1,12 +1,8 @@
package com.seibel.lod.util;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.wrappers.MinecraftWrapper;
import net.minecraft.client.renderer.LightTexture;
import net.minecraft.client.renderer.texture.NativeImage;
import javax.xml.crypto.Data;
import java.lang.annotation.Native;
import net.minecraft.client.renderer.texture.NativeImage;
public class DataPointUtil
{
@@ -171,8 +167,8 @@ public class DataPointUtil
public static int getColor(long dataPoint)
{
int color = getBlue(dataPoint) << BLUE_COLOR_SHIFT;
color += getRed(dataPoint) << BLUE_COLOR_SHIFT;
//int color = getBlue(dataPoint) << BLUE_COLOR_SHIFT;
//color += getRed(dataPoint) << BLUE_COLOR_SHIFT;
return (int) (dataPoint >>> COLOR_SHIFT);
}
@@ -220,7 +216,6 @@ public class DataPointUtil
public static long mergeSingleData(long[] dataToMerge)
{
int numberOfChildren = 0;
int numberOfVoidChildren = 0;
int tempAlpha = 0;
int tempRed = 0;
@@ -1,7 +1,5 @@
package com.seibel.lod.util;
import com.seibel.lod.util.LodUtil;
public class LevelPosUtil
{
public static int[] convert(int[] levelPos, byte newDetailLevel)
@@ -7,22 +7,22 @@ public class ThreadMapUtil
{
private static final int NUMBER_OF_DIRECTION = 4;
public static final ConcurrentMap<String, long[]> threadSingleAddDataMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> threadSingleGetDataMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> threadSingleUpdateMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[][]> threadBuilderArrayMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[][][]> threadBuilderVerticalArrayMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> threadVerticalAddDataMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> threadVerticalGetDataMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[][]> threadVerticalUpdateMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, int[]> threadVerticalIndexesMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> threadSingleAddDataMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> threadSingleGetDataMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> threadSingleUpdateMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[][]> threadBuilderArrayMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[][][]> threadBuilderVerticalArrayMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> threadVerticalAddDataMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> threadVerticalGetDataMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[][]> threadVerticalUpdateMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, int[]> threadVerticalIndexesMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> threadAdjData = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> threadAdjData = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, boolean[]> projectionMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, int[][]> heightAndDepthMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, long[]> singleDataToMergeMap = new ConcurrentHashMap();
public static final ConcurrentMap<String, boolean[]> projectionMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, int[][]> heightAndDepthMap = new ConcurrentHashMap<>();
public static final ConcurrentMap<String, long[]> singleDataToMergeMap = new ConcurrentHashMap<>();
public static long[] getSingleAddDataArray()