mirror of
https://github.com/Sollace/Unicopia.git
synced 2025-02-01 11:36:43 +01:00
Fixed asset walker not respecting the chosen namespace
This commit is contained in:
parent
f5e6cf49f1
commit
76a725c981
1 changed files with 5 additions and 2 deletions
|
@ -38,12 +38,15 @@ public class AssetWalker {
|
||||||
|
|
||||||
private final String loadLocation;
|
private final String loadLocation;
|
||||||
|
|
||||||
|
private final String namespace;
|
||||||
|
|
||||||
private final JsonConsumer consumer;
|
private final JsonConsumer consumer;
|
||||||
|
|
||||||
public AssetWalker(ResourceLocation assetLocation, JsonConsumer consumer) {
|
public AssetWalker(ResourceLocation assetLocation, JsonConsumer consumer) {
|
||||||
this.consumer = consumer;
|
this.consumer = consumer;
|
||||||
|
this.namespace = assetLocation.getNamespace();
|
||||||
|
|
||||||
loadLocation = "/assets/" + assetLocation.getNamespace() + "/" + assetLocation.getPath();
|
loadLocation = "/assets/" + namespace + "/" + assetLocation.getPath();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void walk() {
|
public void walk() {
|
||||||
|
@ -86,7 +89,7 @@ public class AssetWalker {
|
||||||
Path i = iterator.next();
|
Path i = iterator.next();
|
||||||
|
|
||||||
if ("json".equals(FilenameUtils.getExtension(i.toString()))) {
|
if ("json".equals(FilenameUtils.getExtension(i.toString()))) {
|
||||||
ResourceLocation id = new ResourceLocation(FilenameUtils.removeExtension(path.relativize(i).toString()).replaceAll("\\\\", "/"));
|
ResourceLocation id = new ResourceLocation(namespace, FilenameUtils.removeExtension(path.relativize(i).toString()).replaceAll("\\\\", "/"));
|
||||||
|
|
||||||
try(BufferedReader bufferedreader = Files.newBufferedReader(i)) {
|
try(BufferedReader bufferedreader = Files.newBufferedReader(i)) {
|
||||||
consumer.accept(id, JsonUtils.fromJson(GSON, bufferedreader, JsonObject.class));
|
consumer.accept(id, JsonUtils.fromJson(GSON, bufferedreader, JsonObject.class));
|
||||||
|
|
Loading…
Reference in a new issue