Skip to content

Commit f087c72

Browse files
committed
fix url texture loader
1 parent f19cf0a commit f087c72

File tree

3 files changed

+34
-5
lines changed

3 files changed

+34
-5
lines changed

CHANGELOG.md

+20-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
# Changelog
2+
23
Changelog to track updates for this mod.
3-
Add your changes to Unreleased if you want to commit.
4-
Please write according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
4+
Add your changes to Unreleased if you want to commit.
5+
Please write according to [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
56

67
## [Unreleased]
78

89
### Added
910

1011
### Changed
1112

13+
- Fixed a bug in the URL texture loader
14+
1215
### Deprecated
1316

1417
### Removed
@@ -20,47 +23,62 @@ Changelog to track updates for this mod.
2023
## [3.6.0-alpha.1] - 2023-03-22
2124

2225
### Changed
26+
2327
- Port 1.19.4
2428

2529
## [3.5.0] - 2023-03-19
2630

2731
### Changed
32+
2833
- Update CrossDataGenerator
2934
- Changes to rendering processing
3035

3136
## [3.4.0] - 2023-01-25
3237

3338
### Added
39+
3440
- Add living tick event
3541

3642
## [3.3.0] - 2023-01-24
3743

3844
### Added
45+
3946
- Add new utility class
4047

4148
## [3.3.0-beta.1] - 2023-01-22
4249

4350
### Changed
51+
4452
- Port MC1.19.3
4553

4654
### Removed
55+
4756
- Separated Fabric's built-in OBJ loader ([Special Model Loader](https://github.com/TeamFelnull/SpecialModelLoader))
4857

4958
### Fixed
59+
5060
- Fixed a problem that crashes without notifying when Architecture is not installed (Forge Only)
5161

5262
## [3.3.0-alpha.1] - 2023-01-18
5363

5464
### Changed
65+
5566
- Port MC1.19.3
5667

5768
### Removed
69+
5870
- Separated Fabric's built-in OBJ loader ([Special Model Loader](https://github.com/TeamFelnull/SpecialModelLoader))
5971

6072
[Unreleased]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.6.0-alpha.1...HEAD
73+
6174
[3.6.0-alpha.1]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.5.0...v3.6.0-alpha.1
75+
6276
[3.5.0]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.4.0...v3.5.0
77+
6378
[3.4.0]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0...v3.4.0
79+
6480
[3.3.0]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0-beta.1...v3.3.0
81+
6582
[3.3.0-alpha.1]: https://github.com/TeamFelnull/OtyacraftEngine/commits/v3.3.0-alpha.1
83+
6684
[3.3.0-beta.1]: https://github.com/TeamFelnull/OtyacraftEngine/compare/v3.3.0-alpha.1...v3.3.0-beta.1

common/src/main/java/dev/felnull/otyacraftengine/client/renderer/texture/impl/URLTextureManagerImpl.java

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package dev.felnull.otyacraftengine.client.renderer.texture.impl;
22

33
import com.google.gson.JsonObject;
4+
import com.google.gson.JsonParseException;
45
import dev.felnull.fnjl.util.FNDataUtil;
56
import dev.felnull.fnjl.util.FNStringUtil;
67
import dev.felnull.fnjl.util.FNURLUtil;
@@ -52,7 +53,14 @@ private void load() {
5253
JsonObject index;
5354

5455
try {
55-
index = OEUtils.readJson(urlIndex, JsonObject.class);
56+
if (urlIndex.exists()) {
57+
index = OEUtils.readJson(urlIndex, JsonObject.class);
58+
} else {
59+
index = new JsonObject();
60+
}
61+
} catch (JsonParseException e) {
62+
OtyacraftEngine.LOGGER.error("url texture cache index file is corrupt and will be removed", e);
63+
index = new JsonObject();
5664
} catch (IOException e) {
5765
OtyacraftEngine.LOGGER.error("Failed to load url texture cache indexes", e);
5866
return;
@@ -112,6 +120,9 @@ private void optimize() {
112120

113121
@Override
114122
public synchronized void save() {
123+
if (caches.isEmpty())
124+
return;
125+
115126
long st = System.currentTimeMillis();
116127
var fol = getCacheFolderPath().toFile();
117128

gradle.properties

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ enabled_platforms=fabric,forge
77
#Mod
88
archives_base_name=otyacraftengine
99
mod_display_name=OtyacraftEngine
10-
mod_version=3.6.0-alpha.2.pre.1
10+
mod_version=3.6.0
1111
#Dependencies
1212
architectury_version=8.1.73
1313
fabric_loader_version=0.14.17
@@ -17,7 +17,7 @@ felnull_version=1.75
1717
#Upload
1818
curesforge_id=400337
1919
modrinth_id=iu3upNjC
20-
release_type=alpha
20+
release_type=release
2121
maven_put_url=https://maven.felnull.dev/
2222
maven_group=dev.felnull
2323
maven_put_pass=

0 commit comments

Comments
 (0)