11package org .dynmap .hdmap ;
22
3- import static org .dynmap .JSONUtils .s ;
4-
5- import org .dynmap .DynmapWorld ;
6-
73import java .util .ArrayList ;
84import java .util .Collections ;
95import java .util .HashSet ;
1410import org .dynmap .ConfigurationNode ;
1511import org .dynmap .DynmapChunk ;
1612import org .dynmap .DynmapCore ;
13+ import org .dynmap .DynmapWorld ;
14+ import static org .dynmap .JSONUtils .s ;
1715import org .dynmap .Log ;
1816import org .dynmap .MapManager ;
1917import org .dynmap .MapTile ;
2018import org .dynmap .MapType ;
2119import org .dynmap .MapTypeState ;
20+ import org .dynmap .hdmap .TexturePack .BlockTransparency ;
2221import org .dynmap .markers .impl .MarkerAPIImpl ;
2322import org .dynmap .renderer .DynmapBlockState ;
2423import org .dynmap .renderer .RenderPatch ;
2524import org .dynmap .renderer .RenderPatchFactory .SideVisible ;
2625import org .dynmap .storage .MapStorage ;
2726import org .dynmap .storage .MapStorageTile ;
2827import org .dynmap .utils .BlockStep ;
29- import org .dynmap .hdmap . TexturePack . BlockTransparency ;
28+ import org .dynmap .utils . DynLongHashMap ;
3029import org .dynmap .utils .DynmapBufferedImage ;
3130import org .dynmap .utils .LightLevels ;
32- import org .dynmap .utils .DynLongHashMap ;
3331import org .dynmap .utils .MapChunkCache ;
3432import org .dynmap .utils .MapIterator ;
3533import 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
0 commit comments