Skip to content

Commit e602ecc

Browse files
committed
More warning cleanup
1 parent e42299d commit e602ecc

7 files changed

Lines changed: 673 additions & 685 deletions

File tree

DynmapCore/src/main/java/org/dynmap/hdmap/InhabitedHDShader.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
package org.dynmap.hdmap;
22

3-
import static org.dynmap.JSONUtils.s;
4-
53
import java.io.IOException;
64
import java.util.HashMap;
75
import java.util.TreeSet;
86

97
import org.dynmap.Color;
108
import org.dynmap.ConfigurationNode;
119
import org.dynmap.DynmapCore;
10+
import static org.dynmap.JSONUtils.s;
1211
import org.dynmap.Log;
1312
import org.dynmap.MapManager;
1413
import org.dynmap.common.DynmapCommandSender;
@@ -50,7 +49,7 @@ public InhabitedHDShader(DynmapCore core, ConfigurationNode configuration) {
5049
}
5150
}
5251
}
53-
TreeSet<Long> keys = new TreeSet<Long>(map.keySet());
52+
TreeSet<Long> keys = new TreeSet<>(map.keySet());
5453
filllevel = new long[keys.size()];
5554
fillcolor = new Color[keys.size()];
5655
int idx = 0;
@@ -98,7 +97,7 @@ public String getName() {
9897

9998
private class OurShaderState implements HDShaderState {
10099
private final Color color[];
101-
private Color c;
100+
private final Color c;
102101
protected HDMap map;
103102
private final HDLighting lighting;
104103
final int[] lightingTable;
@@ -246,9 +245,9 @@ public void addClientConfiguration(JSONObject mapObject) {
246245
public void exportAsMaterialLibrary(DynmapCommandSender sender, OBJExport out) throws IOException {
247246
throw new IOException("Export unsupported");
248247
}
249-
private static final String[] nulllist = new String[0];
248+
private static final String[] NULLLIST = new String[0];
250249
@Override
251250
public String[] getCurrentBlockMaterials(DynmapBlockState blk, MapIterator mapiter, int[] txtidx, BlockStep[] steps) {
252-
return nulllist;
251+
return NULLLIST;
253252
}
254253
}

DynmapCore/src/main/java/org/dynmap/hdmap/IsoHDPerspective.java

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
package org.dynmap.hdmap;
22

3-
import static org.dynmap.JSONUtils.s;
4-
5-
import org.dynmap.DynmapWorld;
6-
73
import java.util.ArrayList;
84
import java.util.Collections;
95
import java.util.HashSet;
@@ -14,22 +10,24 @@
1410
import org.dynmap.ConfigurationNode;
1511
import org.dynmap.DynmapChunk;
1612
import org.dynmap.DynmapCore;
13+
import org.dynmap.DynmapWorld;
14+
import static org.dynmap.JSONUtils.s;
1715
import org.dynmap.Log;
1816
import org.dynmap.MapManager;
1917
import org.dynmap.MapTile;
2018
import org.dynmap.MapType;
2119
import org.dynmap.MapTypeState;
20+
import org.dynmap.hdmap.TexturePack.BlockTransparency;
2221
import org.dynmap.markers.impl.MarkerAPIImpl;
2322
import org.dynmap.renderer.DynmapBlockState;
2423
import org.dynmap.renderer.RenderPatch;
2524
import org.dynmap.renderer.RenderPatchFactory.SideVisible;
2625
import org.dynmap.storage.MapStorage;
2726
import org.dynmap.storage.MapStorageTile;
2827
import org.dynmap.utils.BlockStep;
29-
import org.dynmap.hdmap.TexturePack.BlockTransparency;
28+
import org.dynmap.utils.DynLongHashMap;
3029
import org.dynmap.utils.DynmapBufferedImage;
3130
import org.dynmap.utils.LightLevels;
32-
import org.dynmap.utils.DynLongHashMap;
3331
import org.dynmap.utils.MapChunkCache;
3432
import org.dynmap.utils.MapIterator;
3533
import org.dynmap.utils.Matrix3D;
@@ -455,9 +453,9 @@ private int handlePatch(PatchDefinition pd, int hitcnt) {
455453
return hitcnt;
456454
}
457455
/* Compute parametric value of intercept */
458-
double t = inv_det * pd.v.innerProduct(vS);
459-
if (t > 0.000001) { /* We've got a hit */
460-
patch_t[hitcnt] = t;
456+
double tt = inv_det * pd.v.innerProduct(vS);
457+
if (tt > 0.000001) { /* We've got a hit */
458+
patch_t[hitcnt] = tt;
461459
patch_u[hitcnt] = u;
462460
patch_v[hitcnt] = v;
463461
patch_shade[hitcnt] = pd.shade;
@@ -496,8 +494,8 @@ private boolean handlePatches(RenderPatch[] patches, HDShaderState[] shaderstate
496494
int hitcnt = 0;
497495
int water_hit = Integer.MAX_VALUE; // hit index of first water hit
498496
/* Loop through patches : compute intercept values for each */
499-
for(int i = 0; i < patches.length; i++) {
500-
hitcnt = handlePatch((PatchDefinition)patches[i], hitcnt);
497+
for (RenderPatch patche : patches) {
498+
hitcnt = handlePatch((PatchDefinition) patche, hitcnt);
501499
}
502500
if ((fluidpatches != null) && (fluidpatches.length > 0)) {
503501
int prev_hitcnt = hitcnt;
@@ -608,7 +606,7 @@ else if (cbm.isOnlyBlockStateSensitive()) {
608606
/**
609607
* Process visit of ray to block
610608
*/
611-
private final boolean visit_block(HDShaderState[] shaderstate, boolean[] shaderdone) {
609+
private boolean visit_block(HDShaderState[] shaderstate, boolean[] shaderdone) {
612610
lastblocktype = blocktype;
613611
blocktype = mapiter.getBlockType();
614612
if (skiptoair) { /* If skipping until we see air */
@@ -652,7 +650,7 @@ else if ((model = scalemodels.getScaledModel(blocktype)) != null) {
652650
}
653651

654652
/* Skip empty : return false if exited */
655-
private final boolean raytraceSkipEmpty(MapChunkCache cache) {
653+
private boolean raytraceSkipEmpty(MapChunkCache cache) {
656654
int minsy = cache.getWorld().minY >> 4;
657655
while(cache.isEmptySection(sx, sy, sz)) {
658656
/* If Y step is next best */
@@ -685,7 +683,7 @@ else if((st_next_x <= st_next_y) && (st_next_x <= st_next_z)) {
685683
/**
686684
* Step block iterator: false if done
687685
*/
688-
private final boolean raytraceStepIterator(int miny, int maxy) {
686+
private boolean raytraceStepIterator(int miny, int maxy) {
689687
/* If Y step is next best */
690688
if ((t_next_y <= t_next_x) && (t_next_y <= t_next_z)) {
691689
y += y_inc;
@@ -1076,7 +1074,7 @@ public IsoHDPerspective(DynmapCore core, ConfigurationNode configuration) {
10761074

10771075
@Override
10781076
public List<TileFlags.TileCoord> getTileCoords(DynmapWorld world, int x, int y, int z, int tilescale) {
1079-
HashSet<TileFlags.TileCoord> tiles = new HashSet<TileFlags.TileCoord>();
1077+
HashSet<TileFlags.TileCoord> tiles = new HashSet<>();
10801078
Vector3D block = new Vector3D();
10811079
block.x = x;
10821080
block.y = y;
@@ -1099,12 +1097,12 @@ public List<TileFlags.TileCoord> getTileCoords(DynmapWorld world, int x, int y,
10991097
block.y = inity;
11001098
block.x += 1;
11011099
}
1102-
return new ArrayList<TileFlags.TileCoord>(tiles);
1100+
return new ArrayList<>(tiles);
11031101
}
11041102

11051103
@Override
11061104
public List<TileFlags.TileCoord> getTileCoords(DynmapWorld world, int minx, int miny, int minz, int maxx, int maxy, int maxz, int tilescale) {
1107-
ArrayList<TileFlags.TileCoord> tiles = new ArrayList<TileFlags.TileCoord>();
1105+
ArrayList<TileFlags.TileCoord> tiles = new ArrayList<>();
11081106
Vector3D blocks[] = new Vector3D[] { new Vector3D(), new Vector3D() };
11091107
blocks[0].x = minx - 1;
11101108
blocks[0].y = miny - 1;
@@ -1194,7 +1192,7 @@ public List<DynmapChunk> getRequiredChunks(MapTile tile) {
11941192
* 6 = bottom-upper-right (XYz),
11951193
* 7 = top-upper-right (XYZ) */
11961194
Vector3D corners[] = new Vector3D[8];
1197-
double dx = -basemodscale, dy = -basemodscale; /* Add 1 block on each axis */
1195+
double dx = -basemodscale, dy; /* Add 1 block on each axis */
11981196
for(int x = t.tx, idx = 0; x <= (t.tx+1); x++) {
11991197
dy = -basemodscale;
12001198
for(int y = t.ty; y <= (t.ty+1); y++) {
@@ -1229,7 +1227,7 @@ public List<DynmapChunk> getRequiredChunks(MapTile tile) {
12291227
}
12301228
}
12311229
/* Now, need to walk through the min/max range to see which chunks are actually needed */
1232-
ArrayList<DynmapChunk> chunks = new ArrayList<DynmapChunk>();
1230+
ArrayList<DynmapChunk> chunks = new ArrayList<>();
12331231

12341232
for(int x = min_chunk_x; x <= max_chunk_x; x++) {
12351233
for(int z = min_chunk_z; z <= max_chunk_z; z++) {
@@ -1340,7 +1338,6 @@ public boolean render(MapChunkCache cache, HDMapTile tile, String mapname) {
13401338
ps.raytrace(cache, shaderstate, shaderdone);
13411339
} catch (Exception ex) {
13421340
Log.severe("Error while raytracing tile: perspective=" + this.name + ", coord=" + mapiter.getX() + "," + mapiter.getY() + "," + mapiter.getZ() + ", blockid=" + mapiter.getBlockType() + ", lighting=" + mapiter.getBlockSkyLight() + ":" + mapiter.getBlockEmittedLight() + ", biome=" + mapiter.getBiome().toString(), ex);
1343-
ex.printStackTrace();
13441341
}
13451342
final int rowOffset = (tilePixelSize - y - 1) * tilePixelSize + x;
13461343
for(int i = 0; i < numshaders; i++) {
@@ -1469,7 +1466,7 @@ public String getName() {
14691466
return name;
14701467
}
14711468

1472-
private static String[] directions = { "N", "NE", "E", "SE", "S", "SW", "W", "NW" };
1469+
private static final String[] directions = { "N", "NE", "E", "SE", "S", "SW", "W", "NW" };
14731470
@Override
14741471
public void addClientConfiguration(JSONObject mapObject) {
14751472
s(mapObject, "perspective", name);
@@ -1482,7 +1479,7 @@ public void addClientConfiguration(JSONObject mapObject) {
14821479
s(mapObject, "compassview", directions[dir]);
14831480
}
14841481

1485-
private static final int fastFloor(double f) {
1482+
private static int fastFloor(double f) {
14861483
return ((int)(f + 1000000000.0)) - 1000000000;
14871484
}
14881485

DynmapCore/src/main/java/org/dynmap/hdmap/ShadowHDLighting.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public ShadowHDLighting(DynmapCore core, ConfigurationNode configuration) {
4545
smooth = configuration.getBoolean("smooth-lighting", MapManager.mapman.getSmoothLighting());
4646
}
4747

48-
private void applySmoothLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor, Color[] outcolor, int[] shadowscale) {
48+
private void applySmoothLighting(HDPerspectiveState ps, Color incolor, Color[] outcolor, int[] shadowscale) {
4949
int[] xyz = ps.getSubblockCoord();
5050
int scale = (int)ps.getScale();
5151
int mid = scale / 2;
@@ -141,7 +141,7 @@ public void applyLighting(HDPerspectiveState ps, HDShaderState ss, Color incolor
141141
shadowscale = defLightingTable;
142142
}
143143
if(smooth && ps.getShade()) {
144-
applySmoothLighting(ps, ss, incolor, outcolor, shadowscale);
144+
applySmoothLighting(ps, incolor, outcolor, shadowscale);
145145
checkGrayscale(outcolor);
146146
return;
147147
}

0 commit comments

Comments
 (0)