31
31
* A map that uses the RenderService for rendering the tiles.
32
32
*/
33
33
public class ChunkyMap extends HDMap {
34
- private static final String DEFAULT_TEXTUREPACK_VERSION = "1.16.1 " ;
34
+ private static final String DEFAULT_TEXTUREPACK_VERSION = "1.16.2 " ;
35
35
public final DynmapCameraAdapter cameraAdapter ;
36
36
private final Renderer renderer ;
37
37
private File defaultTexturepackPath ;
@@ -52,17 +52,19 @@ public ChunkyMap(DynmapCore dynmap, ConfigurationNode config) {
52
52
chunkPadding = config .getInteger ("chunkPadding" , 0 );
53
53
54
54
String texturepackVersion = config .getString ("texturepackVersion" , DEFAULT_TEXTUREPACK_VERSION );
55
- ChunkyMapPlugin .getPlugin (ChunkyMapPlugin .class ).getLogger ()
56
- .info ("Downloading additional textures for Minecraft " + texturepackVersion );
57
- try (Response response = MinecraftDownloader .downloadMinecraft (texturepackVersion ).get ()) {
58
- File tempFile = File .createTempFile ("minecraft" , ".jar" );
59
- try (BufferedSink sink = Okio .buffer (Okio .sink (tempFile ))) {
60
- sink .writeAll (response .body ().source ());
61
- }
62
- defaultTexturepackPath = tempFile ;
63
- } catch (IOException | ExecutionException | InterruptedException e ) {
64
- ChunkyMapPlugin .getPlugin (ChunkyMapPlugin .class ).getLogger ()
65
- .log (Level .SEVERE , "Downloading the textures failed, your Chunky dynmap might look bad!" , e );
55
+ File texturepackPath = new File (ChunkyMapPlugin .getPlugin (ChunkyMapPlugin .class ).getDataFolder (), texturepackVersion + ".jar" );
56
+ if (!texturepackPath .exists ()) {
57
+ ChunkyMapPlugin .getPlugin (ChunkyMapPlugin .class ).getLogger ()
58
+ .info ("Downloading additional textures for Minecraft " + texturepackVersion );
59
+ try (Response response = MinecraftDownloader .downloadMinecraft (texturepackVersion ).get ()) {
60
+ try (BufferedSink sink = Okio .buffer (Okio .sink (texturepackPath ))) {
61
+ sink .writeAll (response .body ().source ());
62
+ }
63
+ defaultTexturepackPath = texturepackPath ;
64
+ } catch (IOException | ExecutionException | InterruptedException e ) {
65
+ ChunkyMapPlugin .getPlugin (ChunkyMapPlugin .class ).getLogger ()
66
+ .log (Level .SEVERE , "Downloading the textures failed, your Chunky dynmap might look bad!" , e );
67
+ }
66
68
}
67
69
68
70
if (config .containsKey ("texturepack" )) {
0 commit comments