diff --git a/src/main/java/com/legacy/aether/AetherConfig.java b/src/main/java/com/legacy/aether/AetherConfig.java index 77877bf..9b24c14 100644 --- a/src/main/java/com/legacy/aether/AetherConfig.java +++ b/src/main/java/com/legacy/aether/AetherConfig.java @@ -23,7 +23,7 @@ public class AetherConfig { private static int travel_dimension; - private static boolean menu_enabled, menu_button; + private static boolean menu_enabled, menu_button, install_resourcepack; public static void init(File location) { File newFile = new File(location + "/aether" + "/AetherI.cfg"); @@ -58,6 +58,8 @@ public class AetherConfig { menu_enabled = config.get("Misc", "Enables the Aether Menu", false).getBoolean(false); menu_button = config.get("Misc", "Enables the Aether Menu toggle button", true).getBoolean(true); + install_resourcepack = config.get("Misc", "Determines whether the Aether b1.7.3 resource pack should be generated.", true).getBoolean(true); + config.save(); } @@ -115,4 +117,9 @@ public class AetherConfig { { return AetherConfig.menu_button; } + + public static boolean installResourcepack() + { + return AetherConfig.install_resourcepack; + } } \ No newline at end of file diff --git a/src/main/java/com/legacy/aether/client/ClientProxy.java b/src/main/java/com/legacy/aether/client/ClientProxy.java index f1b7801..caff615 100644 --- a/src/main/java/com/legacy/aether/client/ClientProxy.java +++ b/src/main/java/com/legacy/aether/client/ClientProxy.java @@ -1,5 +1,6 @@ package com.legacy.aether.client; +import com.legacy.aether.AetherConfig; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.EntityRenderer; import net.minecraft.entity.player.EntityPlayer; @@ -18,12 +19,50 @@ import com.legacy.aether.compatibility.client.AetherClientCompatibility; import cpw.mods.fml.client.FMLClientHandler; import cpw.mods.fml.client.registry.RenderingRegistry; +import java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.InputStream; + public class ClientProxy extends CommonProxy { public static final IIcon[] ACCESSORY_ICONS = new IIcon[8]; @Override public void init() { + try + { + File resourcePacks = Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks().getCanonicalFile(); + + File buckets = new File(resourcePacks + "\\Aether b1.7.3 Textures\\assets\\aether_legacy\\textures\\items\\misc\\buckets"); + File weapons = new File(resourcePacks + "\\Aether b1.7.3 Textures\\assets\\aether_legacy\\textures\\items\\weapons"); + + File[] directories = new File[] {buckets, weapons}; + + if (AetherConfig.installResourcepack()) + { + for (File file : directories) + { + if (!file.exists()) + { + file.mkdirs(); + } + } + + generateFile("data/Aether_b1.7.3/pack.mcmeta", "pack.mcmeta", resourcePacks.getAbsolutePath() + "/Aether b1.7.3 Textures"); + generateFile("data/Aether_b1.7.3/pack.png", "pack.png", resourcePacks.getAbsolutePath() + "/Aether b1.7.3 Textures"); + generateFile("data/Aether_b1.7.3/skyroot_remedy_bucket.png", "skyroot_remedy_bucket.png", buckets.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/bow_pulling_0.png", "bow_pulling_0.png", weapons.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/bow_pulling_1.png", "bow_pulling_1.png", weapons.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/bow_pulling_2.png", "bow_pulling_2.png", weapons.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/flaming_sword.png", "flaming_sword.png", weapons.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/holy_sword.png", "holy_sword.png", weapons.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/lightning_sword.png", "lightning_sword.png", weapons.getAbsolutePath()); + generateFile("data/Aether_b1.7.3/weapons/phoenix_bow.png", "phoenix_bow.png", weapons.getAbsolutePath()); + } + } + catch (IOException ignore) { } + berryBushRenderID = RenderingRegistry.getNextAvailableRenderId(); treasureChestRenderID = RenderingRegistry.getNextAvailableRenderId(); aetherFlowerRenderID = RenderingRegistry.getNextAvailableRenderId(); @@ -43,6 +82,32 @@ public class ClientProxy extends CommonProxy { AetherClientCompatibility.initialization(); } + public void generateFile(String input, String name, String path) + { + try { + File file = new File(path + "/" + name); + + if (!file.exists()) + { + InputStream inputStream = this.getClass().getClassLoader().getResourceAsStream(input); + FileOutputStream outputStream = new FileOutputStream(file); + + if (inputStream != null) + { + int i; + while ((i = inputStream.read()) != -1) + { + outputStream.write(i); + } + + inputStream.close(); + outputStream.close(); + } + } + } + catch (IOException ignore) { } + } + @Override public void sendMessage(EntityPlayer player, String text) { if (this.getPlayer() == player) diff --git a/src/main/resources/data/Aether_b1.7.3/pack.mcmeta b/src/main/resources/data/Aether_b1.7.3/pack.mcmeta new file mode 100644 index 0000000..abb4e94 --- /dev/null +++ b/src/main/resources/data/Aether_b1.7.3/pack.mcmeta @@ -0,0 +1,6 @@ +{ + "pack": { + "pack_format": 1, + "description": "Aether textures from the b1.7.3 version" + } +} \ No newline at end of file diff --git a/src/main/resources/data/Aether_b1.7.3/pack.png b/src/main/resources/data/Aether_b1.7.3/pack.png new file mode 100644 index 0000000..cde4771 Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/pack.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/skyroot_remedy_bucket.png b/src/main/resources/data/Aether_b1.7.3/skyroot_remedy_bucket.png new file mode 100644 index 0000000..1af6939 Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/skyroot_remedy_bucket.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_0.png b/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_0.png new file mode 100644 index 0000000..bef1c98 Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_0.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_1.png b/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_1.png new file mode 100644 index 0000000..f35676d Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_1.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_2.png b/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_2.png new file mode 100644 index 0000000..b584a12 Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/bow_pulling_2.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/flaming_sword.png b/src/main/resources/data/Aether_b1.7.3/weapons/flaming_sword.png new file mode 100644 index 0000000..c7d017c Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/flaming_sword.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/holy_sword.png b/src/main/resources/data/Aether_b1.7.3/weapons/holy_sword.png new file mode 100644 index 0000000..953a96e Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/holy_sword.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/lightning_sword.png b/src/main/resources/data/Aether_b1.7.3/weapons/lightning_sword.png new file mode 100644 index 0000000..6b4cf19 Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/lightning_sword.png differ diff --git a/src/main/resources/data/Aether_b1.7.3/weapons/phoenix_bow.png b/src/main/resources/data/Aether_b1.7.3/weapons/phoenix_bow.png new file mode 100644 index 0000000..69dcbd6 Binary files /dev/null and b/src/main/resources/data/Aether_b1.7.3/weapons/phoenix_bow.png differ