Skip to content

Commit

Permalink
Stupid hack to get the resource loading working
Browse files Browse the repository at this point in the history
  • Loading branch information
tyra314 committed Jul 22, 2021
1 parent 3346366 commit 8e360b9
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 36 deletions.
12 changes: 7 additions & 5 deletions src/main/java/hunternif/mc/impl/atlas/client/TextureConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,18 @@ public CompletableFuture<Map<ResourceLocation, ITexture>> load(IResourceManager

@Override
public CompletableFuture<Void> apply(Map<ResourceLocation, ITexture> textures, IResourceManager manager, IProfiler profiler, Executor executor) {
for (Map.Entry<ResourceLocation, ITexture> entry : textures.entrySet()) {
texture_map.put(entry.getKey(), entry.getValue());
Log.info("Loaded texture %s with path %s", entry.getKey(), entry.getValue().getTexture());
}

return CompletableFuture.runAsync(() -> {
for (Map.Entry<ResourceLocation, ITexture> entry : textures.entrySet()) {
texture_map.put(entry.getKey(), entry.getValue());
Log.info("Loaded texture %s with path %s", entry.getKey(), entry.getValue().getTexture());
}

});
}

// @Override
// public ResourceLocation getFabricId() {
// return new ResourceLocation("antiqueatlas:textures");
// }
}
}
38 changes: 20 additions & 18 deletions src/main/java/hunternif/mc/impl/atlas/client/TextureSetConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -125,27 +125,29 @@ public CompletableFuture<Collection<TextureSet>> load(IResourceManager manager,

@Override
public CompletableFuture<Void> apply(Collection<TextureSet> sets, IResourceManager manager, IProfiler profiler, Executor executor) {
return CompletableFuture.runAsync(() -> {
for (TextureSet set : sets) {
try {
set.loadTextures();
textureSetMap.register(set);
Log.info("Loaded texture set %s with %d custom texture(s)", set.name, set.getTexturePaths().length);
}
catch (Throwable e) {
Log.error(e, "Failed to load the texture set `%s`:", set.name);
}
for (TextureSet set : sets) {
try {
set.loadTextures();
textureSetMap.register(set);
Log.info("Loaded texture set %s with %d custom texture(s)", set.name, set.getTexturePaths().length);
}
catch (Throwable e) {
Log.error(e, "Failed to load the texture set `%s`:", set.name);
}
}

for (TextureSet set : sets) {
set.checkStitching();

if (set instanceof TextureSet.TextureSetShore) {
TextureSet.TextureSetShore texture = (TextureSet.TextureSetShore) set;
texture.loadWater();
Log.info("Loaded water texture `%s` for shore texture `%s` texture", texture.waterName, texture.name);
}
for (TextureSet set : sets) {
set.checkStitching();

if (set instanceof TextureSet.TextureSetShore) {
TextureSet.TextureSetShore texture = (TextureSet.TextureSetShore) set;
texture.loadWater();
Log.info("Loaded water texture `%s` for shore texture `%s` texture", texture.waterName, texture.name);
}
}

return CompletableFuture.runAsync(() -> {

});
}

Expand Down
28 changes: 15 additions & 13 deletions src/main/java/hunternif/mc/impl/atlas/client/TileTextureConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -84,21 +84,23 @@ public CompletableFuture<Map<ResourceLocation, ResourceLocation>> load(IResource

@Override
public CompletableFuture<Void> apply(Map<ResourceLocation, ResourceLocation> tileMap, IResourceManager manager, IProfiler profiler, Executor executor) {
return CompletableFuture.runAsync(() -> {
for (Map.Entry<ResourceLocation, ResourceLocation> entry : tileMap.entrySet()) {
ResourceLocation tile_id = entry.getKey();
ResourceLocation texture_set = entry.getValue();
TextureSet set = textureSetMap.getByName(entry.getValue());

if(set == null) {
AntiqueAtlasMod.LOG.error("Missing texture set `{}` for tile `{}`. Using default.", texture_set, tile_id);
for (Map.Entry<ResourceLocation, ResourceLocation> entry : tileMap.entrySet()) {
ResourceLocation tile_id = entry.getKey();
ResourceLocation texture_set = entry.getValue();
TextureSet set = textureSetMap.getByName(entry.getValue());

set = tileTextureMap.getDefaultTexture();
}
if(set == null) {
AntiqueAtlasMod.LOG.error("Missing texture set `{}` for tile `{}`. Using default.", texture_set, tile_id);

tileTextureMap.setTexture(entry.getKey(), set);
Log.info("Using texture set %s for tile %s", set.name, tile_id);
set = tileTextureMap.getDefaultTexture();
}

tileTextureMap.setTexture(entry.getKey(), set);
Log.info("Using texture set %s for tile %s", set.name, tile_id);
}

return CompletableFuture.runAsync(() -> {

});
}

Expand All @@ -111,4 +113,4 @@ public CompletableFuture<Void> apply(Map<ResourceLocation, ResourceLocation> til
// public Collection<ResourceLocation> getFabricDependencies() {
// return Collections.singleton(new ResourceLocation("antiqueatlas:texture_sets"));
// }
}
}

0 comments on commit 8e360b9

Please sign in to comment.