Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

remove redundant reloading

Lera d79fabf4 39d79d6a

+19 -3
+1
CHANGELOG-LATEST.md
··· 16 16 17 17 ### Fixes 18 18 - Random dimensions can once again use fluids other than water for their generation. 19 + - Music discs on 1.21.8 are now correctly tinted and actually play. 19 20 - Corals no longer crash world generation. (Cass) 20 21 - Custom packets are correctly registered on the client. (Cass, 1.21.1 Neoforge) 21 22 - The 11th amendment was changed to blacklist bumblezone biomes instead of structures.
+8 -3
src/main/java/net/lerariemann/infinity/util/config/SoundScanner.java
··· 107 107 } catch (IOException e) { 108 108 length = 600; 109 109 } 110 - jukeboxes.put(arr.get(arr.size()-1), getJukeboxDef(songID, subtitleID, length)); 110 + jukeboxes.put(arr.getLast(), getJukeboxDef(songID, subtitleID, length)); 111 111 } 112 112 }); 113 - CommonIO.write(soundsForRP, client.getResourcePackDirectory().resolve("infinity/assets/infinity"), "sounds.json"); 113 + 114 + Path dir = client.getResourcePackDirectory().resolve("infinity/assets/infinity"); 115 + String filename = "sounds.json"; 116 + String oldContents = CommonIO.readAsString(dir.resolve(filename).toFile()); 117 + CommonIO.write(soundsForRP, dir, filename); 118 + String newContents = CommonIO.readAsString(dir.resolve(filename).toFile()); 114 119 if (InfinityPlatform.version <= 21) 115 120 CommonIO.write(subtitlesForRP, client.getResourcePackDirectory().resolve("infinity/assets/infinity/lang"), "en_us.json"); 116 - client.reloadResourcePacks(); 121 + if (!Objects.equals(oldContents, newContents)) client.reloadResourcePacks(); 117 122 return jukeboxes; 118 123 } 119 124
+10
src/main/java/net/lerariemann/infinity/util/core/CommonIO.java
··· 97 97 throw new RuntimeException(e); 98 98 } 99 99 } 100 + static String readAsString(File file) { 101 + try { 102 + if (file.exists()) { 103 + return FileUtils.readFileToString(file, StandardCharsets.UTF_8); 104 + } 105 + return ""; 106 + } catch (IOException e) { 107 + return ""; 108 + } 109 + } 100 110 101 111 static CompoundTag readAndFormat(String path, Object... args) { 102 112 File file = new File(path);