From b5bcab36cd200697072b0fcfe434e5ab6e6e790d Mon Sep 17 00:00:00 2001 From: cola98765 Date: Sun, 17 Oct 2021 11:53:47 +0200 Subject: [PATCH] cleaned a bit of code --- .../bufferBuilding/lodTemplates/Box.java | 34 +++---------------- .../lod/builders/lodBuilding/LodBuilder.java | 2 +- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/seibel/lod/builders/bufferBuilding/lodTemplates/Box.java b/src/main/java/com/seibel/lod/builders/bufferBuilding/lodTemplates/Box.java index 2a551918a..a9e3ccd30 100644 --- a/src/main/java/com/seibel/lod/builders/bufferBuilding/lodTemplates/Box.java +++ b/src/main/java/com/seibel/lod/builders/bufferBuilding/lodTemplates/Box.java @@ -50,9 +50,7 @@ public class Box Direction.SOUTH, Direction.NORTH }; - /** - * All the faces and vertices of a cube. This is used to extract the vertex from the column - */ + /** All the faces and vertices of a cube. This is used to extract the vertex from the column */ public static final Map DIRECTION_VERTEX_MAP = new HashMap() {{ put(Direction.UP, new int[][] { @@ -117,9 +115,7 @@ public class Box put(Direction.NORTH, Direction.NORTH.getNormal()); }}; - /** - * We use this index for all array that are going to - */ + /** We use this index for all array that are going to */ public static final Map DIRECTION_INDEX = new HashMap() {{ put(Direction.UP, 0); @@ -192,11 +188,7 @@ public class Box culling = new boolean[6]; } - /** - * Set the light of the columns - * @param skyLight - * @param blockLight - */ + /** Set the light of the columns */ public void setLights(int skyLight, int blockLight) { this.blockLight = (byte) blockLight; @@ -227,13 +219,9 @@ public class Box public int getColor(Direction direction) { if (LodConfig.CLIENT.debugging.debugMode.get() != DebugMode.SHOW_DETAIL) - { return colorMap[DIRECTION_INDEX.get(direction)]; - } else - { return ColorUtil.applyShade(color, MinecraftWrapper.INSTANCE.getClientWorld().getShade(direction, true)); - } } /** @@ -276,13 +264,11 @@ public class Box for (Direction direction : DIRECTIONS) { if (direction == Direction.DOWN || direction == Direction.WEST || direction == Direction.NORTH) - { culling[DIRECTION_INDEX.get(direction)] = playerPos.get(direction.getAxis()) > getFacePos(direction) + cullingDistance; - } + else if (direction == Direction.UP || direction == Direction.EAST || direction == Direction.SOUTH) - { culling[DIRECTION_INDEX.get(direction)] = playerPos.get(direction.getAxis()) < getFacePos(direction) - cullingDistance; - } + culling[DIRECTION_INDEX.get(direction)] = false; } } @@ -498,9 +484,7 @@ public class Box public boolean shouldRenderFace(Direction direction, int adjIndex) { if (direction == Direction.UP || direction == Direction.DOWN) - { return adjIndex == 0; - } return !(adjHeight.get(direction)[adjIndex] == VOID_FACE && adjDepth.get(direction)[adjIndex] == VOID_FACE); } @@ -534,21 +518,15 @@ public class Box public int getY(Direction direction, int vertexIndex, int adjIndex) { if (direction == Direction.DOWN || direction == Direction.UP) - { return boxOffset[Y] + boxWidth[Y] * DIRECTION_VERTEX_MAP.get(direction)[vertexIndex][Y]; - } else { // this could probably be cleaned up more, // but it still works if (1 - DIRECTION_VERTEX_MAP.get(direction)[vertexIndex][Y] == ADJACENT_HEIGHT_INDEX) - { return adjHeight.get(direction)[adjIndex]; - } else - { return adjDepth.get(direction)[adjIndex]; - } } } @@ -562,8 +540,6 @@ public class Box return boxOffset[Z] + boxWidth[Z] * DIRECTION_VERTEX_MAP.get(direction)[vertexIndex][Z]; } - - public int getMinX() { return boxOffset[X]; diff --git a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java index 521344f28..a8b4b7562 100644 --- a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java @@ -701,7 +701,7 @@ public class LodBuilder if (toTint.get(blockState.getBlock())) { - int tintValue = 0; + int tintValue; if (useGrassTint(blockState.getBlock())) // grass and green plants tintValue = biome.getGrassColor(x, z);