From cbf1b832aa59a1497708b8a228d71289418e1e1a Mon Sep 17 00:00:00 2001 From: Plancke Date: Thu, 26 Jul 2018 08:31:24 -0400 Subject: [PATCH] File separator instead of backslash and slash --- .../hypixel/resourcepack/impl/AnimationConverter.java | 7 ++++--- .../hypixel/resourcepack/impl/BlockStateConverter.java | 5 +++-- .../net/hypixel/resourcepack/impl/MapIconConverter.java | 5 +++-- .../net/hypixel/resourcepack/impl/ModelConverter.java | 5 +++-- .../net/hypixel/resourcepack/impl/NameConverter.java | 9 +++++---- .../net/hypixel/resourcepack/impl/ParticleConverter.java | 5 +++-- .../net/hypixel/resourcepack/impl/SoundsConverter.java | 7 ++++--- 7 files changed, 25 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/hypixel/resourcepack/impl/AnimationConverter.java b/src/main/java/net/hypixel/resourcepack/impl/AnimationConverter.java index 6d27829f..b5b4b670 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/AnimationConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/AnimationConverter.java @@ -3,10 +3,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; import net.hypixel.resourcepack.Util; +import net.hypixel.resourcepack.pack.Pack; +import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; @@ -17,8 +18,8 @@ public class AnimationConverter extends Converter { @Override public void convert(PackConverter main, Pack pack) throws IOException { - fixAnimations(pack.getWorkingPath().resolve("assets\\minecraft\\textures\\block")); - fixAnimations(pack.getWorkingPath().resolve("assets\\minecraft\\textures\\item")); + fixAnimations(pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "textures" + File.separator + "block")); + fixAnimations(pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "textures" + File.separator + "item")); } protected void fixAnimations(Path animations) throws IOException { diff --git a/src/main/java/net/hypixel/resourcepack/impl/BlockStateConverter.java b/src/main/java/net/hypixel/resourcepack/impl/BlockStateConverter.java index 746f9c24..31add16e 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/BlockStateConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/BlockStateConverter.java @@ -4,10 +4,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; import net.hypixel.resourcepack.Util; +import net.hypixel.resourcepack.pack.Pack; +import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; @@ -19,7 +20,7 @@ public class BlockStateConverter extends Converter { @Override public void convert(PackConverter main, Pack pack) throws IOException { - Path states = pack.getWorkingPath().resolve("assets\\minecraft\\blockstates"); + Path states = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "blockstates"); if (!states.toFile().exists()) return; Files.list(states) diff --git a/src/main/java/net/hypixel/resourcepack/impl/MapIconConverter.java b/src/main/java/net/hypixel/resourcepack/impl/MapIconConverter.java index 14f7ef6d..322d851f 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/MapIconConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/MapIconConverter.java @@ -1,13 +1,14 @@ package net.hypixel.resourcepack.impl; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; import net.hypixel.resourcepack.Util; +import net.hypixel.resourcepack.pack.Pack; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; import java.nio.file.Path; import java.util.HashMap; @@ -32,7 +33,7 @@ public MapIconConverter() { @Override public void convert(PackConverter main, Pack pack) throws IOException { - Path imagePath = pack.getWorkingPath().resolve("assets/minecraft/textures/map/map_icons.png"); + Path imagePath = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "textures" + File.separator + "map" + File.separator + "map_icons.png"); if (!imagePath.toFile().exists()) return; BufferedImage newImage = Util.readImageResource("/map_icons.png"); diff --git a/src/main/java/net/hypixel/resourcepack/impl/ModelConverter.java b/src/main/java/net/hypixel/resourcepack/impl/ModelConverter.java index 109235b8..0b5ff7b4 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/ModelConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/ModelConverter.java @@ -3,10 +3,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; import net.hypixel.resourcepack.Util; +import net.hypixel.resourcepack.pack.Pack; +import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; @@ -18,7 +19,7 @@ public class ModelConverter extends Converter { @Override public void convert(PackConverter main, Pack pack) throws IOException { - Path models = pack.getWorkingPath().resolve("assets\\minecraft\\models"); + Path models = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "models"); remapModelJson(main, models.resolve("block")); remapModelJson(main, models.resolve("item")); diff --git a/src/main/java/net/hypixel/resourcepack/impl/NameConverter.java b/src/main/java/net/hypixel/resourcepack/impl/NameConverter.java index 225a3a8f..af1b4a54 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/NameConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/NameConverter.java @@ -3,10 +3,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; import net.hypixel.resourcepack.Util; +import net.hypixel.resourcepack.pack.Pack; +import java.io.File; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; @@ -20,16 +21,16 @@ public class NameConverter extends Converter { @Override public void convert(PackConverter main, Pack pack) throws IOException { - Path models = pack.getWorkingPath().resolve("assets\\minecraft\\models"); + Path models = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "models"); if (models.resolve("blocks").toFile().exists()) Files.move(models.resolve("blocks"), models.resolve("block")); renameAll(blockMapping, ".json", models.resolve("block")); if (models.resolve("items").toFile().exists()) Files.move(models.resolve("items"), models.resolve("item")); renameAll(itemMapping, ".json", models.resolve("item")); - Path blockStates = pack.getWorkingPath().resolve("assets\\minecraft\\blockstates"); + Path blockStates = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "blockstates"); renameAll(itemMapping, ".json", blockStates); - Path textures = pack.getWorkingPath().resolve("assets\\minecraft\\textures"); + Path textures = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "textures"); if (textures.resolve("blocks").toFile().exists()) Files.move(textures.resolve("blocks"), textures.resolve("block")); renameAll(blockMapping, ".png", textures.resolve("block")); renameAll(blockMapping, ".png.mcmeta", textures.resolve("block")); diff --git a/src/main/java/net/hypixel/resourcepack/impl/ParticleConverter.java b/src/main/java/net/hypixel/resourcepack/impl/ParticleConverter.java index f6338ee6..33dfc610 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/ParticleConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/ParticleConverter.java @@ -1,12 +1,13 @@ package net.hypixel.resourcepack.impl; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; +import net.hypixel.resourcepack.pack.Pack; import javax.imageio.ImageIO; import java.awt.*; import java.awt.image.BufferedImage; +import java.io.File; import java.io.IOException; import java.nio.file.Path; @@ -14,7 +15,7 @@ public class ParticleConverter extends Converter { @Override public void convert(PackConverter main, Pack pack) throws IOException { - Path imagePath = pack.getWorkingPath().resolve("assets/minecraft/textures/particle/particles.png"); + Path imagePath = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "textures" + File.separator + "particle" + File.separator + "particles.png"); if (!imagePath.toFile().exists()) return; BufferedImage image = ImageIO.read(imagePath.toFile()); diff --git a/src/main/java/net/hypixel/resourcepack/impl/SoundsConverter.java b/src/main/java/net/hypixel/resourcepack/impl/SoundsConverter.java index 5e75a7d1..0bbefbc1 100644 --- a/src/main/java/net/hypixel/resourcepack/impl/SoundsConverter.java +++ b/src/main/java/net/hypixel/resourcepack/impl/SoundsConverter.java @@ -4,10 +4,11 @@ import com.google.gson.JsonElement; import com.google.gson.JsonObject; import net.hypixel.resourcepack.Converter; -import net.hypixel.resourcepack.pack.Pack; import net.hypixel.resourcepack.PackConverter; import net.hypixel.resourcepack.Util; +import net.hypixel.resourcepack.pack.Pack; +import java.io.File; import java.io.IOException; import java.nio.charset.Charset; import java.nio.file.Files; @@ -19,7 +20,7 @@ public class SoundsConverter extends Converter { @Override public void convert(PackConverter main, Pack pack) throws IOException { - Path soundsJsonPath = pack.getWorkingPath().resolve("assets/minecraft/sounds.json"); + Path soundsJsonPath = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "sounds.json"); if (!soundsJsonPath.toFile().exists()) return; JsonObject sounds = Util.readJson(soundsJsonPath); @@ -35,7 +36,7 @@ public void convert(PackConverter main, Pack pack) throws IOException { for (JsonElement jsonElement : soundsArray) { String sound; - Path baseSoundsPath = pack.getWorkingPath().resolve("assets/minecraft/sounds/"); + Path baseSoundsPath = pack.getWorkingPath().resolve("assets" + File.separator + "minecraft" + File.separator + "sounds"); Path path = baseSoundsPath.resolve(jsonElement.getAsString() + ".ogg"); if (!Util.fileExistsCorrectCasing(path)) { String rewrite = path.toFile().getCanonicalPath().substring(baseSoundsPath.toString().length() + 1, path.toFile().getCanonicalPath().length() - 4);