Skip to content

Commit

Permalink
fix polymer RPs on windows (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
aws404 authored Nov 28, 2021
1 parent 3f5bc76 commit 29c5bea
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public class DefaultRPBuilder implements InternalRPBuilder {
private final Path outputPath;
private ZipFile clientJar = null;
private final List<ModContainer> modsList = new ArrayList<>();
private Map<Identifier, List<PolymerModelData>> customModelData = new HashMap<>();
private final Map<Identifier, List<PolymerModelData>> customModelData = new HashMap<>();


public DefaultRPBuilder(Path outputPath) {
Expand Down Expand Up @@ -98,7 +98,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO

var bytes = Files.readAllBytes(file);

fileMap.put(relative.toString(), bytes);
fileMap.put(relative.toString().replace("\\", "/"), bytes);

return FileVisitResult.CONTINUE;
}
Expand Down Expand Up @@ -141,7 +141,7 @@ public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IO

var bytes = Files.readAllBytes(file);

fileMap.put("assets/" + relative, bytes);
fileMap.put("assets/" + relative.toString().replace("\\", "/"), bytes);

return FileVisitResult.CONTINUE;
}
Expand Down Expand Up @@ -194,7 +194,7 @@ public boolean addCustomModelData(PolymerModelData cmdInfo) {
JsonObject modelObject = null;
var modelPath = "assets/" + cmdInfo.modelPath().getNamespace() + "/models/" + cmdInfo.modelPath().getPath() + ".json";

if (modelObject == null && this.fileMap.containsKey(modelPath)) {
if (this.fileMap.containsKey(modelPath)) {
modelObject = JsonParser.parseString(new String(this.fileMap.get(modelPath), StandardCharsets.UTF_8)).getAsJsonObject();
}

Expand Down Expand Up @@ -285,7 +285,6 @@ public CompletableFuture<Boolean> buildResourcePack() {
for (Map.Entry<Item, JsonArray> entry : this.models.entrySet()) {
Identifier id = Registry.ITEM.getId(entry.getKey());
try {
String basePath = "assets/" + id.getNamespace() + "/models/item/";
JsonObject modelObject;

String baseModelPath;
Expand Down Expand Up @@ -476,7 +475,6 @@ public CompletableFuture<Boolean> buildResourcePack() {

this.fileMap.put("polymer-about.txt", String.join("\n", credits).getBytes(StandardCharsets.UTF_8));


{
var outputStream = new ZipOutputStream(new FileOutputStream(this.outputPath.toFile()));

Expand Down

0 comments on commit 29c5bea

Please sign in to comment.