diff --git a/converter/src/main/java/org/geysermc/pack/converter/PackConverter.java b/converter/src/main/java/org/geysermc/pack/converter/PackConverter.java index 5591ac8..354d86c 100644 --- a/converter/src/main/java/org/geysermc/pack/converter/PackConverter.java +++ b/converter/src/main/java/org/geysermc/pack/converter/PackConverter.java @@ -26,6 +26,7 @@ package org.geysermc.pack.converter; +import org.apache.commons.io.file.PathUtils; import org.geysermc.pack.bedrock.resource.BedrockResourcePack; import org.geysermc.pack.converter.converter.ActionListener; import org.geysermc.pack.converter.converter.Converter; @@ -310,7 +311,7 @@ public final class PackConverter { */ private void cleanup() { try { - Files.delete(tmpDir); + PathUtils.delete(tmpDir); } catch (IOException ignored) { } } diff --git a/legacy/BannerPatternBlackConverter.java b/legacy/BannerPatternBlackConverter.java deleted file mode 100644 index 7b891b6..0000000 --- a/legacy/BannerPatternBlackConverter.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class BannerPatternBlackConverter extends AbstractConverter { - - @Getter - private static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/banner/border.png"}); - defaultData.add(new Object[] {"textures/entity/banner/bricks.png"}); - defaultData.add(new Object[] {"textures/entity/banner/circle.png"}); - defaultData.add(new Object[] {"textures/entity/banner/creeper.png"}); - defaultData.add(new Object[] {"textures/entity/banner/cross.png"}); - defaultData.add(new Object[] {"textures/entity/banner/curly_border.png"}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_left.png"}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_right.png"}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_up_left.png"}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_up_right.png"}); - defaultData.add(new Object[] {"textures/entity/banner/flower.png"}); - defaultData.add(new Object[] {"textures/entity/banner/gradient.png"}); - defaultData.add(new Object[] {"textures/entity/banner/gradient_up.png"}); - defaultData.add(new Object[] {"textures/entity/banner/half_horizontal.png"}); - defaultData.add(new Object[] {"textures/entity/banner/half_horizontal_bottom.png"}); - defaultData.add(new Object[] {"textures/entity/banner/half_vertical.png"}); - defaultData.add(new Object[] {"textures/entity/banner/half_vertical_right.png"}); - defaultData.add(new Object[] {"textures/entity/banner/mojang.png"}); - defaultData.add(new Object[] {"textures/entity/banner/piglin.png"}); - defaultData.add(new Object[] {"textures/entity/banner/rhombus.png"}); - defaultData.add(new Object[] {"textures/entity/banner/skull.png"}); - defaultData.add(new Object[] {"textures/entity/banner/small_stripes.png"}); - defaultData.add(new Object[] {"textures/entity/banner/square_bottom_left.png"}); - defaultData.add(new Object[] {"textures/entity/banner/square_bottom_right.png"}); - defaultData.add(new Object[] {"textures/entity/banner/square_top_left.png"}); - defaultData.add(new Object[] {"textures/entity/banner/square_top_right.png"}); - defaultData.add(new Object[] {"textures/entity/banner/straight_cross.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_bottom.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_center.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_downleft.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_downright.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_left.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_middle.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_right.png"}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_top.png"}); - defaultData.add(new Object[] {"textures/entity/banner/triangle_bottom.png"}); - defaultData.add(new Object[] {"textures/entity/banner/triangle_top.png"}); - defaultData.add(new Object[] {"textures/entity/banner/triangles_bottom.png"}); - defaultData.add(new Object[] {"textures/entity/banner/triangles_top.png"}); - } - - public BannerPatternBlackConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File patternFile = storage.resolve(from).toFile(); - if (!patternFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Fix banner pattern black %s", from)); - - BufferedImage patternImage = ImageIO.read(patternFile); - - for (int x = 0; x < patternImage.getWidth(); x++) { - for (int y = 0; y < patternImage.getHeight(); y++) { - Color c = new Color(patternImage.getRGB(x, y), true); - if (c.getRGB() == 0 && c.getRed() == 0 && c.getGreen() == 0 && c.getBlue() == 0 && c.getAlpha() == 255) { - patternImage.setRGB(x, y, Color.TRANSLUCENT); - } - } - } - - ImageUtils.write(patternImage, "png", patternFile); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/BannerPatternConverter.java b/legacy/BannerPatternConverter.java deleted file mode 100644 index f1d32aa..0000000 --- a/legacy/BannerPatternConverter.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class BannerPatternConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/banner_base.png", new Object[]{ - // https://www.planetminecraft.com/banner/pillager-banner-199281/ - // Colors from original bedrock texture - new Object[] {"textures/entity/banner/base.png", new Color(255, 255, 255)}, - new Object[] {"textures/entity/banner/rhombus.png", new Color(76, 127, 153)}, - new Object[] {"textures/entity/banner/stripe_bottom.png", new Color(146, 146, 146)}, - new Object[] {"textures/entity/banner/stripe_center.png", new Color(79, 79, 79)}, - new Object[] {"textures/entity/banner/stripe_middle.png", new Color(0, 0, 0)}, - new Object[] {"textures/entity/banner/half_horizontal.png", new Color(146, 146, 146)}, - new Object[] {"textures/entity/banner/circle.png", new Color(146, 146, 146)}, - new Object[] {"textures/entity/banner/border.png", new Color(0, 0, 0)} - }, "textures/entity/banner/banner_pattern_illager.png"}); - } - - public BannerPatternConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String base = (String) context.data()[0]; - Object[] patterns = (Object[]) context.data()[1]; - String to = (String) context.data()[2]; - - BufferedImage bannerImage = null; - - for (Object pattern : patterns) { - Object[] patternArr = (Object[]) pattern; - String path = (String) patternArr[0]; - Color color = (Color) patternArr[1]; - - File patternFile = storage.resolve(path).toFile(); - if (!patternFile.exists()) { - continue; - } - - BufferedImage patternImage = ImageIO.read(patternFile); - - if (bannerImage == null) { - context.log(String.format("Convert pattern banner %s", to)); - - bannerImage = ImageIO.read(storage.resolve(base).toFile()); - - int factor = bannerImage.getWidth() / 64; - - Graphics g = bannerImage.getGraphics(); - g.drawImage(ImageUtils.crop(bannerImage, (44 * factor), 0, (8 * factor), (44 * factor)), (52 * factor), 0, null); - g.drawImage(ImageUtils.crop(bannerImage, (44 * factor), (5 * factor), (8 * factor), (20 * factor)), (52 * factor), (44 * factor), null); - } - - for (int x = 0; x < bannerImage.getWidth(); x++) { - for (int y = 0; y < bannerImage.getHeight(); y++) { - Color c = new Color(patternImage.getRGB(x, y), true); - if (c.getRed() > 0 && c.getAlpha() > 0) { - bannerImage.setRGB(x, y, color.getRGB()); - } - } - } - } - - if (bannerImage != null) { - ImageUtils.write(bannerImage, "png", storage.resolve(to).toFile()); - } - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/BannerPatternPreviewMaxSizeConverter.java b/legacy/BannerPatternPreviewMaxSizeConverter.java deleted file mode 100644 index e37b021..0000000 --- a/legacy/BannerPatternPreviewMaxSizeConverter.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class BannerPatternPreviewMaxSizeConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/banner_base.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/border.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/bricks.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/circle.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/creeper.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/cross.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/curly_border.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_left.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_right.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_up_left.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/diagonal_up_right.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/flower.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/gradient.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/gradient_up.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/half_horizontal.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/half_horizontal_bottom.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/half_vertical.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/half_vertical_right.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/mojang.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/piglin.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/rhombus.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/skull.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/small_stripes.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/square_bottom_left.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/square_bottom_right.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/square_top_left.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/square_top_right.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/straight_cross.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_bottom.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_center.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_downleft.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_downright.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_left.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_middle.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_right.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/stripe_top.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/triangle_bottom.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/triangle_top.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/triangles_bottom.png", 64}); - defaultData.add(new Object[] {"textures/entity/banner/triangles_top.png", 64}); - } - - public BannerPatternPreviewMaxSizeConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - Integer max_width = (Integer) context.data()[1]; - - File patternFile = storage.resolve(from).toFile(); - if (!patternFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Fix banner pattern preview max size %s", from)); - - BufferedImage patternImage = ImageIO.read(patternFile); - - patternImage = ImageUtils.ensureMaxWidth(patternImage, max_width); - - ImageUtils.write(patternImage, "png", patternFile); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/BarConverter.java b/legacy/BarConverter.java deleted file mode 100644 index 38fb6c0..0000000 --- a/legacy/BarConverter.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class BarConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] { - "textures/gui/icons.png", - 256, - new Object[] { - new Object[] {64, new Object[] { - new Object[] {"textures/gui/achievements/hotdogempty"}, - new Object[] {"textures/ui/empty_progress_bar"}, - new Object[] {"textures/ui/experiencebarempty"}, - new Object[] {"textures/ui/experience_bar_empty_blue"} - }}, - new Object[] {69, new Object[] { - new Object[] {"textures/gui/achievements/hotdogfull"}, - new Object[] {"textures/ui/experiencebarfull"} - }}, - new Object[] {69, new Object[] { - new Object[] {"textures/ui/experience_bar_full_blue", new Color(112, 215, 225)}, - new Object[] {"textures/ui/experience_bar_full_white", new Color(236, 236, 236)}, - new Object[] {"textures/ui/filled_progress_bar", new Color(236, 236, 236)} - }}, - new Object[] {89, new Object[] { - new Object[] {"textures/ui/horse_jump_full"} - }} - }, - new String[] { - "textures/gui/achievements/nub.png", - "textures/ui/experiencenub.png", - "textures/ui/experience_bar_nub_blue.png" - } - }); - } - - public BarConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - int factorDetect = (int) context.data()[1]; - Object[] bars = (Object[]) context.data()[2]; - String[] nubs = (String[]) context.data()[3]; - - File fromFile = storage.resolve(from).toFile(); - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - BufferedImage fromImage = ImageIO.read(fromFile); - fromImage = ImageUtils.ensureMinWidth(fromImage, factorDetect); - - int factor = (fromImage.getWidth() / factorDetect); - - ObjectMapper mapper = new ObjectMapper().enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); - - JsonNode metadata = mapper.readTree("{nineslice_size: [1, 0, 1, 0], base_size: [182, 5]}"); - - for (Object bar : bars) { - Object[] barArr = (Object[]) bar; - int y = (int) barArr[0]; - Object[] tos = (Object[]) barArr[1]; - - BufferedImage toImage = ImageUtils.crop(fromImage, 0, (y * factor), (182 * factor), (5 * factor)); - - for (Object to : tos) { - Object[] toArr = (Object[]) to; - String toPath = (String) toArr[0]; - Color color = toArr.length > 1 && toArr[1] != null ? (Color) toArr[1] : Color.white; - - context.log(String.format("Convert bar %s", toPath)); - - ImageUtils.write(ImageUtils.colorize(toImage, color), "png", storage.resolve(toPath + ".png").toFile()); - - mapper.writeValue(storage.resolve(toPath + ".json").toFile(), metadata); - } - } - - BufferedImage transparentImage = new BufferedImage(factor, (5 * factor), BufferedImage.TYPE_INT_ARGB); - for (String nub : nubs) { - context.log(String.format("Convert bar %s", nub)); - - ImageUtils.write(transparentImage, "png", storage.resolve(nub).toFile()); - } - - } catch (IOException e) { e.printStackTrace(); } - - return new ArrayList<>(); - } -} diff --git a/legacy/BeeConverter.java b/legacy/BeeConverter.java deleted file mode 100644 index 143b8d4..0000000 --- a/legacy/BeeConverter.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class BeeConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/bee/bee.png"}); - defaultData.add(new Object[] {"textures/entity/bee/bee_angry.png"}); - defaultData.add(new Object[] {"textures/entity/bee/bee_angry_nectar.png"}); - defaultData.add(new Object[] {"textures/entity/bee/bee_nectar.png"}); - } - - public BeeConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert bee %s", from)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - int factor = fromImage.getWidth() / 64; - - if (ImageUtils.isEmptyArea(fromImage, (15 * factor), (24 * factor), (7 * factor), (6 * factor))) { - Graphics g = fromImage.getGraphics(); - - g.drawImage(ImageUtils.flip(ImageUtils.crop(fromImage, (8 * factor), (18 * factor), (7 * factor), (6 * factor)), true, false), (15 * factor), (24 * factor), null); - - ImageUtils.write(fromImage, "png", fromFile); - } - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/CopyConverter.java b/legacy/CopyConverter.java deleted file mode 100644 index a9425c0..0000000 --- a/legacy/CopyConverter.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class CopyConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - // Battern - defaultData.add(new String[] {"textures/entity/banner/banner_pattern_illager.tga", "textures/entity/banner/banner_illager.tga"}); - - // Beef - defaultData.add(new String[] {"textures/items/beef_cooked.png", "textures/items/hoglin_meat_cooked.png"}); - defaultData.add(new String[] {"textures/items/beef_raw.png", "textures/items/hoglin_meat_raw.png"}); - - // Cat - defaultData.add(new String[] {"textures/entity/cat/redtabby.png","textures/entity/cat/red.png"}); - defaultData.add(new String[] {"textures/entity/cat/siamesecat.png", "textures/entity/cat/siamese.png"}); - defaultData.add(new String[] {"textures/entity/cat/tuxedo.png", "textures/entity/cat/blackcat.png"}); - - // Cartography table - defaultData.add(new String[] {"textures/blocks/cartography_table_top.png", "textures/ui/cartography_table_empty.png"}); - - // Command block - defaultData.add(new String[] {"textures/blocks/command_block_back_mipmap.png", "textures/blocks/command_block.png"}); - - // Compass & clock - defaultData.add(new String[] {"textures/items/compass_atlas.png", "textures/items/lodestonecompass_atlas.png"}); - defaultData.add(new String[] {"textures/items/compass_item.png", "textures/items/lodestonecompass_item.png"}); - - // Fire - defaultData.add(new String[] {"textures/blocks/fire_0.png", "textures/flame_atlas.png"}); - - // Kelp - defaultData.add(new String[] {"textures/blocks/kelp_a.tga", "textures/blocks/kelp_b.tga"}); - defaultData.add(new String[] {"textures/blocks/kelp_a.tga", "textures/blocks/kelp_c.tga"}); - defaultData.add(new String[] {"textures/blocks/kelp_a.tga", "textures/blocks/kelp_d.tga"}); - defaultData.add(new String[] {"textures/blocks/kelp_top.tga", "textures/blocks/kelp_top_bulb.tga"}); - - // Lever - defaultData.add(new String[] {"textures/blocks/lever.png", "textures/items/lever.png"}); - - // Llama - defaultData.add(new String[] {"textures/entity/llama/llama_creamy.png", "textures/entity/llama/llama.png"}); - - // Pattern - defaultData.add(new String[] {"textures/items/skull_banner_pattern.png", "textures/items/banner_pattern.png"}); - - // Skull - defaultData.add(new String[] {"textures/entity/creeper/creeper.png", "textures/entity/skulls/creeper.png"}); - defaultData.add(new String[] {"textures/entity/skeleton/skeleton.png", "textures/entity/skulls/skeleton.png"}); - defaultData.add(new String[] {"textures/entity/skeleton/wither_skeleton.png", "textures/entity/skulls/wither_skeleton.png"}); - defaultData.add(new String[] {"textures/entity/zombie/zombie.png", "textures/entity/skulls/zombie.png"}); - - // UI - defaultData.add(new String[] {"textures/blocks/brick.png", "textures/ui/icon_recipe_construction.png"}); - defaultData.add(new String[] {"textures/blocks/chest_front.png", "textures/ui/inventory_icon.png"}); - defaultData.add(new String[] {"textures/blocks/grass_side_carried.png", "textures/ui/icon_recipe_nature.png"}); - defaultData.add(new String[] {"textures/items/book_normal.png", "textures/ui/creative_icon.png"}); - defaultData.add(new String[] {"textures/items/bed_red.png", "textures/ui/icon_recipe_item.png"}); - defaultData.add(new String[] {"textures/items/compass_item.png", "textures/ui/magnifyingGlass.png"}); - defaultData.add(new String[] {"textures/items/diamond_sword.png", "textures/ui/icon_recipe_equipment.png"}); - defaultData.add(new String[] {"textures/items/empty_armor_slot_boots.png", "textures/ui/empty_armor_slot_boots.png"}); - defaultData.add(new String[] {"textures/items/empty_armor_slot_chestplate.png", "textures/ui/empty_armor_slot_chestplate.png"}); - defaultData.add(new String[] {"textures/items/empty_armor_slot_helmet.png", "textures/ui/empty_armor_slot_helmet.png"}); - defaultData.add(new String[] {"textures/items/empty_armor_slot_leggings.png", "textures/ui/empty_armor_slot_leggings.png"}); - defaultData.add(new String[] {"textures/items/empty_armor_slot_shield.png", "textures/ui/empty_armor_slot_shield.png"}); - - // Wither - defaultData.add(new String[] {"textures/entity/creeper/creeper_armor.png", "textures/entity/wither_boss/wither_armor_blue.png"}); - - defaultData.add(new String[] {"bedrock_textures/", "textures/"}); - } - - public CopyConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - if (!storage.resolve(from).toFile().exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Copy %s to %s", from, to)); - - Files.copy(storage.resolve(from), storage.resolve(to)); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/DeleteConverter.java b/legacy/DeleteConverter.java deleted file mode 100644 index 94576f2..0000000 --- a/legacy/DeleteConverter.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.jetbrains.annotations.NotNull; - -import java.io.File; -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class DeleteConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"assets/"}); - defaultData.add(new Object[] {"textures/blocks/conduit.png"}); - defaultData.add(new Object[] {"textures/entity/conduit/break_particle.png"}); - defaultData.add(new Object[] {"textures/blocks/dried_kelp_bottom.png"}); - defaultData.add(new Object[] {"textures/blocks/water_overlay.png"}); - defaultData.add(new Object[] {"textures/entity/cat/cat_collar.png"}); - defaultData.add(new Object[] {"textures/entity/wolf/wolf_collar.png"}); - defaultData.add(new Object[] {"bedrock_textures/"}); - } - - public DeleteConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Delete %s", from)); - - if (fromFile.isDirectory()) { - deleteDirectory(fromFile); - } else { - Files.delete(fromFile.toPath()); - } - } catch (IOException e) { } - - return new ArrayList<>(); - } - - private void deleteDirectory(File directoryToBeDeleted) { - File[] allContents = directoryToBeDeleted.listFiles(); - if (allContents != null) { - for (File file : allContents) { - deleteDirectory(file); - } - } - directoryToBeDeleted.delete(); - } -} diff --git a/legacy/DespriteConverter.java b/legacy/DespriteConverter.java deleted file mode 100644 index cad92ad..0000000 --- a/legacy/DespriteConverter.java +++ /dev/null @@ -1,142 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class DespriteConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] { - "textures/gui/recipe_button.png", - 256, - new Object[] { - new Object[] {0, 0, 20, 18, "textures/ui/recipe_book_icon.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/widgets.png", - 256, - new Object[] { - new Object[] {0, 0, 1, 22, "textures/ui/hotbar_start_cap.png"}, - new Object[] {1, 0, 20, 22, "textures/ui/hotbar_0.png"}, - new Object[] {21, 0, 20, 22, "textures/ui/hotbar_1.png"}, - new Object[] {41, 0, 20, 22, "textures/ui/hotbar_2.png"}, - new Object[] {61, 0, 20, 22, "textures/ui/hotbar_3.png"}, - new Object[] {81, 0, 20, 22, "textures/ui/hotbar_4.png"}, - new Object[] {101, 0, 20, 22, "textures/ui/hotbar_5.png"}, - new Object[] {121, 0, 20, 22, "textures/ui/hotbar_6.png"}, - new Object[] {141, 0, 20, 22, "textures/ui/hotbar_7.png"}, - new Object[] {161, 0, 20, 22, "textures/ui/hotbar_8.png"}, - new Object[] {181, 0, 1, 22, "textures/ui/hotbar_end_cap.png"}, - new Object[] {0, 22, 24, 24, "textures/ui/selected_hotbar_slot.png", new int[] {4, 4, 16, 16}} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/cartography_table.png", - 256, - new Object[] { - new Object[] {176, 0, 66, 66, "textures/ui/cartography_table_map.png"}, - new Object[] {176, 66, 66, 66, "textures/ui/cartography_table_zoom.png"}, - new Object[] {176, 132, 50, 50, "textures/ui/cartography_table_copy.png"}, - new Object[] {0, 166, 66, 66, "textures/ui/cartography_table_glass.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/inventory.png", - 256, - new Object[] { - new Object[] {141, 166, 24, 24, "textures/ui/hud_mob_effect_background.png"} - } - }); - } - - public DespriteConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - int factorDetect = (int) context.data()[1]; - Object[] sprites = (Object[]) context.data()[2]; - - File fromFile = storage.resolve(from).toFile(); - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - BufferedImage fromImage = ImageIO.read(fromFile); - fromImage = ImageUtils.ensureMinWidth(fromImage, factorDetect); - - int factor = (fromImage.getWidth() / factorDetect); - - for (Object sprite : sprites) { - Object[] spriteArr = (Object[]) sprite; - int x = (int) spriteArr[0]; - int y = (int) spriteArr[1]; - int width = (int) spriteArr[2]; - int height = (int) spriteArr[3]; - String to = (String) spriteArr[4]; - int[] emptyOverlay = spriteArr.length > 5 ? (int[]) spriteArr[5] : null; - - context.log(String.format("Desprite %s", to)); - - BufferedImage spriteImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor)); - - if (emptyOverlay != null) { - Graphics g = spriteImage.getGraphics(); - g.setColor(new Color(Color.TRANSLUCENT, true)); - g.fillRect((emptyOverlay[0] * factor), (emptyOverlay[1] * factor), (emptyOverlay[2] * factor), (emptyOverlay[3] * factor)); - } - - ImageUtils.write(spriteImage, "png", storage.resolve(to).toFile()); - } - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/DespriteExperimentalConverter.java b/legacy/DespriteExperimentalConverter.java deleted file mode 100644 index c29adf6..0000000 --- a/legacy/DespriteExperimentalConverter.java +++ /dev/null @@ -1,229 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class DespriteExperimentalConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] { - "textures/gui/recipe_book.png", - 256, - new Object[] { - new Object[] {152, 41, 26, 16, "textures/ui/craft_toggle_off.png"}, - new Object[] {152, 59, 26, 16, "textures/ui/craft_toggle_off_hover.png"}, - new Object[] {180, 41, 26, 16, "textures/ui/craft_toggle_on.png"}, - new Object[] {180, 59, 26, 16, "textures/ui/craft_toggle_on_hover.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/widgets.png", - 256, - new Object[] { - new Object[] {0, 22, 24, 24, "textures/ui/pocket_ui_highlight_selected_slot.png", null, new int[] {4, 4, 16, 16}}, - new Object[] {0, 22, 24, 24, "textures/ui/pocket_ui_highlight_slot.png", null, new int[] {4, 4, 16, 16}} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/anvil.png", - 256, - new Object[] { - new Object[] {99, 45, 22, 15, "textures/ui/arrow_large.png"}, - new Object[] {17, 7, 30, 30, "textures/ui/anvil_icon.png"}, - new Object[] {53, 49, 13, 13, "textures/ui/anvil-plus.png"}, - new Object[] {176, 0, 28, 21, "textures/ui/crossout.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/beacon.png", - 256, - new Object[] { - new Object[] {58, 108, 5, 18, "textures/ui/beacon_item_seperator_pocket.png"}, - new Object[] {58, 108, 5, 18, "textures/ui/item_seperator.png"}, - new Object[] {18, 22, 19, 22, "textures/ui/pyramid_level_1.png"}, - new Object[] {18, 47, 19, 22, "textures/ui/pyramid_level_2.png"}, - new Object[] {18, 72, 19, 22, "textures/ui/pyramid_level_3.png"}, - new Object[] {158, 22, 19, 22, "textures/ui/pyramid_level_4.png"}, - new Object[] {88, 219, 22, 22, "textures/ui/confirm.png"}, - new Object[] {110, 219, 22, 22, "textures/ui/cancel.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/brewing_stand.png", - 256, - new Object[] { - new Object[] {17, 17, 16, 16, "textures/ui/brewing_fuel_empty.png"}, - new Object[] {56, 51, 16, 16, "textures/ui/bottle_empty.png"}, - new Object[] {60, 43, 19, 6, "textures/ui/brewing_fuel_bar_empty.png"}, - new Object[] {176, 29, 18, 4, "textures/ui/brewing_fuel_bar_full.png"}, - new Object[] {63, 14, 12, 29, "textures/ui/bubbles_empty.png"}, - new Object[] {185, 0, 12, 29, "textures/ui/bubbles_full.png"}, - new Object[] {34, 28, 26, 20, "textures/ui/brewing_fuel_pipes.png"}, - new Object[] {73, 34, 28, 23, "textures/ui/brewing_pipes.png"}, - new Object[] {73, 34, 28, 23, "textures/ui/brewing_pipes_large.png"}, - new Object[] {97, 16, 9, 28, "textures/ui/brewing_arrow_empty.png"}, - new Object[] {97, 16, 9, 28, "textures/ui/brewing_arrow_large_empty.png"}, - new Object[] {176, 0, 9, 28, "textures/ui/brewing_arrow_full.png"}, - new Object[] {176, 0, 9, 28, "textures/ui/brewing_arrow_large_full.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/enchanting_table.png", - 256, - new Object[] { - new Object[] {35, 47, 16, 16, "textures/ui/lapis.png"}, - new Object[] {35, 47, 16, 16, "textures/ui/lapis_image.png"}, - new Object[] {3, 225, 13, 11, "textures/ui/dust_selectable_1.png"}, - new Object[] {19, 225, 13, 11, "textures/ui/dust_selectable_2.png"}, - new Object[] {34, 225, 13, 11, "textures/ui/dust_selectable_3.png"}, - new Object[] {3, 241, 13, 11, "textures/ui/dust_unselectable_1.png"}, - new Object[] {19, 241, 13, 11, "textures/ui/dust_unselectable_2.png"}, - new Object[] {34, 241, 13, 11, "textures/ui/dust_unselectable_3.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/furnace.png", - 256, - new Object[] { - new Object[] {79, 35, 24, 17, "textures/ui/arrow_inactive.png"}, - new Object[] {176, 14, 24, 17, "textures/ui/arrow_active.png"}, - new Object[] {56, 36, 14, 14, "textures/ui/flame_empty_image.png"}, - new Object[] {176, 0, 14, 14, "textures/ui/flame_full_image.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/horse.png", - 256, - new Object[] { - new Object[] {1, 221, 16, 16, "textures/ui/empty_horse_slot_armor.png"}, - new Object[] {19, 221, 16, 16, "textures/ui/empty_horse_slot_saddle.png"}, - new Object[] {37, 221, 16, 16, "textures/ui/empty_llama_slot_carpet.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/inventory.png", - 256, - new Object[] { - new Object[] {135, 29, 16, 13, "textures/ui/arrow.png"} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/loom.png", - 256, - new Object[] { - new Object[] {176, 0, 16, 16, "textures/ui/loom_banner_empty.png", new int[] {13, 26, 16, 16}}, - new Object[] {192, 0, 16, 16, "textures/ui/loom_dye_empty.png", new int[] {33, 26, 16, 16}}, - new Object[] {208, 0, 16, 16, "textures/ui/loom_pattern_item_empty.png", new int[] {23, 45, 16, 16}} - } - }); - defaultData.add(new Object[] { - "textures/gui/container/smithing.png", - 256, - new Object[] { - new Object[] {17, 7, 30, 30, "textures/ui/smithing_icon.png"}, - new Object[] {53, 49, 13, 13, "textures/ui/smithing-table-plus.png"}, - new Object[] {76, 47, 16, 16, "textures/ui/ingot_image.png"} - } - }); - } - - public DespriteExperimentalConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - int factorDetect = (int) context.data()[1]; - Object[] sprites = (Object[]) context.data()[2]; - - File fromFile = storage.resolve(from).toFile(); - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - BufferedImage fromImage = ImageIO.read(fromFile); - fromImage = ImageUtils.ensureMinWidth(fromImage, factorDetect); - - int factor = (fromImage.getWidth() / factorDetect); - - for (Object sprite : sprites) { - Object[] spriteArr = (Object[]) sprite; - int x = (int) spriteArr[0]; - int y = (int) spriteArr[1]; - int width = (int) spriteArr[2]; - int height = (int) spriteArr[3]; - String to = (String) spriteArr[4]; - int[] emptyOverlayAlt = spriteArr.length > 5 ? (int[]) spriteArr[5] : null; - int[] emptyOverlay = spriteArr.length > 6 ? (int[]) spriteArr[6] : null; - - context.log(String.format("Desprite %s (Experimental)", to)); - - BufferedImage spriteImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor)); - - if (emptyOverlayAlt != null && ImageUtils.isEmptyArea(spriteImage, 0, 0, spriteImage.getWidth(), spriteImage.getHeight())) { - spriteImage = ImageUtils.crop(spriteImage, (emptyOverlayAlt[0] * factor), (emptyOverlayAlt[1] * factor), (emptyOverlayAlt[2] * factor), (emptyOverlayAlt[3] * factor)); - } - - if (emptyOverlay != null) { - Graphics g = spriteImage.getGraphics(); - g.setColor(new Color(Color.TRANSLUCENT, true)); - g.fillRect((emptyOverlay[0] * factor), (emptyOverlay[1] * factor), (emptyOverlay[2] * factor), (emptyOverlay[3] * factor)); - } - - ImageUtils.write(spriteImage, "png", storage.resolve(to).toFile()); - } - } catch (IOException e) { } - - return new ArrayList<>(); - } - - @Override - public boolean isExperimental() { - return true; - } -} diff --git a/legacy/DestroyStageConverter.java b/legacy/DestroyStageConverter.java deleted file mode 100644 index b9481ed..0000000 --- a/legacy/DestroyStageConverter.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class DestroyStageConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/environment/destroy_stage_0.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_1.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_2.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_3.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_4.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_5.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_6.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_7.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_8.png"}); - defaultData.add(new Object[] {"textures/environment/destroy_stage_9.png"}); - } - - public DestroyStageConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert destroy stage %s", from)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - Color blank = new Color(255, 255, 255, 0); - for (int x = 0; x < fromImage.getWidth(); x++) { - for (int y = 0; y < fromImage.getHeight(); y++) { - Color c = new Color(fromImage.getRGB(x, y), true); - if (c.getAlpha() == 0) { - fromImage.setRGB(x, y, blank.getRGB()); - } - } - } - - ImageUtils.write(fromImage, "png", fromFile); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/DialogConverter.java b/legacy/DialogConverter.java deleted file mode 100644 index 5a6d841..0000000 --- a/legacy/DialogConverter.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.Graphics; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -// @AutoService(Converter.class) -public class DialogConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] { - "textures/gui/container/generic_54.png", - 256, - new Object[] { - new Object[] {0, 0, 176, 222, new int[] {7, 17, 7, 7}, new Object[] { - new Object[] {"textures/ui/achievements_dialog", new int[] {6, 20, 6, 6}}, - new Object[] {"textures/ui/dialog_background_hollow_1", new int[] {8, 23, 8, 76}}, - new Object[] {"textures/ui/dialog_background_hollow_2", new int[] {8, 23, 8, 42}}, - new Object[] {"textures/ui/dialog_background_hollow_3", new int[] {8, 23, 8, 8}}, - new Object[] {"textures/ui/dialog_background_hollow_4", new int[] {8, 8, 8, 8}}, - new Object[] {"textures/ui/dialog_background_hollow_4_thin", new int[] {6, 6, 6, 6}}, - new Object[] {"textures/ui/dialog_background_hollow_5", new int[] {8, 17, 8, 42}}, - new Object[] {"textures/ui/dialog_background_hollow_6", new int[] {8, 23, 8, 104}}, - new Object[] {"textures/ui/dialog_background_hollow_7", new int[] {8, 66, 8, 8}}, - new Object[] {"textures/ui/dialog_background_hollow_8", new int[] {8, 8, 33, 33}}, - new Object[] {"textures/ui/dialog_background_opaque", new int[] {4, 4, 4, 4}}, - new Object[] {"textures/ui/dialog_background_opaque_overlap_bottom", new int[] {4, 4, 4, 4}}, - new Object[] {"textures/ui/menubackground", new int[] {4, 4, 4, 4}}, - new Object[] {"textures/ui/thin_dialog", new int[] {5, 5, 5, 5}} - }} - } - }); - } - - public DialogConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - int factorDetect = (int) context.data()[1]; - Object[] dialogs = (Object[]) context.data()[2]; - - File fromFile = storage.resolve(from).toFile(); - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - BufferedImage fromImage = ImageIO.read(fromFile); - fromImage = ImageUtils.ensureMinWidth(fromImage, factorDetect); - - int factor = (fromImage.getWidth() / factorDetect); - - ObjectMapper mapper = new ObjectMapper().enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); - - for (Object dialog : dialogs) { - Object[] dialogArr = (Object[]) dialog; - int x = (int) dialogArr[0]; - int y = (int) dialogArr[1]; - int width = (int) dialogArr[2]; - int height = (int) dialogArr[3]; - int[] sizes = (int[]) dialogArr[4]; - Object[] tos = (Object[]) dialogArr[5]; - - for (int i = 0; i < sizes.length; i++) { - sizes[i] = sizes[i] * factor; - } - - BufferedImage dialogImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor)); - - for (Object to : tos) { - Object[] toArr = (Object[]) to; - String toPath = (String) toArr[0]; - int[] toSizes = (int[]) toArr[1]; - - for (int i = 0; i < toSizes.length; i++) { - toSizes[i] = toSizes[i] * factor; - } - - BufferedImage toImage = new BufferedImage((toSizes[0] + toSizes[2] + (6 * factor)), (toSizes[1] + toSizes[3] + (6 * factor)), BufferedImage.TYPE_INT_ARGB); - Graphics g = toImage.getGraphics(); - - // TODO: Fix and finish this - g.drawImage(ImageUtils.borderImage(ImageUtils.crop(dialogImage, sizes[0], sizes[1]), (2 * factor), (2 * factor), (2 * factor), (2 * factor), toSizes[0], toSizes[1]), 0, 0, null); - - JsonNode metadata = mapper.readTree("{nineslice_size: " + mapper.writeValueAsString(toSizes) + ", base_size: [" + (toImage.getWidth() / factor) + ", " + (toImage.getHeight() / factor) + "]}"); - - context.log(String.format("Convert dialog %s (Experimental)", toPath)); - - ImageUtils.write(toImage, "png", storage.resolve(toPath + ".png").toFile()); - - mapper.writeValue(storage.resolve(toPath + ".json").toFile(), metadata); - } - } - - } catch (IOException e) { e.printStackTrace(); } - - return new ArrayList<>(); - } -} diff --git a/legacy/DolphinConverter.java b/legacy/DolphinConverter.java deleted file mode 100644 index 9f0ea75..0000000 --- a/legacy/DolphinConverter.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class DolphinConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/dolphin.png"}); - } - - public DolphinConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String from = (String) context.data()[0]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return delete; - } - - context.log("Convert dolphin"); - - BufferedImage fromImage = ImageIO.read(fromFile); - - fromImage = ImageUtils.ensureMinWidth(fromImage, 64); - - int factor = fromImage.getWidth() / 64; - - BufferedImage newImage = new BufferedImage((64 * factor), (64 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - // Nose - g.drawImage(ImageUtils.crop(fromImage, 0, (13 * factor), (12 * factor), (6 * factor)), 0, (13 * factor), null); - - // Head - g.drawImage(ImageUtils.crop(fromImage, 0, 0, (28 * factor), (13 * factor)), 0, 0, null); - - // Body - g.drawImage(ImageUtils.crop(fromImage, (35 * factor), 0, (16 * factor), (13 * factor)), (13 * factor), (13 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (22 * factor), (13 * factor), (42 * factor), (7 * factor)), 0, (26 * factor), null); - - // Tail 1 - g.drawImage(ImageUtils.crop(fromImage, (11 * factor), (19 * factor), (8 * factor), (11 * factor)), (11 * factor), (33 * factor), null); - g.drawImage(ImageUtils.crop(fromImage,0, (30 * factor), (30 * factor), (5 * factor)), 0, (44 * factor), null); - - // Tail 2 - g.drawImage(ImageUtils.crop(fromImage, (19 * factor), (20 * factor), (32 * factor), (7 * factor)), 0, (49 * factor), null); - - // Top - g.drawImage(ImageUtils.crop(fromImage, (62 * factor), (5 * factor), factor, (4 * factor)), (33 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (56 * factor), (5 * factor), factor, (4 * factor)), (34 * factor), 0, null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (51 * factor), (5 * factor), (5 * factor), (4 * factor)),-90), (29 * factor), (4 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (56 * factor), 0, factor, (5 * factor)), (33 * factor), (4 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (57 * factor), (5 * factor), (5 * factor), (4 * factor)),90), (34 * factor), (4 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (57 * factor), 0, factor, (5 * factor)), (38 * factor), (4 * factor), null); - - // Right - g.drawImage(ImageUtils.crop(fromImage, (56 * factor), (27 * factor), (8 * factor), (4 * factor)), (44 * factor), 0, null); - g.drawImage(ImageUtils.flip(ImageUtils.crop(fromImage, (48 * factor), (27 * factor), (8 * factor), (4 * factor)), true, false), (52 * factor), 0, null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (55 * factor), (20 * factor), factor, (7 * factor)),90), (40 * factor), (4 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (55 * factor), (20 * factor), factor, (5 * factor)),90), (47 * factor), (4 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (56 * factor), (20 * factor), factor, (7 * factor)),90), (52 * factor), (4 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (56 * factor), (20 * factor), factor, (5 * factor)),90), (59 * factor), (4 * factor), null); - - // Left - g.drawImage(ImageUtils.flip(ImageUtils.crop(fromImage, (56 * factor), (27 * factor), (8 * factor), (4 * factor)), true, false), (44 * factor), (6 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (27 * factor), (8 * factor), (4 * factor)), (52 * factor), (6 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (55 * factor), (20 * factor), factor, (7 * factor)),90), (40 * factor), (10 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (55 * factor), (20 * factor), factor, (5 * factor)),90), (47 * factor), (10 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (56 * factor), (20 * factor), factor, (7 * factor)),90), (52 * factor), (10 * factor), null); - g.drawImage(ImageUtils.rotate(ImageUtils.crop(fromImage, (56 * factor), (20 * factor), factor, (5 * factor)),90), (59 * factor), (10 * factor), null); - - ImageUtils.write(newImage, "png", fromFile); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/EnchantedItemGlintConverter.java b/legacy/EnchantedItemGlintConverter.java deleted file mode 100644 index 974e095..0000000 --- a/legacy/EnchantedItemGlintConverter.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class EnchantedItemGlintConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/misc/enchanted_item_glint.png"}); - } - - public EnchantedItemGlintConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert enchanted item glint %s", from)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - fromImage = ImageUtils.saturate(fromImage, -100); - fromImage = ImageUtils.rotate(fromImage, -90); - - ImageUtils.write(fromImage, "png", fromFile); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/FireworksConverter.java b/legacy/FireworksConverter.java deleted file mode 100644 index 49b3624..0000000 --- a/legacy/FireworksConverter.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class FireworksConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/items/fireworks.png", "textures/entity/fireworks.png"}); - } - - public FireworksConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return delete; - } - - context.log("Convert fireworks"); - - BufferedImage fromImage = ImageIO.read(fromFile); - - int factor = fromImage.getWidth() / 16; - - BufferedImage newImage = new BufferedImage((32 * factor), (32 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - g.drawImage(ImageUtils.rotate(fromImage, -90), 0, 0, null); - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/FishHookConverter.java b/legacy/FishHookConverter.java deleted file mode 100644 index d030f7e..0000000 --- a/legacy/FishHookConverter.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class FishHookConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/fishhook.png", "textures/entity/fishhook.png"}); - } - - public FishHookConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return delete; - } - - context.log("Convert fishhook"); - - BufferedImage fromImage = ImageIO.read(fromFile); - - int factor = fromImage.getWidth() / 8; - - BufferedImage newImage = new BufferedImage((24 * factor), (3 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, factor, factor), 0, 0, null); - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, factor, factor), (2 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, factor, factor), (2 * factor), (2 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, factor, factor), 0, (2 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), factor, factor, factor), factor, 0, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), factor, factor, factor), (2 * factor), factor, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), factor, factor, factor), factor, (2 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), factor, factor, factor), 0, factor, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (4 * factor), factor, factor), factor, factor, null); - - g.drawImage(ImageUtils.crop(fromImage, (5 * factor), (3 * factor), factor, factor), (3 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (5 * factor), (3 * factor), factor, factor), (5 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (5 * factor), (3 * factor), factor, factor), (5 * factor), (2 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (5 * factor), (3 * factor), factor, factor), (3 * factor), (2 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (3 * factor), factor, factor), (4 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (3 * factor), factor, factor), (5 * factor), factor, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (3 * factor), factor, factor), (4 * factor), (2 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (3 * factor), factor, factor), (3 * factor), factor, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (4 * factor), factor, factor), (4 * factor), factor, null); - - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, (3 * factor), (3 * factor)), (6 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, (3 * factor), (3 * factor)), (9 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, (3 * factor), (3 * factor)), (12 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (3 * factor), factor, (3 * factor), (3 * factor)), (15 * factor), 0, null); - - g.drawImage(ImageUtils.crop(fromImage, (2 * factor), (5 * factor), (3 * factor), (3 * factor)), (18 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (4 * factor), factor, factor), (22 * factor), (2 * factor), null); - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/FixWrongRootFolderConverter.java b/legacy/FixWrongRootFolderConverter.java deleted file mode 100644 index 5f7a5c1..0000000 --- a/legacy/FixWrongRootFolderConverter.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.*; -import java.util.stream.Collectors; - -@AutoService(Converter.class) -public class FixWrongRootFolderConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"pack.mcmeta", new String[] {"pack.png", "assets/", "bedrock_textures/", "bedrock_uuid_header", "bedrock_uuid_module"}}); - } - - public FixWrongRootFolderConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String packMcmeta = (String) context.data()[0]; - String[] moveFiles = (String[]) context.data()[1]; - - if (storage.resolve(packMcmeta).toFile().exists()) { - return new ArrayList<>(); - } - - context.log(String.format("%s not found in root folder (But are needed in the root folder, even in the Java version) - Try to lookup in sub folders ...", packMcmeta)); - - Path rootPath = null; - for (Path filePath : Files.walk(storage).filter(Files::isRegularFile).collect(Collectors.toList())) { - if (filePath.getFileName().toString().equals(packMcmeta)) { - rootPath = filePath.getParent(); - break; - } - } - - if (rootPath == null) { - throw new AssertionError(String.format("%s not found! Is this really a Java texture pack?", packMcmeta)); - } - - context.log(String.format("Root folder found in sub folder %s", rootPath.relativize(storage).toString())); - - List moveFilesList = new ArrayList<>(); - moveFilesList.add(packMcmeta); - moveFilesList.addAll(Arrays.asList(moveFiles)); - - for (String fileName : moveFilesList) { - if (rootPath.resolve(fileName).toFile().exists()) { - Files.move(rootPath.resolve(fileName), storage.resolve(fileName)); - } - } - } catch (IOException e) { - e.printStackTrace(); - } - - return new ArrayList<>(); - } -} diff --git a/legacy/FoxConverter.java b/legacy/FoxConverter.java deleted file mode 100644 index c041d3d..0000000 --- a/legacy/FoxConverter.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class FoxConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/fox/fox.png", "textures/entity/fox/fox_sleep.png", "textures/entity/fox/fox.png"}); - defaultData.add(new Object[] {"textures/entity/fox/arctic_fox.png", "textures/entity/fox/arctic_fox_sleep.png", "textures/entity/fox/arctic_fox.png"}); - } - - public FoxConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String from = (String) context.data()[0]; - String fromSleep = (String) context.data()[1]; - String to = (String) context.data()[2]; - - File fromFile = storage.resolve(from).toFile(); - File fromSleepFile = storage.resolve(fromSleep).toFile(); - - if (!fromFile.exists() || !fromSleepFile.exists()) { - return delete; - } - - context.log(String.format("Convert fox %s", to)); - - BufferedImage fromImage = ImageIO.read(fromFile); - BufferedImage fromSleepImage = ImageIO.read(fromSleepFile); - - int factor = fromImage.getWidth() / 48; - - BufferedImage newImage = new BufferedImage((64 * factor), (32 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - // Ears - g.drawImage(ImageUtils.crop(fromImage, (8 * factor), factor, (6 * factor), (3 * factor)), 0, 0, null); - g.drawImage(ImageUtils.crop(fromImage, (15 * factor), factor, (6 * factor), (3 * factor)), (22 * factor), 0, null); - - // Head normal - g.drawImage(ImageUtils.crop(fromImage, factor, (5 * factor), (28 * factor), (12 * factor)), 0, 0, null); - - // Head sleep - g.drawImage(ImageUtils.crop(fromSleepImage, factor, (5 * factor), (28 * factor), (12 * factor)), 0, (12 * factor), null); - - // Mount - g.drawImage(ImageUtils.crop(fromImage, (6 * factor), (18 * factor), (14 * factor), (5 * factor)), 0, (24 * factor), null); - - // Body - g.drawImage(ImageUtils.crop(fromImage, (24 * factor), (21 * factor), (6 * factor), (11 * factor)), (30 * factor), (21 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (30 * factor), (15 * factor), (18 * factor), (17 * factor)), (36 * factor), (15 * factor), null); - - // Tail - g.drawImage(ImageUtils.crop(fromImage, (30 * factor), 0, (18 * factor), (14 * factor)), (28 * factor), 0, null); - - // Legs - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (24 * factor), (8 * factor), (8 * factor)), (14 * factor), (24 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (4 * factor), (24 * factor), (8 * factor), (8 * factor)), (22 * factor), (24 * factor), null); - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/HorseConverter.java b/legacy/HorseConverter.java deleted file mode 100644 index 851ad0b..0000000 --- a/legacy/HorseConverter.java +++ /dev/null @@ -1,265 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class HorseConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/horse2/donkey.png", "textures/entity/horse/donkey.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_black.png", "textures/entity/horse/horse_black.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_brown.png", "textures/entity/horse/horse_brown.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_chestnut.png", "textures/entity/horse/horse_chestnut.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_creamy.png", "textures/entity/horse/horse_creamy.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_darkbrown.png", "textures/entity/horse/horse_darkbrown.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_gray.png", "textures/entity/horse/horse_gray.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_skeleton.png", "textures/entity/horse/horse_skeleton.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_white.png", "textures/entity/horse/horse_white.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_zombie.png", "textures/entity/horse/horse_zombie.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/mule.png", "textures/entity/horse/mule.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_markings_blackdots.png", "textures/entity/horse/horse_markings_blackdots.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_markings_white.png", "textures/entity/horse/horse_markings_white.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_markings_whitedots.png", "textures/entity/horse/horse_markings_whitedots.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/horse_markings_whitefield.png", "textures/entity/horse/horse_markings_whitefield.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/armor/horse_armor_diamond.png", "textures/entity/horse/armor/horse_armor_diamond.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/armor/horse_armor_gold.png", "textures/entity/horse/armor/horse_armor_gold.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/armor/horse_armor_iron.png", "textures/entity/horse/armor/horse_armor_iron.png"}); - defaultData.add(new Object[] {"textures/entity/horse2/armor/horse_armor_leather.png", "textures/entity/horse/armor/horse_armor_leather.png"}); - } - - public HorseConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return delete; - } - - context.log(String.format("Convert horse %s", to)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - int factor = fromImage.getWidth() / 64; - - BufferedImage newImage = new BufferedImage((fromImage.getWidth() * 2), (fromImage.getWidth() * 2), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - // Chest - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (21 * factor), (22 * factor), (11 * factor)), 0, (34 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (21 * factor), (22 * factor), (11 * factor)), 0, (47 * factor), null); - - // Saddle (Gray part) - g.drawImage(ImageUtils.crop(fromImage, (29 * factor), (5 * factor), (6 * factor), (4 * factor)), (74 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (29 * factor), (5 * factor), (6 * factor), (4 * factor)), (74 * factor), (4 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (29 * factor), (5 * factor), (6 * factor), (4 * factor)), (74 * factor), (13 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (31 * factor), (5 * factor), factor, factor), (81 * factor), (26 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (31 * factor), (5 * factor), factor, factor), (87 * factor), (26 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (31 * factor), (5 * factor), factor, factor), (101 * factor), (26 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (31 * factor), (5 * factor), factor, factor), (107 * factor), (26 * factor), null); - - // Saddle (Color part) - g.drawImage(ImageUtils.crop(fromImage, (35 * factor), 0, (10 * factor), (9 * factor)), (88 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (35 * factor), 0, (10 * factor), (9 * factor)), (98 * factor), 0, null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (9 * factor), (2 * factor)), (82 * factor), (9 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (7 * factor), (2 * factor)), (91 * factor), (9 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (6 * factor), (2 * factor)), (108 * factor), (9 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (8 * factor), factor), (80 * factor), (8 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (8 * factor), factor), (108 * factor), (8 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (9 * factor), factor), (80 * factor), (11 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (9 * factor), factor), (89 * factor), (11 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (2 * factor), factor), (98 * factor), (11 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (9 * factor), factor), (106 * factor), (11 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, factor), (115 * factor), (11 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (9 * factor), factor), (92 * factor), (13 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, factor), (101 * factor), (13 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (9 * factor), factor), (92 * factor), (19 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, factor), (101 * factor), (19 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (2 * factor), factor), (71 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (35 * factor), 0, (4 * factor), (6 * factor)), (70 * factor), factor, null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (2 * factor), factor), (81 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, (35 * factor), 0, (4 * factor), (6 * factor)), (80 * factor), factor, null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (3 * factor), factor), (60 * factor), (22 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (8 * factor), factor), (63 * factor), (23 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (3 * factor), factor), (71 * factor), (22 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (2 * factor), factor), (74 * factor), (21 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (3 * factor), factor), (60 * factor), (27 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (8 * factor), factor), (63 * factor), (28 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (3 * factor), factor), (71 * factor), (27 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (2 * factor), factor), (74 * factor), (26 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (81 * factor), (24 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (81 * factor), (27 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (5 * factor), factor), (82 * factor), (26 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (87 * factor), (24 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (87 * factor), (27 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (101 * factor), (24 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (101 * factor), (27 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), (5 * factor), factor), (102 * factor), (26 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (107 * factor), (24 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (26 * factor), (9 * factor), factor, (2 * factor)), (107 * factor), (27 * factor), null); - - // Horse - g.drawImage(ImageUtils.crop(fromImage, 0, (54 * factor), factor, (10 * factor)), 0, (58 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (54 * factor), factor, (10 * factor)), factor, (58 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (54 * factor), (64 * factor), (10 * factor)), (2 * factor), (58 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (62 * factor), (54 * factor), factor, (10 * factor)), (66 * factor), (58 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (62 * factor), (54 * factor), factor, (10 * factor)), (67 * factor), (58 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (22 * factor), (32 * factor), (20 * factor), factor), (24 * factor), (34 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (22 * factor), (32 * factor), (20 * factor), (22 * factor)), (24 * factor), (35 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (22 * factor), (53 * factor), (20 * factor), factor), (24 * factor), (57 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, 0, (35 * factor), (22 * factor), factor), factor, (12 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (35 * factor), (22 * factor), factor), factor, (13 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (35 * factor), (22 * factor), (19 * factor)), factor, (14 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (15 * factor), (42 * factor), (7 * factor), factor), (16 * factor), (20 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (42 * factor), (7 * factor), factor), factor, (20 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (53 * factor), (22 * factor), factor), factor, (33 * factor), null); - g.drawImage(ImageUtils.crop(newImage, factor, (20 * factor), factor, (14 * factor)), 0, (20 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (22 * factor), (20 * factor), factor, (14 * factor)), (23 * factor), (20 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (14 * factor), (8 * factor)), (44 * factor), (33 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (14 * factor), (8 * factor)), (60 * factor), (33 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (16 * factor), (8 * factor)), (79 * factor), (34 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (32 * factor), (16 * factor), factor), (79 * factor), (42 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (79 * factor), (34 * factor), factor, (9 * factor)), (78 * factor), (34 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (94 * factor), (34 * factor), factor, (9 * factor)), (95 * factor), (34 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (78 * factor), (34 * factor), (18 * factor), (9 * factor)), (96 * factor), (34 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (52 * factor), (21 * factor), (8 * factor), (4 * factor)), (48 * factor), (51 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (52 * factor), (21 * factor), (8 * factor), (4 * factor)), (64 * factor), (51 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (52 * factor), (21 * factor), (8 * factor), (4 * factor)), (82 * factor), (51 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (52 * factor), (21 * factor), (8 * factor), (4 * factor)), (100 * factor), (51 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (33 * factor), (16 * factor), (3 * factor)), (44 * factor), (55 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (33 * factor), (16 * factor), (3 * factor)), (60 * factor), (55 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (33 * factor), (16 * factor), (3 * factor)), (78 * factor), (55 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (33 * factor), (16 * factor), (3 * factor)), (96 * factor), (55 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, 0, (12 * factor), (6 * factor), (8 * factor)), 0, (12 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (7 * factor), (13 * factor), (10 * factor), (8 * factor)), (7 * factor), 0, null); - g.drawImage(ImageUtils.crop(fromImage, 0, (20 * factor), (9 * factor), (5 * factor)), 0, (7 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (10 * factor), (20 * factor), (14 * factor), (5 * factor)), (9 * factor), (7 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (25 * factor), (20 * factor), factor, (5 * factor)), (23 * factor), (7 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, 0, (25 * factor), (18 * factor), factor), (25 * factor), (18 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (25 * factor), (18 * factor), (8 * factor)), (25 * factor), (19 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (25 * factor), factor, (8 * factor)), (24 * factor), (19 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (25 * factor), factor, (8 * factor)), (43 * factor), (19 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (25 * factor), (18 * factor), (5 * factor)), (24 * factor), (27 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, 0, (33 * factor), (18 * factor), (2 * factor)), (24 * factor), (32 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (4 * factor)), (48 * factor), (29 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (4 * factor)), (64 * factor), (29 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (78 * factor), (34 * factor), (8 * factor), (5 * factor)), (83 * factor), (29 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (78 * factor), (34 * factor), (8 * factor), (5 * factor)), (101 * factor), (29 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (3 * factor)), (47 * factor), (41 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (3 * factor)), (63 * factor), (41 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (3 * factor)), (81 * factor), (43 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (3 * factor)), (99 * factor), (43 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (44 * factor), (44 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (50 * factor), (44 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (60 * factor), (44 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (66 * factor), (44 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (78 * factor), (46 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (84 * factor), (46 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (96 * factor), (46 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (6 * factor), (5 * factor)), (102 * factor), (46 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (48 * factor), (25 * factor), (4 * factor), (3 * factor)), (47 * factor), 0, null); - g.drawImage(ImageUtils.crop(newImage, (78 * factor), (34 * factor), factor, (2 * factor)), (44 * factor), (3 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (78 * factor), (34 * factor), (8 * factor), (2 * factor)), (45 * factor), (3 * factor), null); - g.drawImage(ImageUtils.crop(newImage, (85 * factor), (34 * factor), factor, (2 * factor)), (53 * factor), (3 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (42 * factor), (40 * factor), (6 * factor), (7 * factor)), (45 * factor), (7 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (42 * factor), (40 * factor), (10 * factor), (4 * factor)), (38 * factor), (14 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (42 * factor), (40 * factor), (10 * factor), (4 * factor)), (48 * factor), (14 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (42 * factor), (40 * factor), (6 * factor), (5 * factor)), (31 * factor), (5 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (42 * factor), (40 * factor), (13 * factor), (4 * factor)), (26 * factor), (10 * factor), null); - g.drawImage(ImageUtils.crop(fromImage, (43 * factor), (52 * factor), (2 * factor), (2 * factor)), (39 * factor), (11 * factor), null); - g.drawImage(ImageUtils.flip(ImageUtils.crop(fromImage, (43 * factor), (52 * factor), (2 * factor), (2 * factor)), true, false), (24 * factor), (11 * factor), null); - g.drawImage(ImageUtils.flip(ImageUtils.flip(ImageUtils.crop(fromImage, (43 * factor), (52 * factor), (2 * factor), (2 * factor)), true, false), false, true), (31 * factor), (3 * factor), null); - g.drawImage(ImageUtils.flip(ImageUtils.flip(ImageUtils.crop(fromImage, (43 * factor), (52 * factor), (2 * factor), (2 * factor)), true, false), false, true), (34 * factor), (3 * factor), null); - - g.drawImage(ImageUtils.crop(fromImage, (19 * factor), (16 * factor), (6 * factor), (4 * factor)), 0, 0, null); - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/IconsConverter.java b/legacy/IconsConverter.java deleted file mode 100644 index 6fb6f8d..0000000 --- a/legacy/IconsConverter.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class IconsConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/gui/icons.png"}); - } - - public IconsConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File iconsFile = storage.resolve(from).toFile(); - - if (!iconsFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert icons %s", from)); - - BufferedImage iconsImage = ImageIO.read(iconsFile); - - for (int x = 0; x < iconsImage.getWidth(); x++) { - for (int y = 0; y < iconsImage.getHeight(); y++) { - Color c = new Color(iconsImage.getRGB(x, y), true); - if (c.getAlpha() == 0) { - iconsImage.setRGB(x, y, Color.TRANSLUCENT); - } - } - } - - ImageUtils.write(iconsImage, "png", iconsFile); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/MapIconsConverter.java b/legacy/MapIconsConverter.java deleted file mode 100644 index 1b34e39..0000000 --- a/legacy/MapIconsConverter.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class MapIconsConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/map/map_icons.png", "textures/map/map_icons.png"}); - } - - public MapIconsConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File iconsFile = storage.resolve(from).toFile(); - - if (!iconsFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert map icons %s", to)); - - BufferedImage iconsImage = ImageIO.read(iconsFile); - - int factor = iconsImage.getWidth() / 128; - - BufferedImage newIconsImage = new BufferedImage((64 * factor), (64 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newIconsImage.getGraphics(); - - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, 0, 0, (8 * factor), (8 * factor)), 2f), -factor, factor, null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (8 * factor), 0, (8 * factor), (8 * factor)), 2f), (15 * factor), factor, null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (16 * factor), 0, (8 * factor), (8 * factor)), 2f), (31 * factor), factor, null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (24 * factor), 0, (8 * factor), (8 * factor)), 2f), (47 * factor), factor, null); - - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (80 * factor), (8 * factor), (8 * factor), (8 * factor)), 2f), 0, (16 * factor), null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (40 * factor), 0, (8 * factor), (8 * factor)), 2f), (15 * factor), (16 * factor), null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (48 * factor), 0, (8 * factor), (8 * factor)), 2f), (32 * factor), (16 * factor), null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (48 * factor), (8 * factor), (8 * factor), (8 * factor)), 2f), (48 * factor), (16 * factor), null); // Alternative icon - - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (96 * factor), 0, (8 * factor), (8 * factor)), 2f), 0, (32 * factor), null); // Alternative icon - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (88 * factor), 0, (8 * factor), (8 * factor)), 2f), (16 * factor), (32 * factor), null); // Alternative icon - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (112 * factor), 0, (8 * factor), (8 * factor)), 2f), (32 * factor), (32 * factor), null); // Alternative icon - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (24 * factor), (8 * factor), (8 * factor), (8 * factor)), 2f), (48 * factor), (32 * factor), null); // Alternative icon - - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (120 * factor), 0, (8 * factor), (8 * factor)), 2f), 0, (48 * factor), null); // Alternative icon - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (56 * factor), 0, (8 * factor), (8 * factor)), 2f), (15 * factor), (48 * factor), null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (64 * factor), 0, (8 * factor), (8 * factor)), 2f), (32 * factor), (48 * factor), null); - g.drawImage(ImageUtils.scale(ImageUtils.crop(iconsImage, (72 * factor), 0, (8 * factor), (8 * factor)), 2f), (48 * factor), (48 * factor), null); - - ImageUtils.write(newIconsImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/NineSliceConverter.java b/legacy/NineSliceConverter.java deleted file mode 100644 index 61b611e..0000000 --- a/legacy/NineSliceConverter.java +++ /dev/null @@ -1,309 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class NineSliceConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] { - "textures/gui/recipe_book.png", - 256, - new Object[] { - new Object[] {54, 206, 24, 24, 5, new String[] { - "textures/ui/cell_image_red", - "textures/ui/recipe_book_red_button", - "textures/ui/recipe_book_red_button_pressed", - "textures/ui/button_trade_red", - "textures/ui/button_trade_red_pressed" - }} - }, - new String[0] - }); - defaultData.add(new Object[] { - "textures/gui/widgets.png", - 256, - new Object[] { - new Object[] {0, 46, 200, 20, 5, new String[] { - "textures/ui/button_borderless_darkpressednohover", - "textures/ui/button_borderless_lightpressednohover", - "textures/ui/disabledButtonNoBorder", - "textures/ui/recipe_book_button_borderless_lightpressednohover" - }}, - new Object[] {0, 66, 200, 20, 5, new String[] { - "textures/ui/button_borderless_dark", - "textures/ui/button_borderless_light", - "textures/ui/pocket_button_default", - "textures/ui/recipe_book_button_borderless_light", - "textures/ui/recipe_book_dark_button", - "textures/ui/recipe_book_light_button" - }}, - new Object[] {0, 86, 200, 20, 5, new String[] { - "textures/ui/button_borderless_darkhover", - "textures/ui/button_borderless_darkpressed", - "textures/ui/button_borderless_lighthover", - "textures/ui/button_borderless_lightpressed", - "textures/ui/pocket_button_hover", - "textures/ui/pocket_button_pressed", - "textures/ui/recipe_book_button_borderless_lighthover", - "textures/ui/recipe_book_button_borderless_lightpressed", - "textures/ui/recipe_book_dark_button_pressed", - "textures/ui/recipe_book_light_button_pressed" - }}, - new Object[] {0, 22, 24, 24, 5, new String[] { - "textures/ui/cell_image_invert" - }} - }, - new String[] { - "textures/ui/focus_border_selected", - "textures/ui/focus_border_white", - "textures/ui/pack_borders", - "textures/ui/pause_screen_border", - "textures/ui/square_image_border_white", - "textures/ui/world_screenshot_focus_border" - } - }); - defaultData.add(new Object[] { - "textures/gui/container/beacon.png", - 256, - new Object[] { - new Object[] {0, 219, 22, 22, 5, new String[] { - "textures/ui/beacon_button_default" - }}, - new Object[] {22, 219, 22, 22, 5, new String[] { - "textures/ui/beacon_button_pressed" - }}, - new Object[] {44, 219, 22, 22, 5, new String[] { - "textures/ui/beacon_button_locked" - }}, - new Object[] {66, 219, 22, 22, 5, new String[] { - "textures/ui/beacon_button_hover" - }} - }, - new String[0] - }); - defaultData.add(new Object[] { - "textures/gui/container/enchanting_table.png", - 256, - new Object[] { - new Object[] {0, 166, 108, 19, 5, new String[] { - "textures/ui/enchanting_active_background" - }}, - new Object[] {0, 185, 108, 19, 5, new String[] { - "textures/ui/enchanting_dark_background" - }}, - new Object[] {0, 204, 108, 19, 5, new String[] { - "textures/ui/enchanting_active_background_with_hover_text" - }} - }, - new String[0] - }); - defaultData.add(new Object[] { - "textures/gui/container/generic_54.png", - 256, - new Object[] { - new Object[] {7, 17, 18, 18, 5, new String[] { - "textures/ui/cell_image", - "textures/ui/cell_image_normal", - "textures/ui/item_cell", - "textures/ui/recipe_book_item_bg" - }}, - new Object[] {2, 2, 1, 1, 0, new String[] { - "textures/ui/dialog_divider", - "textures/ui/divider", - "textures/ui/divider2", - "textures/ui/divider3", - "textures/ui/HowToPlayDivider", - "textures/ui/lightgreybars", - "textures/ui/list_item_divider_line_light", - "textures/ui/StoreTopBar", - "textures/ui/StoreTopBarFiller" - }} - }, - new String[] { - "textures/ui/recipe_book_pane_bg", - "textures/ui/recipe_book_touch_cell_selected" - } - }); - defaultData.add(new Object[] { - "textures/gui/container/inventory.png", - 256, - new Object[] { - new Object[] {25, 7, 51, 72, 5, new String[] { - "textures/ui/player_preview_border" - }} - }, - new String[0] - }); - defaultData.add(new Object[] { - "textures/gui/container/creative_inventory/tab_item_search.png", - 256, - new Object[] { - new Object[] {80, 4, 90, 12, 5, new String[] { - "textures/ui/edit_box_indent", - "textures/ui/edit_box_indent_hover" - }} - }, - new String[0] - }); - defaultData.add(new Object[] { - "textures/gui/container/creative_inventory/tabs.png", - 256, - new Object[] { - new Object[] {0, 0, 28, 32, 5, new String[] { - "textures/ui/pocket_tab_left_side", - "textures/ui/recipe_book_side_toggle_dark", - "textures/ui/TabLeftBack", - "textures/ui/TabLeftBackBottomMost", - "textures/ui/TabLeftBackTopMost", - "textures/ui/TabTopBackLeftMost" - }}, - new Object[] {28, 0, 28, 32, 5, new String[] { - "textures/ui/recipe_back_panel", - "textures/ui/TabTopBack", - "textures/ui/toolbar_background" - }}, - new Object[] {140, 0, 28, 32, 5, new String[] { - "textures/ui/pocket_tab_right_side", - "textures/ui/TabRightBack", - "textures/ui/TabRightBackBottomMost", - "textures/ui/TabRightBackTopMost", - "textures/ui/TabTopBackRightMost", - "textures/ui/TabTopBackRightMostDark", - "textures/ui/XTab" - }}, - new Object[] {0, 32, 28, 32, 5, new String[] { - "textures/ui/recipe_book_side_toggle_dark_hover", - "textures/ui/TabLeftFront", - "textures/ui/TabLeftFrontBottomMost", - "textures/ui/TabLeftFrontTopMost", - "textures/ui/TabTopFrontLeftMost" - }}, - new Object[] {28, 32, 28, 32, 5, new String[] { - "textures/ui/TabTopFront" - }}, - new Object[] {140, 32, 28, 32, 5, new String[] { - "textures/ui/TabRightFront", - "textures/ui/TabRightFrontBottomMost", - "textures/ui/TabRightFrontTopMost", - "textures/ui/TabTopFrontRightMost", - "textures/ui/TabTopFrontRightMostDark" - }} - }, - new String[0] - }); - } - - public NineSliceConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - int factorDetect = (int) context.data()[1]; - Object[] buttons = (Object[]) context.data()[2]; - String[] borders = (String[]) context.data()[3]; - - File fromFile = storage.resolve(from).toFile(); - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - BufferedImage fromImage = ImageIO.read(fromFile); - fromImage = ImageUtils.ensureMinWidth(fromImage, factorDetect); - - int factor = (fromImage.getWidth() / factorDetect); - - ObjectMapper mapper = new ObjectMapper().enable(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES); - - for (Object button : buttons) { - Object[] buttonArr = (Object[]) button; - int x = (int) buttonArr[0]; - int y = (int) buttonArr[1]; - int width = (int) buttonArr[2]; - int height = (int) buttonArr[3]; - int size = (int) buttonArr[4]; - String[] tos = (String[]) buttonArr[5]; - - BufferedImage toImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor)); - - // image.autoCropTransparent(); - - JsonNode metadata = mapper.readTree("{nineslice_size: " + size + ", base_size: [" + width + ", " + height + "]}"); - - for (String toPath : tos) { - context.log(String.format("Convert button %s (Experimental)", toPath)); - - ImageUtils.write(toImage, "png", storage.resolve(toPath + ".png").toFile()); - - mapper.writeValue(storage.resolve(toPath + ".json").toFile(), metadata); - } - } - - BufferedImage transparentImage = new BufferedImage(factor, factor, BufferedImage.TYPE_INT_ARGB); - JsonNode metadata = mapper.readTree("{nineslice_size: 0, base_size: [1, 1]}"); - for (String border : borders) { - context.log(String.format("Convert button %s (Experimental)", border)); - - ImageUtils.write(transparentImage, "png", storage.resolve(border + ".png").toFile()); - - mapper.writeValue(storage.resolve(border + ".json").toFile(), metadata); - } - - } catch (IOException e) { e.printStackTrace(); } - - return new ArrayList<>(); - } - - @Override - public boolean isExperimental() { - return true; - } -} diff --git a/legacy/OpaqueConverter.java b/legacy/OpaqueConverter.java deleted file mode 100644 index 48ed0c1..0000000 --- a/legacy/OpaqueConverter.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class OpaqueConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - // Leaves - defaultData.add(new Object[] {"textures/blocks/leaves_acacia.png", "textures/blocks/leaves_acacia_opaque.png"}); - defaultData.add(new Object[] {"textures/blocks/leaves_big_oak.png", "textures/blocks/leaves_big_oak_opaque.png"}); - defaultData.add(new Object[] {"textures/blocks/leaves_birch.png", "textures/blocks/leaves_birch_opaque.png"}); - defaultData.add(new Object[] {"textures/blocks/leaves_jungle.png", "textures/blocks/leaves_jungle_opaque.png"}); - defaultData.add(new Object[] {"textures/blocks/leaves_oak.png", "textures/blocks/leaves_oak_opaque.png"}); - defaultData.add(new Object[] {"textures/blocks/leaves_spruce.png", "textures/blocks/leaves_spruce_opaque.png"}); - } - - public OpaqueConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Create opaque %s", to)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - BufferedImage toImage = new BufferedImage(fromImage.getWidth(), fromImage.getHeight(), BufferedImage.TYPE_INT_ARGB); - - Graphics g = toImage.getGraphics(); - - g.setColor(Color.black); - g.fillRect(0, 0, toImage.getWidth(), toImage.getHeight()); - - g.drawImage(fromImage, 0, 0, null); - - ImageUtils.write(toImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/PistonArmConverter.java b/legacy/PistonArmConverter.java deleted file mode 100644 index 343cde1..0000000 --- a/legacy/PistonArmConverter.java +++ /dev/null @@ -1,167 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class PistonArmConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/blocks/piston_top_normal.png", "textures/blocks/piston_top_normal.png", "textures/blocks/piston_side.png", "textures/entity/pistonarm/pistonArm.png"}); - defaultData.add(new Object[] {"textures/blocks/piston_top_sticky.png", "textures/blocks/piston_top_normal.png", "textures/blocks/piston_side.png", "textures/entity/pistonarm/pistonArmSticky.png"}); - } - - public PistonArmConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String top1 = (String) context.data()[0]; - String top2 = (String) context.data()[1]; - String side = (String) context.data()[2]; - String to = (String) context.data()[3]; - - File top1File = storage.resolve(top1).toFile(); - File top2File = storage.resolve(top2).toFile(); - File sideFile = storage.resolve(side).toFile(); - - if (!top1File.exists() || !top2File.exists() || !sideFile.exists()) { - return delete; - } - - context.log(String.format("Create piston arm %s", to)); - - BufferedImage top1Image = ImageIO.read(top1File); - BufferedImage top2Image = ImageIO.read(top2File); - BufferedImage sideImage = ImageIO.read(sideFile); - - top1Image = ImageUtils.ensureMinWidth(top1Image, 16); - top2Image = ImageUtils.ensureMinWidth(top2Image, 16); - sideImage = ImageUtils.ensureMinWidth(sideImage, 16); - - int factor = top1Image.getWidth() / 16; - - BufferedImage newImage = new BufferedImage((128 * factor), (32 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - g.drawImage(top1Image, (16 * factor), 0, null); - g.drawImage(top2Image, (32 * factor), 0, null); - - sideImage = ImageUtils.crop(sideImage, 0, 0, sideImage.getWidth(), (4 * factor)); - g.drawImage(sideImage, 0, (16 * factor), null); - g.drawImage(sideImage, (16 * factor), (16 * factor), null); - g.drawImage(sideImage, (32 * factor), (16 * factor), null); - g.drawImage(sideImage, (48 * factor), (16 * factor), null); - - // Arm top - BufferedImage side2Image = ImageUtils.rotate(ImageUtils.crop(sideImage, 0, 0, (8 * factor), (4 * factor)), -90); - - g.drawImage(side2Image, (64 * factor), (4 * factor), null); - g.drawImage(side2Image, (68 * factor), (4 * factor), null); - g.drawImage(side2Image, (72 * factor), (4 * factor), null); - g.drawImage(side2Image, (76 * factor), (4 * factor), null); - - // Arm bottom top - BufferedImage side3Image = ImageUtils.crop(side2Image, 0, (side2Image.getHeight() - factor), side2Image.getWidth(), factor); - BufferedImage side4Image = ImageUtils.crop(sideImage, (7 * factor), 0, factor, sideImage.getHeight()); - BufferedImage side5Image = ImageUtils.crop(side2Image, 0, (2 * factor), side2Image.getWidth(), (4 * factor)); - - g.drawImage(side3Image, (70 * factor), (18 * factor), null); - g.drawImage(side3Image, (74 * factor), (18 * factor), null); - g.drawImage(side3Image, (78 * factor), (18 * factor), null); - - g.drawImage(side4Image, (70 * factor), (19 * factor), null); - g.drawImage(side4Image, (75 * factor), (19 * factor), null); - g.drawImage(side4Image, (76 * factor), (19 * factor), null); - g.drawImage(side4Image, (81 * factor), (19 * factor), null); - - g.drawImage(side3Image, (70 * factor), (23 * factor), null); - g.drawImage(side3Image, (74 * factor), (23 * factor), null); - g.drawImage(side3Image, (78 * factor), (23 * factor), null); - - // Arm bottom - g.drawImage(side3Image, (64 * factor), (24 * factor), null); - g.drawImage(side3Image, (68 * factor), (24 * factor), null); - g.drawImage(side3Image, (72 * factor), (24 * factor), null); - g.drawImage(side3Image, (76 * factor), (24 * factor), null); - g.drawImage(side3Image, (80 * factor), (24 * factor), null); - g.drawImage(side3Image, (84 * factor), (24 * factor), null); - - g.drawImage(side4Image, (64 * factor), (25 * factor), null); - g.drawImage(side4Image, (64 * factor), (29 * factor), null); - g.drawImage(side4Image, (69 * factor), (25 * factor), null); - g.drawImage(side4Image, (69 * factor), (29 * factor), null); - g.drawImage(side4Image, (70 * factor), (25 * factor), null); - g.drawImage(side4Image, (70 * factor), (29 * factor), null); - g.drawImage(side4Image, (75 * factor), (25 * factor), null); - g.drawImage(side4Image, (75 * factor), (29 * factor), null); - g.drawImage(side4Image, (76 * factor), (25 * factor), null); - g.drawImage(side4Image, (76 * factor), (29 * factor), null); - g.drawImage(side4Image, (81 * factor), (25 * factor), null); - g.drawImage(side4Image, (81 * factor), (29 * factor), null); - g.drawImage(side4Image, (82 * factor), (25 * factor), null); - g.drawImage(side4Image, (82 * factor), (29 * factor), null); - g.drawImage(side4Image, (87 * factor), (25 * factor), null); - g.drawImage(side4Image, (87 * factor), (29 * factor), null); - - g.drawImage(side5Image, (65 * factor), (25 * factor), null); - g.drawImage(side5Image, (65 * factor), (29 * factor), null); - g.drawImage(side5Image, (71 * factor), (25 * factor), null); - g.drawImage(side5Image, (71 * factor), (29 * factor), null); - g.drawImage(side5Image, (77 * factor), (25 * factor), null); - g.drawImage(side5Image, (77 * factor), (29 * factor), null); - g.drawImage(side5Image, (83 * factor), (25 * factor), null); - g.drawImage(side5Image, (83 * factor), (29 * factor), null); - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/PlaceholderConverter.java b/legacy/PlaceholderConverter.java deleted file mode 100644 index 32a953a..0000000 --- a/legacy/PlaceholderConverter.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class PlaceholderConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - // Bed - defaultData.add(new Object[] {"textures/entity/bed/red.png", 2, 6, 14, 14, 64, "textures/blocks/bed_head_top.png"}); - defaultData.add(new Object[] {"textures/entity/bed/red.png", 0, 6, 6, 14, 64, "textures/blocks/bed_head_side.png"}); - defaultData.add(new Object[] {"textures/entity/bed/red.png", 6, 0, 14, 6, 64, "textures/blocks/bed_head_end.png"}); - defaultData.add(new Object[] {"textures/entity/bed/red.png", 2, 20, 14, 14, 64, "textures/blocks/bed_feet_top.png"}); - defaultData.add(new Object[] {"textures/entity/bed/red.png", 22, 0, 14, 6, 64, "textures/blocks/bed_feet_end.png"}); - defaultData.add(new Object[] {"textures/entity/bed/red.png", 0, 20, 6, 14, 64, "textures/blocks/bed_feet_side.png"}); - - // Bed item - defaultData.add(new Object[] {"textures/entity/bed/black.png", 6, 6, 16, 32, 64, "textures/items/bed_black.png"}); - defaultData.add(new Object[] {"textures/entity/bed/blue.png", 6, 6, 16, 32, 64, "textures/items/bed_blue.png"}); - defaultData.add(new Object[] {"textures/entity/bed/brown.png", 6, 6, 16, 32, 64, "textures/items/bed_brown.png"}); - defaultData.add(new Object[] {"textures/entity/bed/cyan.png", 6, 6, 16, 32, 64, "textures/items/bed_cyan.png"}); - defaultData.add(new Object[] {"textures/entity/bed/gray.png", 6, 6, 16, 32, 64, "textures/items/bed_gray.png"}); - defaultData.add(new Object[] {"textures/entity/bed/green.png", 6, 6, 16, 32, 64, "textures/items/bed_green.png"}); - defaultData.add(new Object[] {"textures/entity/bed/light_blue.png", 6, 6, 16, 32, 64, "textures/items/bed_light_blue.png"}); - defaultData.add(new Object[] {"textures/entity/bed/lime.png", 6, 6, 16, 32, 64, "textures/items/bed_lime.png"}); - defaultData.add(new Object[] {"textures/entity/bed/magenta.png", 6, 6, 16, 32, 64, "textures/items/bed_magenta.png"}); - defaultData.add(new Object[] {"textures/entity/bed/orange.png", 6, 6, 16, 32, 64, "textures/items/bed_orange.png"}); - defaultData.add(new Object[] {"textures/entity/bed/pink.png", 6, 6, 16, 32, 64, "textures/items/bed_pink.png"}); - defaultData.add(new Object[] {"textures/entity/bed/purple.png", 6, 6, 16, 32, 64, "textures/items/bed_purple.png"}); - defaultData.add(new Object[] {"textures/entity/bed/red.png", 6, 6, 16, 32, 64, "textures/items/bed_red.png"}); - defaultData.add(new Object[] {"textures/entity/bed/silver.png", 6, 6, 16, 32, 64, "textures/items/bed_silver.png"}); - defaultData.add(new Object[] {"textures/entity/bed/white.png", 6, 6, 16, 32, 64, "textures/items/bed_white.png"}); - defaultData.add(new Object[] {"textures/entity/bed/yellow.png", 6, 6, 16, 32, 64, "textures/items/bed_yellow.png"}); - - // Chain - defaultData.add(new Object[] {"textures/blocks/chain.png", 3, 0, 3, 16, 16, "textures/blocks/chain1.png", 1}); - defaultData.add(new Object[] {"textures/blocks/chain.png", 0, 0, 3, 16, 16, "textures/blocks/chain2.png", 1}); - - // Chest - defaultData.add(new Object[] {"textures/entity/chest/normal.png", 14, 0, 14, 14, 64, "textures/blocks/chest_top.png"}); - defaultData.add(new Object[] {"textures/entity/chest/ender.png", 14, 0, 14, 14, 64, "textures/blocks/ender_chest_top.png"}); - - // Conduit - defaultData.add(new Object[] {"textures/blocks/conduit_base.png", 0, 0, 24, 12, 32, "textures/blocks/conduit_base.png", 2}); - defaultData.add(new Object[] {"textures/blocks/conduit_closed.png", 0, 0, 8, 8, 16, "textures/blocks/conduit_closed.png", 2, 5}); - defaultData.add(new Object[] {"textures/blocks/conduit_open.png", 0, 0, 8, 8, 16, "textures/blocks/conduit_open.png", 2, 5}); - - // Command block - defaultData.add(new Object[] {"textures/blocks/chain_command_block_back.png", 0, 0, 16, 16, 16, "textures/blocks/chain_command_block_back_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/chain_command_block_conditional.png", 0, 0, 16, 16, 16, "textures/blocks/chain_command_block_conditional_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/chain_command_block_front.png", 0, 0, 16, 16, 16, "textures/blocks/chain_command_block_front_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/chain_command_block_side.png", 0, 0, 16, 16, 16, "textures/blocks/chain_command_block_side_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/command_block_back.png", 0, 0, 16, 16, 16, "textures/blocks/command_block_back_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/command_block_conditional.png", 0, 0, 16, 16, 16, "textures/blocks/command_block_conditional_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/command_block_front.png", 0, 0, 16, 16, 16, "textures/blocks/command_block_front_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/command_block_side.png", 0, 0, 16, 16, 16, "textures/blocks/command_block_side_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/repeating_command_block_back.png", 0, 0, 16, 16, 16, "textures/blocks/repeating_command_block_back_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/repeating_command_block_conditional.png", 0, 0, 16, 16, 16, "textures/blocks/repeating_command_block_conditional_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/repeating_command_block_front.png", 0, 0, 16, 16, 16, "textures/blocks/repeating_command_block_front_mipmap.png"}); - defaultData.add(new Object[] {"textures/blocks/repeating_command_block_side.png", 0, 0, 16, 16, 16, "textures/blocks/repeating_command_block_side_mipmap.png"}); - - // Compass & clock - defaultData.add(new Object[] {"textures/items/compass_atlas.png", 0, 0, 16, 16, 16, "textures/items/compass_item.png"}); - defaultData.add(new Object[] {"textures/items/watch_atlas.png", 0, 0, 16, 16, 16, "textures/items/clock_item.png"}); - - // Sign - defaultData.add(new Object[] {"textures/entity/sign_acacia.png", 2, 2, 24, 12, 64, "textures/ui/sign_acacia.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign_birch.png", 2, 2, 24, 12, 64, "textures/ui/sign_birch.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign_crimson.png", 2, 2, 24, 12, 64, "textures/ui/sign_crimson.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign_darkoak.png", 2, 2, 24, 12, 64, "textures/ui/sign_darkoak.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign_jungle.png", 2, 2, 24, 12, 64, "textures/ui/sign_jungle.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign.png", 2, 2, 24, 12, 64, "textures/ui/sign.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign_spruce.png", 2, 2, 24, 12, 64, "textures/ui/sign_spruce.png", 2}); - defaultData.add(new Object[] {"textures/entity/sign_warped.png", 2, 2, 24, 12, 64, "textures/ui/sign_warped.png", 2}); - - // Water, lava & co. - defaultData.add(new Object[] {"textures/blocks/cauldron_water.png", 0, 0, 16, 16, 16, "textures/blocks/cauldron_water_placeholder.png"}); - defaultData.add(new Object[] {"textures/blocks/fire_0.png", 0, 0, 16, 16, 16, "textures/blocks/fire_0_placeholder.png"}); - defaultData.add(new Object[] {"textures/blocks/fire_1.png", 0, 0, 16, 16, 16, "textures/blocks/fire_1_placeholder.png"}); - defaultData.add(new Object[] {"textures/blocks/lava_still.png", 0, 0, 16, 16, 16, "textures/blocks/lava_placeholder.png"}); - defaultData.add(new Object[] {"textures/blocks/portal.png", 0, 0, 16, 16, 16, "textures/blocks/portal_placeholder.png"}); - defaultData.add(new Object[] {"textures/blocks/water_still.png", 0, 0, 16, 16, 16, "textures/blocks/water_placeholder.png"}); - - // Zombie - defaultData.add(new Object[] {"textures/entity/pig/pigzombie.png", 0, 0, 64, 32, 64, "textures/entity/pig/pigzombie.png", 2}); - defaultData.add(new Object[] {"textures/entity/zombie/husk.png", 0, 0, 64, 32, 64, "textures/entity/zombie/husk.png", 2}); - defaultData.add(new Object[] {"textures/entity/zombie/zombie.png", 0, 0, 64, 32, 64, "textures/entity/zombie/zombie.png", 2}); - } - - public PlaceholderConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - int x = (int) context.data()[1]; - int y = (int) context.data()[2]; - int width = (int) context.data()[3]; - int height = (int) context.data()[4]; - int factorDetect = (int) context.data()[5]; - String to = (String) context.data()[6]; - int squareMode = context.data().length > 7 ? (int) context.data()[7] : 0; - int minPackFormat = context.data().length > 8 ? (int) context.data()[8] : -1; - - if (minPackFormat > -1) { - // TODO: Add support for min pack format - } - - File placeholderFile = storage.resolve(from).toFile(); - - if (!placeholderFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Create placeholder %s", to)); - - BufferedImage placeholderImage = ImageUtils.ensureMinWidth(ImageIO.read(placeholderFile), factorDetect); - - int factor = placeholderImage.getWidth() / factorDetect; - - placeholderImage = ImageUtils.crop(placeholderImage, (x * factor), (y * factor), (width * factor), (height * factor)); - - int size; - BufferedImage newPlaceholderImage; - switch (squareMode) { - case 1: - // Left top - size = Math.max(width, height); - newPlaceholderImage = new BufferedImage((size * factor), (size * factor), BufferedImage.TYPE_INT_ARGB); - - newPlaceholderImage.getGraphics().drawImage(placeholderImage, 0, 0, null); - - placeholderImage = newPlaceholderImage; - break; - - case 2: - // No - break; - - case 0: - default: - // Center - size = Math.max(width, height); - newPlaceholderImage = new BufferedImage((size * factor), (size * factor), BufferedImage.TYPE_INT_ARGB); - - newPlaceholderImage.getGraphics().drawImage(placeholderImage, (((size * factor) - (width * factor)) / 2), (((size * factor) - (height * factor)) / 2), null); - - placeholderImage = newPlaceholderImage; - } - - ImageUtils.write(placeholderImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/RedstoneDustConverter.java b/legacy/RedstoneDustConverter.java deleted file mode 100644 index 9958072..0000000 --- a/legacy/RedstoneDustConverter.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class RedstoneDustConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/blocks/redstone_dust_dot.png", "textures/blocks/redstone_dust_line0.png", "textures/blocks/redstone_dust_line1.png", "textures/blocks/redstone_dust_cross.png", "textures/blocks/redstone_dust_line.png"}); - } - - public RedstoneDustConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - String dot = (String) context.data()[0]; - String line0 = (String) context.data()[1]; - String line1 = (String) context.data()[2]; - String to_cross = (String) context.data()[3]; - String to_line = (String) context.data()[4]; - - File dotFile = storage.resolve(dot).toFile(); - File line0File = storage.resolve(line0).toFile(); - File line1File = storage.resolve(line1).toFile(); - - if (!dotFile.exists() || !line0File.exists() || !line1File.exists()) { - return delete; - } - - context.log("Convert redstone dust"); - - BufferedImage newImage = ImageIO.read(line0File); - newImage = ImageUtils.rotate(newImage, 90); - ImageUtils.write(newImage, "png", storage.resolve(to_line).toFile()); - - BufferedImage line1Image = ImageIO.read(line1File); - if (ImageUtils.isEmptyArea(line1Image, 0, 0, line1Image.getWidth(), (line1Image.getHeight() / 16))) { - line1Image = ImageUtils.rotate(line1Image, 90); - } - newImage.getGraphics().drawImage(line1Image, 0, 0, null); - - - BufferedImage dotImage = ImageIO.read(dotFile); - newImage.getGraphics().drawImage(dotImage, 0, 0, null); - - ImageUtils.write(newImage, "png", storage.resolve(to_cross).toFile()); - - delete.add(new DeleteConverter(packConverter, storage, new Object[] {dot})); - delete.add(new DeleteConverter(packConverter, storage, new Object[] {line0})); - delete.add(new DeleteConverter(packConverter, storage, new Object[] {line1})); - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/RenameConverter.java b/legacy/RenameConverter.java deleted file mode 100644 index 59b6d69..0000000 --- a/legacy/RenameConverter.java +++ /dev/null @@ -1,1089 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.jetbrains.annotations.NotNull; - -import java.io.IOException; -import java.nio.file.Files; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class RenameConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - // Icon - defaultData.add(new String[] {"pack.png", "pack_icon.png"}); - - // Base folder - defaultData.add(new String[] {"assets/minecraft/textures/", "textures/"}); - defaultData.add(new String[] {"assets/minecraft/sounds/", "sounds/"}); - - // Folder - defaultData.add(new String[] {"textures/block/", "textures/blocks/"}); - defaultData.add(new String[] {"textures/item/", "textures/items/"}); - - // Andesite - defaultData.add(new String[] {"textures/blocks/andesite.png", "textures/blocks/stone_andesite.png"}); - defaultData.add(new String[] {"textures/blocks/polished_andesite.png", "textures/blocks/stone_andesite_smooth.png"}); - - // Anvil - defaultData.add(new String[] {"textures/blocks/anvil.png", "textures/blocks/anvil_base.png"}); - defaultData.add(new String[] {"textures/blocks/anvil_top.png", "textures/blocks/anvil_top_damaged_0.png"}); - defaultData.add(new String[] {"textures/blocks/chipped_anvil_top.png", "textures/blocks/anvil_top_damaged_1.png"}); - defaultData.add(new String[] {"textures/blocks/damaged_anvil_top.png", "textures/blocks/anvil_top_damaged_2.png"}); - - // Apple - defaultData.add(new String[] {"textures/items/golden_apple.png", "textures/items/apple_golden.png"}); - - // Armor & tool - defaultData.add(new String[] {"textures/entity/armorstand/wood.png", "textures/entity/armor_stand.png"}); - defaultData.add(new String[] {"textures/entity/elytra.png", "textures/models/armor/elytra.png"}); - defaultData.add(new String[] {"textures/items/golden_axe.png", "textures/items/gold_axe.png"}); - defaultData.add(new String[] {"textures/items/golden_boots.png", "textures/items/gold_boots.png"}); - defaultData.add(new String[] {"textures/items/golden_chestplate.png", "textures/items/gold_chestplate.png"}); - defaultData.add(new String[] {"textures/items/golden_helmet.png", "textures/items/gold_helmet.png"}); - defaultData.add(new String[] {"textures/items/golden_hoe.png", "textures/items/gold_hoe.png"}); - defaultData.add(new String[] {"textures/items/golden_horse_armor.png", "textures/items/gold_horse_armor.png"}); - defaultData.add(new String[] {"textures/items/golden_leggings.png", "textures/items/gold_leggings.png"}); - defaultData.add(new String[] {"textures/items/golden_pickaxe.png", "textures/items/gold_pickaxe.png"}); - defaultData.add(new String[] {"textures/items/golden_shovel.png", "textures/items/gold_shovel.png"}); - defaultData.add(new String[] {"textures/items/golden_sword.png", "textures/items/gold_sword.png"}); - defaultData.add(new String[] {"textures/items/wooden_axe.png", "textures/items/wood_axe.png"}); - defaultData.add(new String[] {"textures/items/wooden_hoe.png", "textures/items/wood_hoe.png"}); - defaultData.add(new String[] {"textures/items/wooden_pickaxe.png", "textures/items/wood_pickaxe.png"}); - defaultData.add(new String[] {"textures/items/wooden_shovel.png", "textures/items/wood_shovel.png"}); - defaultData.add(new String[] {"textures/items/wooden_sword.png", "textures/items/wood_sword.png"}); - defaultData.add(new String[] {"textures/models/armor/chainmail_layer_1.png", "textures/models/armor/chain_1.png"}); - defaultData.add(new String[] {"textures/models/armor/chainmail_layer_2.png", "textures/models/armor/chain_2.png"}); - defaultData.add(new String[] {"textures/models/armor/diamond_layer_1.png", "textures/models/armor/diamond_1.png"}); - defaultData.add(new String[] {"textures/models/armor/diamond_layer_2.png", "textures/models/armor/diamond_2.png"}); - defaultData.add(new String[] {"textures/models/armor/gold_layer_1.png", "textures/models/armor/gold_1.png"}); - defaultData.add(new String[] {"textures/models/armor/gold_layer_2.png", "textures/models/armor/gold_2.png"}); - defaultData.add(new String[] {"textures/models/armor/iron_layer_1.png", "textures/models/armor/iron_1.png"}); - defaultData.add(new String[] {"textures/models/armor/iron_layer_2.png", "textures/models/armor/iron_2.png"}); - defaultData.add(new String[] {"textures/models/armor/leather_layer_1.png", "textures/models/armor/leather_1.png"}); - defaultData.add(new String[] {"textures/models/armor/leather_layer_1_overlay.png", "textures/models/armor/leather_1_overlay.png"}); - defaultData.add(new String[] {"textures/models/armor/leather_layer_2.png", "textures/models/armor/leather_2.png"}); - defaultData.add(new String[] {"textures/models/armor/leather_layer_2_overlay.png", "textures/models/armor/leather_2_overlay.png"}); - defaultData.add(new String[] {"textures/models/armor/netherite_layer_1.png", "textures/models/armor/netherite_1.png"}); - defaultData.add(new String[] {"textures/models/armor/netherite_layer_2.png", "textures/models/armor/netherite_2.png"}); - defaultData.add(new String[] {"textures/models/armor/turtle_layer_1.png", "textures/models/armor/turtle_1.png"}); - - // Arrow - defaultData.add(new String[] {"textures/entity/arrow.png", "textures/entity/arrows.png"}); - - // Bamboo - defaultData.add(new String[] {"textures/blocks/bamboo_large_leaves.png", "textures/blocks/bamboo_leaf.png"}); - defaultData.add(new String[] {"textures/blocks/bamboo_small_leaves.png", "textures/blocks/bamboo_small_leaf.png"}); - defaultData.add(new String[] {"textures/blocks/bamboo_stage0.png", "textures/blocks/bamboo_sapling.png"}); - defaultData.add(new String[] {"textures/blocks/bamboo_stalk.png", "textures/blocks/bamboo_stem.png"}); - - // Barrier - defaultData.add(new String[] {"textures/items/barrier.png", "textures/blocks/barrier.png"}); - - // Bear - defaultData.add(new String[] {"textures/entity/bear/polarbear.png", "textures/entity/polarbear.png"}); - - // Bed - defaultData.add(new String[] {"textures/entity/bed/light_gray.png", "textures/entity/bed/silver.png"}); - - // Bee - defaultData.add(new String[] {"textures/blocks/beehive_end.png", "textures/blocks/beehive_top.png"}); - - // Beetroot - defaultData.add(new String[] {"textures/blocks/beetroots_stage0.png", "textures/blocks/beetroots_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/beetroots_stage1.png", "textures/blocks/beetroots_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/beetroots_stage2.png", "textures/blocks/beetroots_stage_2.png"}); - defaultData.add(new String[] {"textures/blocks/beetroots_stage3.png", "textures/blocks/beetroots_stage_3.png"}); - - // Bell - defaultData.add(new String[] {"textures/entity/bell/bell_body.png", "textures/entity/bell/bell.png"}); - defaultData.add(new String[] {"textures/items/bell.png", "textures/items/villagebell.png"}); - - // Boat - defaultData.add(new String[] {"textures/entity/boat/acacia.png", "textures/entity/boat/boat_acacia.png"}); - defaultData.add(new String[] {"textures/entity/boat/birch.png", "textures/entity/boat/boat_birch.png"}); - defaultData.add(new String[] {"textures/entity/boat/dark_oak.png", "textures/entity/boat/boat_darkoak.png"}); - defaultData.add(new String[] {"textures/entity/boat/jungle.png", "textures/entity/boat/boat_jungle.png"}); - defaultData.add(new String[] {"textures/entity/boat/oak.png", "textures/entity/boat/boat_oak.png"}); - defaultData.add(new String[] {"textures/entity/boat/spruce.png", "textures/entity/boat/boat_spruce.png"}); - defaultData.add(new String[] {"textures/items/acacia_boat.png", "textures/items/boat_acacia.png"}); - defaultData.add(new String[] {"textures/items/birch_boat.png", "textures/items/boat_birch.png"}); - defaultData.add(new String[] {"textures/items/dark_oak_boat.png", "textures/items/boat_darkoak.png"}); - defaultData.add(new String[] {"textures/items/jungle_boat.png", "textures/items/boat_jungle.png"}); - defaultData.add(new String[] {"textures/items/oak_boat.png", "textures/items/boat_oak.png"}); - defaultData.add(new String[] {"textures/items/spruce_boat.png", "textures/items/boat_spruce.png"}); - - // Bone - defaultData.add(new String[] {"textures/items/bone_meal.png", "textures/items/dye_powder_white.png"}); - - // Book - defaultData.add(new String[] {"textures/items/book.png", "textures/items/book_normal.png"}); - defaultData.add(new String[] {"textures/items/enchanted_book.png", "textures/items/book_enchanted.png"}); - defaultData.add(new String[] {"textures/items/knowledge_book.png", "textures/items/book_knowledge.png"}); - defaultData.add(new String[] {"textures/items/writable_book.png", "textures/items/book_writable.png"}); - defaultData.add(new String[] {"textures/items/written_book.png", "textures/items/book_written.png"}); - - // Bow - defaultData.add(new String[] {"textures/items/bow.png", "textures/items/bow_standby.png"}); - - // Brick - defaultData.add(new String[] {"textures/blocks/bricks.png", "textures/blocks/brick.png"}); - - // Bucket - defaultData.add(new String[] {"textures/items/bucket.png", "textures/items/bucket_empty.png"}); - defaultData.add(new String[] {"textures/items/cod_bucket.png", "textures/items/bucket_cod.png"}); - defaultData.add(new String[] {"textures/items/lava_bucket.png", "textures/items/bucket_lava.png"}); - defaultData.add(new String[] {"textures/items/milk_bucket.png", "textures/items/bucket_milk.png"}); - defaultData.add(new String[] {"textures/items/pufferfish_bucket.png", "textures/items/bucket_pufferfish.png"}); - defaultData.add(new String[] {"textures/items/salmon_bucket.png", "textures/items/bucket_salmon.png"}); - defaultData.add(new String[] {"textures/items/tropical_fish_bucket.png", "textures/items/bucket_tropical.png"}); - defaultData.add(new String[] {"textures/items/water_bucket.png", "textures/items/bucket_water.png"}); - - // Campfire - defaultData.add(new String[] {"textures/blocks/campfire_fire.png", "textures/blocks/campfire.png"}); - defaultData.add(new String[] {"textures/blocks/soul_campfire_fire.png", "textures/blocks/soul_campfire.png"}); - - // Carrot - defaultData.add(new String[] {"textures/blocks/carrots_stage0.png", "textures/blocks/carrots_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/carrots_stage1.png", "textures/blocks/carrots_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/carrots_stage2.png", "textures/blocks/carrots_stage_2.png"}); - defaultData.add(new String[] {"textures/blocks/carrots_stage3.png", "textures/blocks/carrots_stage_3.png"}); - defaultData.add(new String[] {"textures/items/golden_carrot.png", "textures/items/carrot_golden.png"}); - - // Cat - defaultData.add(new String[] {"textures/entity/cat/all_black.png", "textures/entity/cat/allblackcat.png"}); - defaultData.add(new String[] {"textures/entity/cat/black.png", "textures/entity/cat/tuxedo.png"}); - defaultData.add(new String[] {"textures/entity/cat/british_shorthair.png", "textures/entity/cat/britishshorthair.png"}); - defaultData.add(new String[] {"textures/entity/cat/cat_collar.png", "textures/entity/cat/graytabby_tame.png"}); - defaultData.add(new String[] {"textures/entity/cat/red.png", "textures/entity/cat/redtabby.png"}); - defaultData.add(new String[] {"textures/entity/cat/siamese.png", "textures/entity/cat/siamesecat.png"}); - - // Chest - defaultData.add(new String[] {"textures/entity/chest/normal_double.png", "textures/entity/chest/double_normal.png"}); - - // Chorus fruit - defaultData.add(new String[] {"textures/items/popped_chorus_fruit.png", "textures/items/chorus_fruit_popped.png"}); - - // Cobblestone - defaultData.add(new String[] {"textures/blocks/mossy_cobblestone.png", "textures/blocks/cobblestone_mossy.png"}); - - // Cobweb - defaultData.add(new String[] {"textures/blocks/cobweb.png", "textures/blocks/web.png"}); - - // Cocoa - defaultData.add(new String[] {"textures/blocks/cocoa_stage0.png", "textures/blocks/cocoa_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/cocoa_stage1.png", "textures/blocks/cocoa_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/cocoa_stage2.png", "textures/blocks/cocoa_stage_2.png"}); - defaultData.add(new String[] {"textures/items/cocoa_beans.png", "textures/items/dye_powder_brown.png"}); - - // Comparator - defaultData.add(new String[] {"textures/blocks/comparator.png", "textures/blocks/comparator_off.png"}); - - // Composter - defaultData.add(new String[] {"textures/blocks/composter_compost.png", "textures/blocks/compost.png"}); - defaultData.add(new String[] {"textures/blocks/composter_ready.png", "textures/blocks/compost_ready.png"}); - - // Concrete - defaultData.add(new String[] {"textures/blocks/black_concrete.png", "textures/blocks/concrete_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_concrete.png", "textures/blocks/concrete_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_concrete.png", "textures/blocks/concrete_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_concrete.png", "textures/blocks/concrete_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_concrete.png", "textures/blocks/concrete_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_concrete.png", "textures/blocks/concrete_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_concrete.png", "textures/blocks/concrete_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_concrete.png", "textures/blocks/concrete_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_concrete.png", "textures/blocks/concrete_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_concrete.png", "textures/blocks/concrete_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_concrete.png", "textures/blocks/concrete_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_concrete.png", "textures/blocks/concrete_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_concrete.png", "textures/blocks/concrete_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_concrete.png", "textures/blocks/concrete_red.png"}); - defaultData.add(new String[] {"textures/blocks/white_concrete.png", "textures/blocks/concrete_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_concrete.png", "textures/blocks/concrete_yellow.png"}); - - // Concrete powder - defaultData.add(new String[] {"textures/blocks/black_concrete_powder.png", "textures/blocks/concrete_powder_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_concrete_powder.png", "textures/blocks/concrete_powder_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_concrete_powder.png", "textures/blocks/concrete_powder_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_concrete_powder.png", "textures/blocks/concrete_powder_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_concrete_powder.png", "textures/blocks/concrete_powder_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_concrete_powder.png", "textures/blocks/concrete_powder_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_concrete_powder.png", "textures/blocks/concrete_powder_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_concrete_powder.png", "textures/blocks/concrete_powder_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_concrete_powder.png", "textures/blocks/concrete_powder_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_concrete_powder.png", "textures/blocks/concrete_powder_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_concrete_powder.png", "textures/blocks/concrete_powder_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_concrete_powder.png", "textures/blocks/concrete_powder_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_concrete_powder.png", "textures/blocks/concrete_powder_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_concrete_powder.png", "textures/blocks/concrete_powder_red.png"}); - defaultData.add(new String[] {"textures/blocks/white_concrete_powder.png", "textures/blocks/concrete_powder_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_concrete_powder.png", "textures/blocks/concrete_powder_yellow.png"}); - - // Conduit - defaultData.add(new String[] {"textures/entity/conduit/base.png", "textures/blocks/conduit_base.png"}); - defaultData.add(new String[] {"textures/entity/conduit/cage.png", "textures/blocks/conduit_cage.png"}); - defaultData.add(new String[] {"textures/entity/conduit/closed_eye.png", "textures/blocks/conduit_closed.png"}); - defaultData.add(new String[] {"textures/entity/conduit/open_eye.png", "textures/blocks/conduit_open.png"}); - defaultData.add(new String[] {"textures/entity/conduit/wind.png", "textures/blocks/conduit_wind_horizontal.png"}); - defaultData.add(new String[] {"textures/entity/conduit/wind_vertical.png", "textures/blocks/conduit_wind_vertical.png"}); - defaultData.add(new String[] {"textures/items/heart_of_the_sea.png", "textures/items/heartofthesea_closed.png"}); - - // Coral - defaultData.add(new String[] {"textures/blocks/brain_coral.png", "textures/blocks/coral_plant_pink.png"}); - defaultData.add(new String[] {"textures/blocks/bubble_coral.png", "textures/blocks/coral_plant_purple.png"}); - defaultData.add(new String[] {"textures/blocks/fire_coral.png", "textures/blocks/coral_plant_red.png"}); - defaultData.add(new String[] {"textures/blocks/horn_coral.png", "textures/blocks/coral_plant_yellow.png"}); - defaultData.add(new String[] {"textures/blocks/tube_coral.png", "textures/blocks/coral_plant_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brain_coral_block.png", "textures/blocks/coral_pink.png"}); - defaultData.add(new String[] {"textures/blocks/bubble_coral_block.png", "textures/blocks/coral_purple.png"}); - defaultData.add(new String[] {"textures/blocks/fire_coral_block.png", "textures/blocks/coral_red.png"}); - defaultData.add(new String[] {"textures/blocks/horn_coral_block.png", "textures/blocks/coral_yellow.png"}); - defaultData.add(new String[] {"textures/blocks/tube_coral_block.png", "textures/blocks/coral_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brain_coral_fan.png", "textures/blocks/coral_fan_pink.png"}); - defaultData.add(new String[] {"textures/blocks/bubble_coral_fan.png", "textures/blocks/coral_fan_purple.png"}); - defaultData.add(new String[] {"textures/blocks/fire_coral_fan.png", "textures/blocks/coral_fan_red.png"}); - defaultData.add(new String[] {"textures/blocks/horn_coral_fan.png", "textures/blocks/coral_fan_yellow.png"}); - defaultData.add(new String[] {"textures/blocks/tube_coral_fan.png", "textures/blocks/coral_fan_blue.png"}); - defaultData.add(new String[] {"textures/blocks/dead_brain_coral_block.png", "textures/blocks/coral_pink_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_bubble_coral_block.png", "textures/blocks/coral_purple_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_fire_coral_block.png", "textures/blocks/coral_red_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_horn_coral_block.png", "textures/blocks/coral_yellow_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_tube_coral_block.png", "textures/blocks/coral_blue_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_brain_coral_fan.png", "textures/blocks/coral_fan_pink_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_bubble_coral_fan.png", "textures/blocks/coral_fan_purple_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_fire_coral_fan.png", "textures/blocks/coral_fan_red_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_horn_coral_fan.png", "textures/blocks/coral_fan_yellow_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_tube_coral_fan.png", "textures/blocks/coral_fan_blue_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_brain_coral.png", "textures/blocks/coral_plant_pink_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_bubble_coral.png", "textures/blocks/coral_plant_purple_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_fire_coral.png", "textures/blocks/coral_plant_red_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_horn_coral.png", "textures/blocks/coral_plant_yellow_dead.png"}); - defaultData.add(new String[] {"textures/blocks/dead_tube_coral.png", "textures/blocks/coral_plant_blue_dead.png"}); - - // Cow - defaultData.add(new String[] {"textures/entity/cow/red_mooshroom.png", "textures/entity/cow/mooshroom.png"}); - - // Crimson - defaultData.add(new String[] {"textures/blocks/crimson_nylium.png", "textures/blocks/crimson_nylium_top.png"}); - defaultData.add(new String[] {"textures/blocks/crimson_planks.png", "textures/blocks/huge_fungus/crimson_planks.png"}); - defaultData.add(new String[] {"textures/blocks/crimson_stem.png", "textures/blocks/huge_fungus/crimson_log_side.png"}); - defaultData.add(new String[] {"textures/blocks/crimson_stem_top.png", "textures/blocks/huge_fungus/crimson_log_top.png"}); - defaultData.add(new String[] {"textures/blocks/stripped_crimson_stem.png", "textures/blocks/huge_fungus/stripped_crimson_stem_side.png"}); - defaultData.add(new String[] {"textures/blocks/stripped_crimson_stem_top.png", "textures/blocks/huge_fungus/stripped_crimson_stem_top.png"}); - - // Dead bush - defaultData.add(new String[] {"textures/blocks/dead_bush.png", "textures/blocks/deadbush.png"}); - - // Destroy stage - defaultData.add(new String[] {"textures/blocks/destroy_stage_0.png", "textures/environment/destroy_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_1.png", "textures/environment/destroy_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_2.png", "textures/environment/destroy_stage_2.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_3.png", "textures/environment/destroy_stage_3.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_4.png", "textures/environment/destroy_stage_4.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_5.png", "textures/environment/destroy_stage_5.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_6.png", "textures/environment/destroy_stage_6.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_7.png", "textures/environment/destroy_stage_7.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_8.png", "textures/environment/destroy_stage_8.png"}); - defaultData.add(new String[] {"textures/blocks/destroy_stage_9.png", "textures/environment/destroy_stage_9.png"}); - - // Diorite - defaultData.add(new String[] {"textures/blocks/diorite.png", "textures/blocks/stone_diorite.png"}); - defaultData.add(new String[] {"textures/blocks/polished_diorite.png", "textures/blocks/stone_diorite_smooth.png"}); - - // Dispenser - defaultData.add(new String[] {"textures/blocks/dispenser_front.png", "textures/blocks/dispenser_front_horizontal.png"}); - - // Door - defaultData.add(new String[] {"textures/blocks/acacia_door_bottom.png", "textures/blocks/door_acacia_lower.png"}); - defaultData.add(new String[] {"textures/blocks/birch_door_bottom.png", "textures/blocks/door_birch_lower.png"}); - defaultData.add(new String[] {"textures/blocks/crimson_door_bottom.png", "textures/blocks/huge_fungus/crimson_door_lower.png"}); - defaultData.add(new String[] {"textures/blocks/crimson_door_top.png", "textures/blocks/huge_fungus/crimson_door_top.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_door_bottom.png", "textures/blocks/door_dark_oak_lower.png"}); - defaultData.add(new String[] {"textures/blocks/iron_door_bottom.png", "textures/blocks/door_iron_lower.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_door_bottom.png", "textures/blocks/door_jungle_lower.png"}); - defaultData.add(new String[] {"textures/blocks/oak_door_bottom.png", "textures/blocks/door_wood_lower.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_door_bottom.png", "textures/blocks/door_spruce_lower.png"}); - defaultData.add(new String[] {"textures/blocks/acacia_door_top.png", "textures/blocks/door_acacia_upper.png"}); - defaultData.add(new String[] {"textures/blocks/birch_door_top.png", "textures/blocks/door_birch_upper.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_door_top.png", "textures/blocks/door_dark_oak_upper.png"}); - defaultData.add(new String[] {"textures/blocks/iron_door_top.png", "textures/blocks/door_iron_upper.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_door_top.png", "textures/blocks/door_jungle_upper.png"}); - defaultData.add(new String[] {"textures/blocks/oak_door_top.png", "textures/blocks/door_wood_upper.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_door_top.png", "textures/blocks/door_spruce_upper.png"}); - defaultData.add(new String[] {"textures/blocks/warped_door_bottom.png", "textures/blocks/huge_fungus/warped_door_lower.png"}); - defaultData.add(new String[] {"textures/blocks/warped_door_top.png", "textures/blocks/huge_fungus/warped_door_top.png"}); - defaultData.add(new String[] {"textures/items/acacia_door.png", "textures/items/door_acacia.png"}); - defaultData.add(new String[] {"textures/items/birch_door.png", "textures/items/door_birch.png"}); - defaultData.add(new String[] {"textures/items/dark_oak_door.png", "textures/items/door_dark_oak.png"}); - defaultData.add(new String[] {"textures/items/iron_door.png", "textures/items/door_iron.png"}); - defaultData.add(new String[] {"textures/items/jungle_door.png", "textures/items/door_jungle.png"}); - defaultData.add(new String[] {"textures/items/oak_door.png", "textures/items/door_wood.png"}); - defaultData.add(new String[] {"textures/items/spruce_door.png", "textures/items/door_spruce.png"}); - - // Dragon - defaultData.add(new String[] {"textures/entity/enderdragon/", "textures/entity/dragon/"}); - defaultData.add(new String[] {"textures/entity/dragon/dragon_fireball.png", "textures/items/dragon_fireball.png"}); - defaultData.add(new String[] {"textures/items/dragon_breath.png", "textures/items/dragons_breath.png"}); - defaultData.add(new String[] {"textures/items/fire_charge.png", "textures/items/fireball.png"}); - - // Dropper - defaultData.add(new String[] {"textures/blocks/dropper_front.png", "textures/blocks/dropper_front_horizontal.png"}); - - // Dye - defaultData.add(new String[] {"textures/items/cactus_green.png", "textures/items/dye_powder_green.png"}); // 1.13 - defaultData.add(new String[] {"textures/items/dandelion_yellow.png", "textures/items/dye_powder_yellow.png"}); // 1.13 - defaultData.add(new String[] {"textures/items/rose_red.png", "textures/items/dye_powder_red.png"}); // 1.13 - defaultData.add(new String[] {"textures/items/black_dye.png", "textures/items/dye_powder_black_new.png"}); - defaultData.add(new String[] {"textures/items/blue_dye.png", "textures/items/dye_powder_blue_new.png"}); - defaultData.add(new String[] {"textures/items/brown_dye.png", "textures/items/dye_powder_brown_new.png"}); - defaultData.add(new String[] {"textures/items/cyan_dye.png", "textures/items/dye_powder_cyan.png"}); - defaultData.add(new String[] {"textures/items/gray_dye.png", "textures/items/dye_powder_gray.png"}); - defaultData.add(new String[] {"textures/items/green_dye.png", "textures/items/dye_powder_green.png"}); - defaultData.add(new String[] {"textures/items/light_blue_dye.png", "textures/items/dye_powder_light_blue.png"}); - defaultData.add(new String[] {"textures/items/light_gray_dye.png", "textures/items/dye_powder_silver.png"}); - defaultData.add(new String[] {"textures/items/lime_dye.png", "textures/items/dye_powder_lime.png"}); - defaultData.add(new String[] {"textures/items/magenta_dye.png", "textures/items/dye_powder_magenta.png"}); - defaultData.add(new String[] {"textures/items/orange_dye.png", "textures/items/dye_powder_orange.png"}); - defaultData.add(new String[] {"textures/items/pink_dye.png", "textures/items/dye_powder_pink.png"}); - defaultData.add(new String[] {"textures/items/purple_dye.png", "textures/items/dye_powder_purple.png"}); - defaultData.add(new String[] {"textures/items/red_dye.png", "textures/items/dye_powder_red.png"}); - defaultData.add(new String[] {"textures/items/white_dye.png", "textures/items/dye_powder_white_new.png"}); - defaultData.add(new String[] {"textures/items/yellow_dye.png", "textures/items/dye_powder_yellow.png"}); - - // End crystal - defaultData.add(new String[] {"textures/entity/end_crystal/", "textures/entity/endercrystal/"}); - defaultData.add(new String[] {"textures/entity/endercrystal/end_crystal.png", "textures/entity/endercrystal/endercrystal.png"}); - defaultData.add(new String[] {"textures/entity/endercrystal/end_crystal_beam.png", "textures/entity/endercrystal/endercrystal_beam.png"}); - - // End portal - defaultData.add(new String[] {"textures/blocks/end_portal_frame_eye.png", "textures/blocks/endframe_eye.png"}); - defaultData.add(new String[] {"textures/blocks/end_portal_frame_side.png", "textures/blocks/endframe_side.png"}); - defaultData.add(new String[] {"textures/blocks/end_portal_frame_top.png", "textures/blocks/endframe_top.png"}); - - // End stone - defaultData.add(new String[] {"textures/blocks/end_stone_bricks.png", "textures/blocks/end_bricks.png"}); - - // Farmland - defaultData.add(new String[] {"textures/blocks/farmland.png", "textures/blocks/farmland_dry.png"}); - defaultData.add(new String[] {"textures/blocks/farmland_moist.png", "textures/blocks/farmland_wet.png"}); - - // Fern - defaultData.add(new String[] {"textures/blocks/large_fern_bottom.png", "textures/blocks/double_plant_fern_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/large_fern_top.png", "textures/blocks/double_plant_fern_top.png"}); - - // Firework - defaultData.add(new String[] {"textures/items/firework_rocket.png", "textures/items/fireworks.png"}); - defaultData.add(new String[] {"textures/items/firework_star_overlay.png", "textures/items/fireworks_charge.png"}); - - // Fish - defaultData.add(new String[] {"textures/entity/fishing_hook.png", "textures/entity/fishhook.png"}); - defaultData.add(new String[] {"textures/items/cod.png", "textures/items/fish_raw.png"}); - defaultData.add(new String[] {"textures/items/cooked_cod.png", "textures/items/fish_cooked.png"}); - defaultData.add(new String[] {"textures/items/cooked_salmon.png", "textures/items/fish_salmon_cooked.png"}); - defaultData.add(new String[] {"textures/items/fishing_rod.png", "textures/items/fishing_rod_uncast.png"}); - defaultData.add(new String[] {"textures/items/pufferfish.png", "textures/items/fish_pufferfish_raw.png"}); - defaultData.add(new String[] {"textures/items/salmon.png", "textures/items/fish_salmon_raw.png"}); - defaultData.add(new String[] {"textures/items/tropical_fish.png", "textures/items/fish_clownfish_raw.png"}); - - // Flesh - defaultData.add(new String[] {"textures/items/beef.png", "textures/items/beef_raw.png"}); - defaultData.add(new String[] {"textures/items/chicken.png", "textures/items/chicken_raw.png"}); - defaultData.add(new String[] {"textures/items/cooked_beef.png", "textures/items/beef_cooked.png"}); - defaultData.add(new String[] {"textures/items/cooked_chicken.png", "textures/items/chicken_cooked.png"}); - defaultData.add(new String[] {"textures/items/cooked_mutton.png", "textures/items/mutton_cooked.png"}); - defaultData.add(new String[] {"textures/items/cooked_porkchop.png", "textures/items/porkchop_cooked.png"}); - defaultData.add(new String[] {"textures/items/mutton.png", "textures/items/mutton_raw.png"}); - defaultData.add(new String[] {"textures/items/porkchop.png", "textures/items/porkchop_raw.png"}); - - // Fletching table - defaultData.add(new String[] {"textures/blocks/fletching_table_front.png", "textures/blocks/fletcher_table_side2.png"}); - defaultData.add(new String[] {"textures/blocks/fletching_table_side.png", "textures/blocks/fletcher_table_side1.png"}); - defaultData.add(new String[] {"textures/blocks/fletching_table_top.png", "textures/blocks/fletcher_table_top.png"}); - - // Flower - defaultData.add(new String[] {"textures/blocks/allium.png", "textures/blocks/flower_allium.png"}); - defaultData.add(new String[] {"textures/blocks/azure_bluet.png", "textures/blocks/flower_houstonia.png"}); - defaultData.add(new String[] {"textures/blocks/blue_orchid.png", "textures/blocks/flower_blue_orchid.png"}); - defaultData.add(new String[] {"textures/blocks/cornflower.png", "textures/blocks/flower_cornflower.png"}); - defaultData.add(new String[] {"textures/blocks/dandelion.png", "textures/blocks/flower_dandelion.png"}); - defaultData.add(new String[] {"textures/blocks/lilac_bottom.png", "textures/blocks/double_plant_syringa_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/lilac_top.png", "textures/blocks/double_plant_syringa_top.png"}); - defaultData.add(new String[] {"textures/blocks/lily_of_the_valley.png", "textures/blocks/flower_lily_of_the_valley.png"}); - defaultData.add(new String[] {"textures/blocks/orange_tulip.png", "textures/blocks/flower_tulip_orange.png"}); - defaultData.add(new String[] {"textures/blocks/poppy.png", "textures/blocks/flower_rose.png"}); - defaultData.add(new String[] {"textures/blocks/oxeye_daisy.png", "textures/blocks/flower_oxeye_daisy.png"}); - defaultData.add(new String[] {"textures/blocks/peony_bottom.png", "textures/blocks/double_plant_paeonia_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/peony_top.png", "textures/blocks/double_plant_paeonia_top.png"}); - defaultData.add(new String[] {"textures/blocks/pink_tulip.png", "textures/blocks/flower_tulip_pink.png"}); - defaultData.add(new String[] {"textures/blocks/red_tulip.png", "textures/blocks/flower_tulip_red.png"}); - defaultData.add(new String[] {"textures/blocks/rose_bush_bottom.png", "textures/blocks/double_plant_rose_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/rose_bush_top.png", "textures/blocks/double_plant_rose_top.png"}); - defaultData.add(new String[] {"textures/blocks/sunflower_back.png", "textures/blocks/double_plant_sunflower_back.png"}); - defaultData.add(new String[] {"textures/blocks/sunflower_bottom.png", "textures/blocks/double_plant_sunflower_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/sunflower_front.png", "textures/blocks/double_plant_sunflower_front.png"}); - defaultData.add(new String[] {"textures/blocks/sunflower_top.png", "textures/blocks/double_plant_sunflower_top.png"}); - defaultData.add(new String[] {"textures/blocks/white_tulip.png", "textures/blocks/flower_tulip_white.png"}); - defaultData.add(new String[] {"textures/blocks/wither_rose.png", "textures/blocks/flower_wither_rose.png"}); - - // Fox - defaultData.add(new String[] {"textures/entity/fox/snow_fox.png", "textures/entity/fox/arctic_fox.png"}); - defaultData.add(new String[] {"textures/entity/fox/snow_fox_sleep.png", "textures/entity/fox/arctic_fox_sleep.png"}); - - // Furnace - defaultData.add(new String[] {"textures/blocks/blast_furnace_front.png", "textures/blocks/blast_furnace_front_off.png"}); - defaultData.add(new String[] {"textures/blocks/furnace_front.png", "textures/blocks/furnace_front_off.png"}); - defaultData.add(new String[] {"textures/blocks/smoker_front.png", "textures/blocks/smoker_front_off.png"}); - - // Glass - defaultData.add(new String[] {"textures/blocks/black_stained_glass.png", "textures/blocks/glass_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_stained_glass.png", "textures/blocks/glass_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_stained_glass.png", "textures/blocks/glass_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_stained_glass.png", "textures/blocks/glass_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_stained_glass.png", "textures/blocks/glass_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_stained_glass.png", "textures/blocks/glass_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_stained_glass.png", "textures/blocks/glass_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_stained_glass.png", "textures/blocks/glass_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_stained_glass.png", "textures/blocks/glass_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_stained_glass.png", "textures/blocks/glass_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_stained_glass.png", "textures/blocks/glass_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_stained_glass.png", "textures/blocks/glass_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_stained_glass.png", "textures/blocks/glass_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_stained_glass.png", "textures/blocks/glass_red.png"}); - defaultData.add(new String[] {"textures/blocks/white_stained_glass.png", "textures/blocks/glass_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_stained_glass.png", "textures/blocks/glass_yellow.png"}); - - // Glass pane - defaultData.add(new String[] {"textures/blocks/black_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_red.png"}); - defaultData.add(new String[] {"textures/blocks/white_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_stained_glass_pane_top.png", "textures/blocks/glass_pane_top_yellow.png"}); - - // Glazed terracotta - defaultData.add(new String[] {"textures/blocks/black_glazed_terracotta.png", "textures/blocks/glazed_terracotta_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_glazed_terracotta.png", "textures/blocks/glazed_terracotta_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_glazed_terracotta.png", "textures/blocks/glazed_terracotta_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_glazed_terracotta.png", "textures/blocks/glazed_terracotta_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_glazed_terracotta.png", "textures/blocks/glazed_terracotta_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_glazed_terracotta.png", "textures/blocks/glazed_terracotta_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_glazed_terracotta.png", "textures/blocks/glazed_terracotta_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_glazed_terracotta.png", "textures/blocks/glazed_terracotta_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_glazed_terracotta.png", "textures/blocks/glazed_terracotta_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_glazed_terracotta.png", "textures/blocks/glazed_terracotta_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_glazed_terracotta.png", "textures/blocks/glazed_terracotta_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_glazed_terracotta.png", "textures/blocks/glazed_terracotta_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_glazed_terracotta.png", "textures/blocks/glazed_terracotta_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_glazed_terracotta.png", "textures/blocks/glazed_terracotta_red.png"}); - defaultData.add(new String[] {"textures/blocks/white_glazed_terracotta.png", "textures/blocks/glazed_terracotta_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_glazed_terracotta.png", "textures/blocks/glazed_terracotta_yellow.png"}); - - // Granite - defaultData.add(new String[] {"textures/blocks/granite.png", "textures/blocks/stone_granite.png"}); - defaultData.add(new String[] {"textures/blocks/polished_granite.png", "textures/blocks/stone_granite_smooth.png"}); - - // Grass - defaultData.add(new String[] {"textures/blocks/grass.png", "textures/blocks/tallgrass.png"}); - defaultData.add(new String[] {"textures/blocks/grass_block_side.png", "textures/blocks/grass_side_carried.png"}); - defaultData.add(new String[] {"textures/blocks/grass_block_side_overlay.png", "textures/blocks/grass_side.png"}); - defaultData.add(new String[] {"textures/blocks/grass_block_snow.png", "textures/blocks/grass_side_snowed.png"}); - defaultData.add(new String[] {"textures/blocks/grass_block_top.png", "textures/blocks/grass_top.png"}); - defaultData.add(new String[] {"textures/blocks/tall_grass_bottom.png", "textures/blocks/double_plant_grass_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/tall_grass_top.png", "textures/blocks/double_plant_grass_top.png"}); - - // Hoglin - defaultData.add(new String[] {"textures/entity/hoglin/zoglin.png", "textures/entity/zoglin/zoglin.png"}); - - // Honey - defaultData.add(new String[] {"textures/blocks/honey_block_bottom.png", "textures/blocks/honey_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/honey_block_side.png", "textures/blocks/honey_side.png"}); - defaultData.add(new String[] {"textures/blocks/honey_block_top.png", "textures/blocks/honey_top.png"}); - defaultData.add(new String[] {"textures/blocks/honeycomb_block.png", "textures/blocks/honeycomb.png"}); - - // Horse - defaultData.add(new String[] {"textures/entity/horse/", "textures/entity/horse2/"}); - - // Ice - defaultData.add(new String[] {"textures/blocks/packed_ice.png", "textures/blocks/ice_packed.png"}); - - // Illager & pillager - defaultData.add(new String[] {"textures/entity/illager/evoker_fangs.png", "textures/entity/illager/fangs.png"}); - defaultData.add(new String[] {"textures/entity/illager/pillager.png", "textures/entity/pillager.png"}); - defaultData.add(new String[] {"textures/entity/illager/vex.png", "textures/entity/vex/vex.png"}); - defaultData.add(new String[] {"textures/entity/illager/vex_charging.png", "textures/entity/vex/vex_charging.png"}); - defaultData.add(new String[] {"textures/entity/illager/vindicator.png", "textures/entity/vindicator.png"}); - - // Ink sac - defaultData.add(new String[] {"textures/items/ink_sac.png", "textures/items/dye_powder_black.png"}); - - // Item frame - defaultData.add(new String[] {"textures/blocks/item_frame.png", "textures/blocks/itemframe_background.png"}); - - // Iron golem - defaultData.add(new String[] {"textures/entity/iron_golem/iron_golem.png", "textures/entity/iron_golem.png"}); - - // Jigsaw - defaultData.add(new String[] {"textures/blocks/jigsaw_bottom.png", "textures/blocks/jigsaw_back.png"}); - defaultData.add(new String[] {"textures/blocks/jigsaw_top.png", "textures/blocks/jigsaw_front.png"}); - - // Kelp - defaultData.add(new String[] {"textures/blocks/dried_kelp_side.png", "textures/blocks/dried_kelp_side_a.png"}); - defaultData.add(new String[] {"textures/blocks/kelp.png", "textures/blocks/kelp_top.png"}); - defaultData.add(new String[] {"textures/blocks/kelp_plant.png", "textures/blocks/kelp_a.png"}); - - // Lapis lazuli - defaultData.add(new String[] {"textures/items/lapis_lazuli.png", "textures/items/dye_powder_blue.png"}); - - // Leaves - defaultData.add(new String[] {"textures/blocks/acacia_leaves.png", "textures/blocks/leaves_acacia.png"}); - defaultData.add(new String[] {"textures/blocks/birch_leaves.png", "textures/blocks/leaves_birch.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_leaves.png", "textures/blocks/leaves_big_oak.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_leaves.png", "textures/blocks/leaves_jungle.png"}); - defaultData.add(new String[] {"textures/blocks/oak_leaves.png", "textures/blocks/leaves_oak.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_leaves.png", "textures/blocks/leaves_spruce.png"}); - - // Lily Pad - defaultData.add(new String[] {"textures/blocks/lily_pad.png", "textures/blocks/waterlily.png"}); - - // Llama - defaultData.add(new String[] {"textures/entity/llama/brown.png", "textures/entity/llama/llama_brown.png"}); - defaultData.add(new String[] {"textures/entity/llama/creamy.png", "textures/entity/llama/llama_creamy.png"}); - defaultData.add(new String[] {"textures/entity/llama/gray.png", "textures/entity/llama/llama_gray.png"}); - defaultData.add(new String[] {"textures/entity/llama/white.png", "textures/entity/llama/llama_white.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/black.png", "textures/entity/llama/decor/decor_black.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/blue.png", "textures/entity/llama/decor/decor_blue.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/brown.png", "textures/entity/llama/decor/decor_brown.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/cyan.png", "textures/entity/llama/decor/decor_cyan.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/gray.png", "textures/entity/llama/decor/decor_gray.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/green.png", "textures/entity/llama/decor/decor_green.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/light_blue.png", "textures/entity/llama/decor/decor_light_blue.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/light_gray.png", "textures/entity/llama/decor/decor_silver.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/lime.png", "textures/entity/llama/decor/decor_lime.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/magenta.png", "textures/entity/llama/decor/decor_magenta.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/orange.png", "textures/entity/llama/decor/decor_orange.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/pink.png", "textures/entity/llama/decor/decor_pink.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/purple.png", "textures/entity/llama/decor/decor_purple.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/red.png", "textures/entity/llama/decor/decor_red.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/trader_llama.png", "textures/entity/llama/decor/trader_llama_decor.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/white.png", "textures/entity/llama/decor/decor_white.png"}); - defaultData.add(new String[] {"textures/entity/llama/decor/yellow.png", "textures/entity/llama/decor/decor_yellow.png"}); - - // Log - defaultData.add(new String[] {"textures/blocks/acacia_log.png", "textures/blocks/log_acacia.png"}); - defaultData.add(new String[] {"textures/blocks/birch_log.png", "textures/blocks/log_birch.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_log.png", "textures/blocks/log_big_oak.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_log.png", "textures/blocks/log_jungle.png"}); - defaultData.add(new String[] {"textures/blocks/oak_log.png", "textures/blocks/log_oak.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_log.png", "textures/blocks/log_spruce.png"}); - - // Log top - defaultData.add(new String[] {"textures/blocks/acacia_log_top.png", "textures/blocks/log_acacia_top.png"}); - defaultData.add(new String[] {"textures/blocks/birch_log_top.png", "textures/blocks/log_birch_top.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_log_top.png", "textures/blocks/log_big_oak_top.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_log_top.png", "textures/blocks/log_jungle_top.png"}); - defaultData.add(new String[] {"textures/blocks/oak_log_top.png", "textures/blocks/log_oak_top.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_log_top.png", "textures/blocks/log_spruce_top.png"}); - - // Map - defaultData.add(new String[] {"textures/items/filled_map.png", "textures/items/map_filled.png"}); - defaultData.add(new String[] {"textures/items/filled_map_markings.png", "textures/items/map_filled_markings.png"}); - defaultData.add(new String[] {"textures/items/map.png", "textures/items/map_empty.png"}); - - // Melon - defaultData.add(new String[] {"textures/blocks/attached_melon_stem.png", "textures/blocks/melon_stem_connected.png"}); - defaultData.add(new String[] {"textures/blocks/melon_stem.png", "textures/blocks/melon_stem_disconnected.png"}); - defaultData.add(new String[] {"textures/items/glistering_melon_slice.png", "textures/items/melon_speckled.png"}); - defaultData.add(new String[] {"textures/items/melon_slice.png", "textures/items/melon.png"}); - - // Minecart - defaultData.add(new String[] {"textures/items/chest_minecart.png", "textures/items/minecart_chest.png"}); - defaultData.add(new String[] {"textures/items/command_block_minecart.png", "textures/items/minecart_command_block.png"}); - defaultData.add(new String[] {"textures/items/furnace_minecart.png", "textures/items/minecart_furnace.png"}); - defaultData.add(new String[] {"textures/items/hopper_minecart.png", "textures/items/minecart_hopper.png"}); - defaultData.add(new String[] {"textures/items/minecart.png", "textures/items/minecart_normal.png"}); - defaultData.add(new String[] {"textures/items/tnt_minecart.png", "textures/items/minecart_tnt.png"}); - - // Mob effect - defaultData.add(new String[] {"textures/mob_effect/absorption.png", "textures/ui/absorption_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/bad_omen.png", "textures/ui/bad_omen_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/blindness.png", "textures/ui/blindness_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/conduit_power.png", "textures/ui/conduit_power_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/dolphins_grace.png", "textures/ui/dolphins_grace_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/fire_resistance.png", "textures/ui/fire_resistance_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/glowing.png", "textures/ui/glowing_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/haste.png", "textures/ui/haste_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/health_boost.png", "textures/ui/health_boost_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/hero_of_the_village.png", "textures/ui/village_hero_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/hunger.png", "textures/ui/hunger_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/instant_damage.png", "textures/ui/instant_damage_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/instant_health.png", "textures/ui/instant_health_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/invisibility.png", "textures/ui/invisibility_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/jump_boost.png", "textures/ui/jump_boost_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/levitation.png", "textures/ui/levitation_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/luck.png", "textures/ui/luck_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/mining_fatigue.png", "textures/ui/mining_fatigue_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/nausea.png", "textures/ui/nausea_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/night_vision.png", "textures/ui/night_vision_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/poison.png", "textures/ui/poison_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/regeneration.png", "textures/ui/regeneration_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/resistance.png", "textures/ui/resistance_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/saturation.png", "textures/ui/saturation_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/slow_falling.png", "textures/ui/slow_falling_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/slowness.png", "textures/ui/slowness_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/speed.png", "textures/ui/speed_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/strength.png", "textures/ui/strength_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/unluck.png", "textures/ui/unluck_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/water_breathing.png", "textures/ui/water_breathing_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/weakness.png", "textures/ui/weakness_effect.png"}); - defaultData.add(new String[] {"textures/mob_effect/wither.png", "textures/ui/wither_effect.png"}); - - // Mushroom - defaultData.add(new String[] {"textures/blocks/brown_mushroom.png", "textures/blocks/mushroom_brown.png"}); - defaultData.add(new String[] {"textures/blocks/red_mushroom.png", "textures/blocks/mushroom_red.png"}); - defaultData.add(new String[] {"textures/blocks/brown_mushroom_block.png", "textures/blocks/mushroom_block_skin_brown.png"}); - defaultData.add(new String[] {"textures/blocks/red_mushroom_block.png", "textures/blocks/mushroom_block_skin_red.png"}); - defaultData.add(new String[] {"textures/blocks/mushroom_stem.png", "textures/blocks/mushroom_block_skin_stem.png"}); - - // Music disc - defaultData.add(new String[] {"textures/items/music_disc_11.png", "textures/items/record_11.png"}); - defaultData.add(new String[] {"textures/items/music_disc_13.png", "textures/items/record_13.png"}); - defaultData.add(new String[] {"textures/items/music_disc_blocks.png", "textures/items/record_blocks.png"}); - defaultData.add(new String[] {"textures/items/music_disc_cat.png", "textures/items/record_cat.png"}); - defaultData.add(new String[] {"textures/items/music_disc_chirp.png", "textures/items/record_chirp.png"}); - defaultData.add(new String[] {"textures/items/music_disc_far.png", "textures/items/record_far.png"}); - defaultData.add(new String[] {"textures/items/music_disc_mall.png", "textures/items/record_mall.png"}); - defaultData.add(new String[] {"textures/items/music_disc_mellohi.png", "textures/items/record_mellohi.png"}); - defaultData.add(new String[] {"textures/items/music_disc_pigstep.png", "textures/items/record_pigstep.png"}); - defaultData.add(new String[] {"textures/items/music_disc_stal.png", "textures/items/record_stal.png"}); - defaultData.add(new String[] {"textures/items/music_disc_strad.png", "textures/items/record_strad.png"}); - defaultData.add(new String[] {"textures/items/music_disc_wait.png", "textures/items/record_wait.png"}); - defaultData.add(new String[] {"textures/items/music_disc_ward.png", "textures/items/record_ward.png"}); - - // Nether brick - defaultData.add(new String[] {"textures/blocks/nether_bricks.png", "textures/blocks/nether_brick.png"}); - defaultData.add(new String[] {"textures/blocks/red_nether_bricks.png", "textures/blocks/red_nether_brick.png"}); - defaultData.add(new String[] {"textures/items/nether_brick.png", "textures/items/netherbrick.png"}); - - // Nether portal - defaultData.add(new String[] {"textures/blocks/nether_portal.png", "textures/blocks/portal.png"}); - - // Nether wart - defaultData.add(new String[] {"textures/blocks/nether_wart_stage0.png", "textures/blocks/nether_wart_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/nether_wart_stage1.png", "textures/blocks/nether_wart_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/nether_wart_stage2.png", "textures/blocks/nether_wart_stage_2.png"}); - - // Note block - defaultData.add(new String[] {"textures/blocks/note_block.png", "textures/blocks/noteblock.png"}); - - // Nautilus shell - defaultData.add(new String[] {"textures/items/nautilus_shell.png", "textures/items/nautilus.png"}); - - // Observer - defaultData.add(new String[] {"textures/blocks/observer_back_on.png", "textures/blocks/observer_back_lit.png"}); - - // Painting - defaultData.add(new String[] {"textures/painting/paintings_kristoffer_zetterstrand.png", "textures/painting/kz.png"}); // 1.13 - - // Panda - defaultData.add(new String[] {"textures/entity/panda/aggressive_panda.png", "textures/entity/panda/panda_aggressive.png"}); - defaultData.add(new String[] {"textures/entity/panda/brown_panda.png", "textures/entity/panda/panda_brown.png"}); - defaultData.add(new String[] {"textures/entity/panda/lazy_panda.png", "textures/entity/panda/panda_lazy.png"}); - defaultData.add(new String[] {"textures/entity/panda/playful_panda.png", "textures/entity/panda/panda_playful.png"}); - defaultData.add(new String[] {"textures/entity/panda/weak_panda.png", "textures/entity/panda/panda_sneezy.png"}); - defaultData.add(new String[] {"textures/entity/panda/worried_panda.png", "textures/entity/panda/panda_worried.png"}); - - // Piglin - defaultData.add(new String[] {"textures/entity/piglin/zombified_piglin.png", "textures/entity/piglin/zombie_piglin.png"}); - - // Piston - defaultData.add(new String[] {"textures/blocks/piston_top.png", "textures/blocks/piston_top_normal.png"}); - - // Planks - defaultData.add(new String[] {"textures/blocks/acacia_planks.png", "textures/blocks/planks_acacia.png"}); - defaultData.add(new String[] {"textures/blocks/birch_planks.png", "textures/blocks/planks_birch.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_planks.png", "textures/blocks/planks_big_oak.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_planks.png", "textures/blocks/planks_jungle.png"}); - defaultData.add(new String[] {"textures/blocks/oak_planks.png", "textures/blocks/planks_oak.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_planks.png", "textures/blocks/planks_spruce.png"}); - - // Podzol - defaultData.add(new String[] {"textures/blocks/podzol_side.png", "textures/blocks/dirt_podzol_side.png"}); - defaultData.add(new String[] {"textures/blocks/podzol_top.png", "textures/blocks/dirt_podzol_top.png"}); - - // Potato - defaultData.add(new String[] {"textures/blocks/potatoes_stage0.png", "textures/blocks/potatoes_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/potatoes_stage1.png", "textures/blocks/potatoes_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/potatoes_stage2.png", "textures/blocks/potatoes_stage_2.png"}); - defaultData.add(new String[] {"textures/blocks/potatoes_stage3.png", "textures/blocks/potatoes_stage_3.png"}); - defaultData.add(new String[] {"textures/items/baked_potato.png", "textures/items/potato_baked.png"}); - defaultData.add(new String[] {"textures/items/poisonous_potato.png", "textures/items/potato_poisonous.png"}); - - // Potion - defaultData.add(new String[] {"textures/items/lingering_potion.png", "textures/items/potion_bottle_lingering_empty.png"}); - defaultData.add(new String[] {"textures/items/potion.png", "textures/items/potion_bottle_empty.png"}); - defaultData.add(new String[] {"textures/items/splash_potion.png", "textures/items/potion_bottle_splash_empty.png"}); - - // Prismarine - defaultData.add(new String[] {"textures/blocks/dark_prismarine.png", "textures/blocks/prismarine_dark.png"}); - defaultData.add(new String[] {"textures/blocks/prismarine.png", "textures/blocks/prismarine_rough.png"}); - - // Pumpkin - defaultData.add(new String[] {"textures/blocks/attached_pumpkin_stem.png", "textures/blocks/pumpkin_stem_connected.png"}); - defaultData.add(new String[] {"textures/blocks/carved_pumpkin.png", "textures/blocks/pumpkin_face_off.png"}); - defaultData.add(new String[] {"textures/blocks/jack_o_lantern.png", "textures/blocks/pumpkin_face_on.png"}); - defaultData.add(new String[] {"textures/blocks/pumpkin_stem.png", "textures/blocks/pumpkin_stem_disconnected.png"}); - - // Quartz - defaultData.add(new String[] {"textures/blocks/chiseled_quartz_block.png", "textures/blocks/quartz_block_chiseled.png"}); - defaultData.add(new String[] {"textures/blocks/chiseled_quartz_block_top.png", "textures/blocks/quartz_block_chiseled_top.png"}); - defaultData.add(new String[] {"textures/blocks/nether_quartz_ore.png", "textures/blocks/quartz_ore.png"}); - defaultData.add(new String[] {"textures/blocks/quartz_pillar.png", "textures/blocks/quartz_block_lines.png"}); - defaultData.add(new String[] {"textures/blocks/quartz_pillar_top.png", "textures/blocks/quartz_block_lines_top.png"}); - - // Rabbit - defaultData.add(new String[] {"textures/entity/rabbit/black.png", "textures/entity/rabbit/blackrabbit.png"}); - defaultData.add(new String[] {"textures/items/cooked_rabbit.png", "textures/items/rabbit_cooked.png"}); - defaultData.add(new String[] {"textures/items/rabbit.png", "textures/items/rabbit_raw.png"}); - - // Rail - defaultData.add(new String[] {"textures/blocks/activator_rail.png", "textures/blocks/rail_activator.png"}); - defaultData.add(new String[] {"textures/blocks/activator_rail_on.png", "textures/blocks/rail_activator_powered.png"}); - defaultData.add(new String[] {"textures/blocks/detector_rail.png", "textures/blocks/rail_detector.png"}); - defaultData.add(new String[] {"textures/blocks/detector_rail_on.png", "textures/blocks/rail_detector_powered.png"}); - defaultData.add(new String[] {"textures/blocks/powered_rail.png", "textures/blocks/rail_golden.png"}); - defaultData.add(new String[] {"textures/blocks/powered_rail_on.png", "textures/blocks/rail_golden_powered.png"}); - defaultData.add(new String[] {"textures/blocks/rail.png", "textures/blocks/rail_normal.png"}); - defaultData.add(new String[] {"textures/blocks/rail_corner.png", "textures/blocks/rail_normal_turned.png"}); - - // Red sand - defaultData.add(new String[] {"textures/blocks/chiseled_red_sandstone.png", "textures/blocks/red_sandstone_carved.png"}); - defaultData.add(new String[] {"textures/blocks/cut_red_sandstone.png", "textures/blocks/red_sandstone_smooth.png"}); - defaultData.add(new String[] {"textures/blocks/red_sandstone.png", "textures/blocks/red_sandstone_normal.png"}); - - // Redstone - defaultData.add(new String[] {"textures/items/redstone.png", "textures/items/redstone_dust.png"}); - - // Redstone lamp - defaultData.add(new String[] {"textures/blocks/redstone_lamp.png", "textures/blocks/redstone_lamp_off.png"}); - - // Repeater - defaultData.add(new String[] {"textures/blocks/repeater.png", "textures/blocks/repeater_off.png"}); - - // Saddle - defaultData.add(new String[] {"textures/entity/pig/pig_saddle.png", "textures/entity/saddle.png"}); - - // Sand - defaultData.add(new String[] {"textures/blocks/chiseled_sandstone.png", "textures/blocks/sandstone_carved.png"}); - defaultData.add(new String[] {"textures/blocks/cut_sandstone.png", "textures/blocks/sandstone_smooth.png"}); - defaultData.add(new String[] {"textures/blocks/sandstone.png", "textures/blocks/sandstone_normal.png"}); - - // Sapling - defaultData.add(new String[] {"textures/blocks/acacia_sapling.png", "textures/blocks/sapling_acacia.png"}); - defaultData.add(new String[] {"textures/blocks/birch_sapling.png", "textures/blocks/sapling_birch.png"}); - defaultData.add(new String[] {"textures/blocks/dark_oak_sapling.png", "textures/blocks/sapling_roofed_oak.png"}); - defaultData.add(new String[] {"textures/blocks/jungle_sapling.png", "textures/blocks/sapling_jungle.png"}); - defaultData.add(new String[] {"textures/blocks/oak_sapling.png", "textures/blocks/sapling_oak.png"}); - defaultData.add(new String[] {"textures/blocks/spruce_sapling.png", "textures/blocks/sapling_spruce.png"}); - - // Sea grass - defaultData.add(new String[] {"textures/blocks/tall_seagrass_top.png", "textures/blocks/seagrass_doubletall_top_a.png"}); - defaultData.add(new String[] {"textures/blocks/tall_seagrass_bottom.png", "textures/blocks/seagrass_doubletall_bottom_a.png"}); - defaultData.add(new String[] {"textures/items/seagrass.png", "textures/blocks/seagrass_carried.png"}); - - // Seed - defaultData.add(new String[] {"textures/items/beetroot_seeds.png", "textures/items/seeds_beetroot.png"}); - defaultData.add(new String[] {"textures/items/melon_seeds.png", "textures/items/seeds_melon.png"}); - defaultData.add(new String[] {"textures/items/pumpkin_seeds.png", "textures/items/seeds_pumpkin.png"}); - defaultData.add(new String[] {"textures/items/wheat_seeds.png", "textures/items/seeds_wheat.png"}); - - // Shield - defaultData.add(new String[] {"textures/entity/shield_base_nopattern.png", "textures/entity/shield.png"}); - - // Shulker - defaultData.add(new String[] {"textures/blocks/black_shulker_box.png", "textures/blocks/shulker_top_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_shulker_box.png", "textures/blocks/shulker_top_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_shulker_box.png", "textures/blocks/shulker_top_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_shulker_box.png", "textures/blocks/shulker_top_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_shulker_box.png", "textures/blocks/shulker_top_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_shulker_box.png", "textures/blocks/shulker_top_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_shulker_box.png", "textures/blocks/shulker_top_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_shulker_box.png", "textures/blocks/shulker_top_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_shulker_box.png", "textures/blocks/shulker_top_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_shulker_box.png", "textures/blocks/shulker_top_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_shulker_box.png", "textures/blocks/shulker_top_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_shulker_box.png", "textures/blocks/shulker_top_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_shulker_box.png", "textures/blocks/shulker_top_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_shulker_box.png", "textures/blocks/shulker_top_red.png"}); - defaultData.add(new String[] {"textures/blocks/shulker_box.png", "textures/blocks/shulker_top_undyed.png"}); - defaultData.add(new String[] {"textures/blocks/white_shulker_box.png", "textures/blocks/shulker_top_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_shulker_box.png", "textures/blocks/shulker_top_yellow.png"}); - defaultData.add(new String[] {"textures/entity/shulker/shulker.png", "textures/entity/shulker/shulker_undyed.png"}); - defaultData.add(new String[] {"textures/entity/shulker/shulker_light_gray.png", "textures/entity/shulker/shulker_silver.png"}); - - // Sign - defaultData.add(new String[] {"textures/entity/signs/acacia.png", "textures/entity/sign_acacia.png"}); - defaultData.add(new String[] {"textures/entity/signs/birch.png", "textures/entity/sign_birch.png"}); - defaultData.add(new String[] {"textures/entity/signs/crimson.png", "textures/entity/sign_crimson.png"}); - defaultData.add(new String[] {"textures/entity/signs/dark_oak.png", "textures/entity/sign_darkoak.png"}); - defaultData.add(new String[] {"textures/entity/signs/jungle.png", "textures/entity/sign_jungle.png"}); - defaultData.add(new String[] {"textures/entity/signs/oak.png", "textures/entity/sign.png"}); - defaultData.add(new String[] {"textures/entity/signs/spruce.png", "textures/entity/sign_spruce.png"}); - defaultData.add(new String[] {"textures/entity/signs/warped.png", "textures/entity/sign_warped.png"}); - defaultData.add(new String[] {"textures/items/acacia_sign.png", "textures/items/sign_acacia.png"}); - defaultData.add(new String[] {"textures/items/birch_sign.png", "textures/items/sign_birch.png"}); - defaultData.add(new String[] {"textures/items/crimson_sign.png", "textures/items/sign_crimson.png"}); - defaultData.add(new String[] {"textures/items/dark_oak_sign.png", "textures/items/sign_darkoak.png"}); - defaultData.add(new String[] {"textures/items/jungle_sign.png", "textures/items/sign_jungle.png"}); - defaultData.add(new String[] {"textures/items/oak_sign.png", "textures/items/sign.png"}); - defaultData.add(new String[] {"textures/items/spruce_sign.png", "textures/items/sign_spruce.png"}); - defaultData.add(new String[] {"textures/items/warped_sign.png", "textures/items/sign_warped.png"}); - - // Slime - defaultData.add(new String[] {"textures/blocks/slime_block.png", "textures/blocks/slime.png"}); - defaultData.add(new String[] {"textures/items/slime_ball.png", "textures/items/slimeball.png"}); - - // Smooth stone - defaultData.add(new String[] {"textures/blocks/smooth_stone.png", "textures/blocks/stone_slab_top.png"}); - defaultData.add(new String[] {"textures/blocks/smooth_stone_slab_side.png", "textures/blocks/stone_slab_side.png"}); - - // Spawner - defaultData.add(new String[] {"textures/blocks/spawner.png", "textures/blocks/mob_spawner.png"}); - - // Spider - defaultData.add(new String[] {"textures/items/fermented_spider_eye.png", "textures/items/spider_eye_fermented.png"}); - - // Sponge - defaultData.add(new String[] {"textures/blocks/wet_sponge.png", "textures/blocks/sponge_wet.png"}); - - // Stone brick - defaultData.add(new String[] {"textures/blocks/chiseled_stone_bricks.png", "textures/blocks/stonebrick_carved.png"}); - defaultData.add(new String[] {"textures/blocks/cracked_stone_bricks.png", "textures/blocks/stonebrick_cracked.png"}); - defaultData.add(new String[] {"textures/blocks/mossy_stone_bricks.png", "textures/blocks/stonebrick_mossy.png"}); - defaultData.add(new String[] {"textures/blocks/stone_bricks.png", "textures/blocks/stonebrick.png"}); - - // Stone cutter - defaultData.add(new String[] {"textures/blocks/stonecutter_bottom.png", "textures/blocks/stonecutter2_bottom.png"}); - defaultData.add(new String[] {"textures/blocks/stonecutter_saw.png", "textures/blocks/stonecutter2_saw.png"}); - defaultData.add(new String[] {"textures/blocks/stonecutter_side.png", "textures/blocks/stonecutter2_side.png"}); - defaultData.add(new String[] {"textures/blocks/stonecutter_top.png", "textures/blocks/stonecutter2_top.png"}); - - // Strider - defaultData.add(new String[] {"textures/entity/strider/strider_cold.png", "textures/entity/strider/strider_suffocated.png"}); - - // Structure - defaultData.add(new String[] {"textures/items/structure_void.png", "textures/blocks/structure_void.png"}); - - // Sugar cane - defaultData.add(new String[] {"textures/blocks/sugar_cane.png", "textures/blocks/reeds.png"}); - defaultData.add(new String[] {"textures/items/sugar_cane.png", "textures/items/reeds.png"}); - - // Terracotta - defaultData.add(new String[] {"textures/blocks/black_terracotta.png", "textures/blocks/hardened_clay_stained_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_terracotta.png", "textures/blocks/hardened_clay_stained_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_terracotta.png", "textures/blocks/hardened_clay_stained_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_terracotta.png", "textures/blocks/hardened_clay_stained_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_terracotta.png", "textures/blocks/hardened_clay_stained_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_terracotta.png", "textures/blocks/hardened_clay_stained_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_terracotta.png", "textures/blocks/hardened_clay_stained_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_terracotta.png", "textures/blocks/hardened_clay_stained_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_terracotta.png", "textures/blocks/hardened_clay_stained_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_terracotta.png", "textures/blocks/hardened_clay_stained_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_terracotta.png", "textures/blocks/hardened_clay_stained_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_terracotta.png", "textures/blocks/hardened_clay_stained_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_terracotta.png", "textures/blocks/hardened_clay_stained_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_terracotta.png", "textures/blocks/hardened_clay_stained_red.png"}); - defaultData.add(new String[] {"textures/blocks/terracotta.png", "textures/blocks/hardened_clay.png"}); - defaultData.add(new String[] {"textures/blocks/white_terracotta.png", "textures/blocks/hardened_clay_stained_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_terracotta.png", "textures/blocks/hardened_clay_stained_yellow.png"}); - - // Torch - defaultData.add(new String[] {"textures/blocks/redstone_torch.png", "textures/blocks/redstone_torch_on.png"}); - defaultData.add(new String[] {"textures/blocks/torch.png", "textures/blocks/torch_on.png"}); - - // Totem of undying - defaultData.add(new String[] {"textures/items/totem_of_undying.png", "textures/items/totem.png"}); - - // Trapdoor - defaultData.add(new String[] {"textures/blocks/crimson_trapdoor.png", "textures/blocks/huge_fungus/crimson_trapdoor.png"}); - defaultData.add(new String[] {"textures/blocks/oak_trapdoor.png", "textures/blocks/trapdoor.png"}); - defaultData.add(new String[] {"textures/blocks/warped_trapdoor.png", "textures/blocks/huge_fungus/warped_trapdoor.png"}); - - // Tripwire - defaultData.add(new String[] {"textures/blocks/tripwire.png", "textures/blocks/trip_wire.png"}); - defaultData.add(new String[] {"textures/blocks/tripwire_hook.png", "textures/blocks/trip_wire_source.png"}); - - // Turtle - defaultData.add(new String[] {"textures/blocks/turtle_egg.png", "textures/blocks/turtle_egg_not_cracked.png"}); - defaultData.add(new String[] {"textures/entity/turtle/big_sea_turtle.png", "textures/entity/sea_turtle.png"}); - defaultData.add(new String[] {"textures/items/scute.png", "textures/items/turtle_shell_piece.png"}); - - // UI - defaultData.add(new String[] {"textures/gui/options_background.png", "textures/ui/background.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_0.png", "textures/ui/panorama_0.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_1.png", "textures/ui/panorama_1.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_2.png", "textures/ui/panorama_2.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_3.png", "textures/ui/panorama_3.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_4.png", "textures/ui/panorama_4.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_5.png", "textures/ui/panorama_5.png"}); - defaultData.add(new String[] {"textures/gui/title/background/panorama_overlay.png", "textures/ui/panorama_overlay.png"}); - - // Villager - defaultData.add(new String[] {"textures/entity/villager/", "textures/entity/villager2/"}); - defaultData.add(new String[] {"textures/entity/villager2/profession/", "textures/entity/villager2/professions/"}); - defaultData.add(new String[] {"textures/entity/villager2/profession_level/", "textures/entity/villager2/levels/"}); - defaultData.add(new String[] {"textures/entity/villager2/type/", "textures/entity/villager2/biomes/"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/desert.png", "textures/entity/villager2/biomes/biome_desert.png"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/jungle.png", "textures/entity/villager2/biomes/biome_jungle.png"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/plains.png", "textures/entity/villager2/biomes/biome_plains.png"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/savanna.png", "textures/entity/villager2/biomes/biome_savanna.png"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/snow.png", "textures/entity/villager2/biomes/biome_snow.png"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/swamp.png", "textures/entity/villager2/biomes/biome_swamp.png"}); - defaultData.add(new String[] {"textures/entity/villager2/biomes/taiga.png", "textures/entity/villager2/biomes/biome_taiga.png"}); - defaultData.add(new String[] {"textures/entity/villager2/levels/diamond.png", "textures/entity/villager2/levels/level_diamond.png"}); - defaultData.add(new String[] {"textures/entity/villager2/levels/emerald.png", "textures/entity/villager2/levels/level_emerald.png"}); - defaultData.add(new String[] {"textures/entity/villager2/levels/gold.png", "textures/entity/villager2/levels/level_gold.png"}); - defaultData.add(new String[] {"textures/entity/villager2/levels/iron.png", "textures/entity/villager2/levels/level_iron.png"}); - defaultData.add(new String[] {"textures/entity/villager2/levels/stone.png", "textures/entity/villager2/levels/level_stone.png"}); - defaultData.add(new String[] {"textures/entity/villager2/professions/mason.png", "textures/entity/villager2/professions/stonemason.png"}); - - // Vine - defaultData.add(new Object[] {"textures/blocks/twisting_vines.png", "textures/blocks/twisting_vines_bottom.png"}); - defaultData.add(new Object[] {"textures/blocks/twisting_vines_plant.png", "textures/blocks/twisting_vines_base.png"}); - defaultData.add(new Object[] {"textures/blocks/weeping_vines.png", "textures/blocks/weeping_vines_bottom.png"}); - defaultData.add(new Object[] {"textures/blocks/weeping_vines_plant.png", "textures/blocks/weeping_vines_base.png"}); - - // Warped - defaultData.add(new Object[] {"textures/blocks/stripped_warped_stem.png", "textures/blocks/huge_fungus/stripped_warped_stem_side.png"}); - defaultData.add(new Object[] {"textures/blocks/stripped_warped_stem_top.png", "textures/blocks/huge_fungus/stripped_warped_stem_top.png"}); - defaultData.add(new Object[] {"textures/blocks/warped_nylium.png", "textures/blocks/warped_nylium_top.png"}); - defaultData.add(new Object[] {"textures/blocks/warped_planks.png", "textures/blocks/huge_fungus/warped_planks.png"}); - defaultData.add(new Object[] {"textures/blocks/warped_stem.png", "textures/blocks/huge_fungus/warped_stem_side.png"}); - defaultData.add(new Object[] {"textures/blocks/warped_stem_top.png", "textures/blocks/huge_fungus/warped_stem_top.png"}); - - // Water - defaultData.add(new String[] {"textures/blocks/water_flow.png", "textures/blocks/water_flow_grey.png"}); - defaultData.add(new String[] {"textures/blocks/water_still.png", "textures/blocks/water_still_grey.png"}); - - // Wheat - defaultData.add(new String[] {"textures/blocks/wheat_stage0.png", "textures/blocks/wheat_stage_0.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage1.png", "textures/blocks/wheat_stage_1.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage2.png", "textures/blocks/wheat_stage_2.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage3.png", "textures/blocks/wheat_stage_3.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage4.png", "textures/blocks/wheat_stage_4.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage5.png", "textures/blocks/wheat_stage_5.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage6.png", "textures/blocks/wheat_stage_6.png"}); - defaultData.add(new String[] {"textures/blocks/wheat_stage7.png", "textures/blocks/wheat_stage_7.png"}); - - // Wither - defaultData.add(new String[] {"textures/entity/wither/", "textures/entity/wither_boss/"}); - defaultData.add(new String[] {"textures/entity/wither_boss/wither_armor.png", "textures/entity/wither_boss/wither_armor_white.png"}); - - // Wool - defaultData.add(new String[] {"textures/blocks/black_wool.png", "textures/blocks/wool_colored_black.png"}); - defaultData.add(new String[] {"textures/blocks/blue_wool.png", "textures/blocks/wool_colored_blue.png"}); - defaultData.add(new String[] {"textures/blocks/brown_wool.png", "textures/blocks/wool_colored_brown.png"}); - defaultData.add(new String[] {"textures/blocks/cyan_wool.png", "textures/blocks/wool_colored_cyan.png"}); - defaultData.add(new String[] {"textures/blocks/gray_wool.png", "textures/blocks/wool_colored_gray.png"}); - defaultData.add(new String[] {"textures/blocks/green_wool.png", "textures/blocks/wool_colored_green.png"}); - defaultData.add(new String[] {"textures/blocks/light_blue_wool.png", "textures/blocks/wool_colored_light_blue.png"}); - defaultData.add(new String[] {"textures/blocks/light_gray_wool.png", "textures/blocks/wool_colored_silver.png"}); - defaultData.add(new String[] {"textures/blocks/lime_wool.png", "textures/blocks/wool_colored_lime.png"}); - defaultData.add(new String[] {"textures/blocks/magenta_wool.png", "textures/blocks/wool_colored_magenta.png"}); - defaultData.add(new String[] {"textures/blocks/orange_wool.png", "textures/blocks/wool_colored_orange.png"}); - defaultData.add(new String[] {"textures/blocks/pink_wool.png", "textures/blocks/wool_colored_pink.png"}); - defaultData.add(new String[] {"textures/blocks/purple_wool.png", "textures/blocks/wool_colored_purple.png"}); - defaultData.add(new String[] {"textures/blocks/red_wool.png", "textures/blocks/wool_colored_red.png"}); - defaultData.add(new String[] {"textures/blocks/white_wool.png", "textures/blocks/wool_colored_white.png"}); - defaultData.add(new String[] {"textures/blocks/yellow_wool.png", "textures/blocks/wool_colored_yellow.png"}); - - // Zombie - defaultData.add(new String[] {"textures/entity/zombie_pigman.png", "textures/entity/pig/pigzombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager/", "textures/entity/zombie_villager2/"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/profession/", "textures/entity/zombie_villager2/professions/"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/profession_level/", "textures/entity/zombie_villager2/levels/"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/type/", "textures/entity/zombie_villager2/biomes/"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/zombie_villager.png", "textures/entity/zombie_villager2/zombie-villager.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/desert.png", "textures/entity/zombie_villager2/biomes/biome-desert-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/jungle.png", "textures/entity/zombie_villager2/biomes/biome-jungle-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/plains.png", "textures/entity/zombie_villager2/biomes/biome-plains-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/savanna.png", "textures/entity/zombie_villager2/biomes/biome-savanna-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/snow.png", "textures/entity/zombie_villager2/biomes/biome-snow-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/swamp.png", "textures/entity/zombie_villager2/biomes/biome-swamp-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/biomes/taiga.png", "textures/entity/zombie_villager2/biomes/biome-taiga-zombie.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/levels/diamond.png", "textures/entity/zombie_villager2/levels/level_diamond.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/levels/emerald.png", "textures/entity/zombie_villager2/levels/level_emerald.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/levels/gold.png", "textures/entity/zombie_villager2/levels/level_gold.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/levels/iron.png", "textures/entity/zombie_villager2/levels/level_iron.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/levels/stone.png", "textures/entity/zombie_villager2/levels/level_stone.png"}); - defaultData.add(new String[] {"textures/entity/zombie_villager2/professions/mason.png", "textures/entity/zombie_villager2/professions/stonemason.png"}); - } - - public RenameConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - Path fromPath = storage.resolve(from); - - if (!fromPath.toFile().exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Rename %s to %s", from, to)); - - Files.move(fromPath, storage.resolve(to)); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/SideRotateConverter.java b/legacy/SideRotateConverter.java deleted file mode 100644 index 2e397e6..0000000 --- a/legacy/SideRotateConverter.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -import javax.imageio.ImageIO; -import java.awt.image.BufferedImage; -import java.io.File; -import java.io.IOException; -import java.nio.file.Path; -import java.util.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class SideRotateConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/blocks/dried_kelp_side_a.png", "textures/blocks/dried_kelp_side_b.png"}); - defaultData.add(new Object[] {"textures/blocks/seagrass_doubletall_top_a.png", "textures/blocks/seagrass_doubletall_top_b.png"}); - defaultData.add(new Object[] {"textures/blocks/seagrass_doubletall_bottom_a.png", "textures/blocks/seagrass_doubletall_bottom_b.png"}); - } - - public SideRotateConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Create side rotate %s", from)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - fromImage = ImageUtils.flip(fromImage, true, false); - - ImageUtils.write(fromImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/SpriteConverter.java b/legacy/SpriteConverter.java deleted file mode 100644 index 7d424cb..0000000 --- a/legacy/SpriteConverter.java +++ /dev/null @@ -1,354 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class SpriteConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - // Banner pattern - defaultData.add(new Object[] {512, 512, new Object[] { - new Object[] {"textures/entity/banner_base.png", 0, 0, 64}, - new Object[] {"textures/entity/banner/border.png", 64, 0, 64}, - new Object[] {"textures/entity/banner/bricks.png", 128, 0, 64}, - new Object[] {"textures/entity/banner/circle.png", 192, 0, 64}, - new Object[] {"textures/entity/banner/creeper.png", 256, 0, 64}, - new Object[] {"textures/entity/banner/cross.png", 320, 0, 64}, - new Object[] {"textures/entity/banner/curly_border.png", 384, 0, 64}, - new Object[] {"textures/entity/banner/diagonal_left.png", 448, 0, 64}, - new Object[] {"textures/entity/banner/diagonal_right.png", 0, 64, 64}, - new Object[] {"textures/entity/banner/diagonal_up_left.png", 64, 64, 64}, - new Object[] {"textures/entity/banner/diagonal_up_right.png", 128, 64, 64}, - new Object[] {"textures/entity/banner/flower.png", 192, 64, 64}, - new Object[] {"textures/entity/banner/gradient.png", 256, 64, 64}, - new Object[] {"textures/entity/banner/gradient_up.png", 320, 64, 64}, - new Object[] {"textures/entity/banner/half_horizontal.png", 384, 64, 64}, - new Object[] {"textures/entity/banner/half_horizontal_bottom.png", 448, 64, 64}, - new Object[] {"textures/entity/banner/half_vertical.png", 0, 128, 64}, - new Object[] {"textures/entity/banner/half_vertical_right.png", 64, 128, 64}, - new Object[] {"textures/entity/banner/mojang.png", 128, 128, 64}, - new Object[] {"textures/entity/banner/rhombus.png", 192, 128, 64}, - new Object[] {"textures/entity/banner/skull.png", 256, 128, 64}, - new Object[] {"textures/entity/banner/small_stripes.png", 320, 128, 64}, - new Object[] {"textures/entity/banner/square_bottom_left.png", 384, 128, 64}, - new Object[] {"textures/entity/banner/square_bottom_right.png", 448, 128, 64}, - new Object[] {"textures/entity/banner/square_top_left.png", 0, 192, 64}, - new Object[] {"textures/entity/banner/square_top_right.png", 64, 192, 64}, - new Object[] {"textures/entity/banner/straight_cross.png", 128, 192, 64}, - new Object[] {"textures/entity/banner/stripe_bottom.png", 192, 192, 64}, - new Object[] {"textures/entity/banner/stripe_center.png", 256, 192, 64}, - new Object[] {"textures/entity/banner/stripe_downleft.png", 320, 192, 64}, - new Object[] {"textures/entity/banner/stripe_downright.png", 384, 192, 64}, - new Object[] {"textures/entity/banner/stripe_left.png", 448, 192, 64}, - new Object[] {"textures/entity/banner/stripe_middle.png", 0, 256, 64}, - new Object[] {"textures/entity/banner/stripe_right.png", 64, 256, 64}, - new Object[] {"textures/entity/banner/stripe_top.png", 128, 256, 64}, - new Object[] {"textures/entity/banner/triangle_bottom.png", 192, 256, 64}, - new Object[] {"textures/entity/banner/triangle_top.png", 256, 256, 64}, - new Object[] {"textures/entity/banner/triangles_bottom.png", 320, 256, 64}, - new Object[] {"textures/entity/banner/triangles_top.png", 384, 256, 64} - }, "textures/entity/banner/banner.png"}); - - // Painting - defaultData.add(new Object[] {256, 256, new Object[] { - new Object[] {"textures/painting/kebab.png", 0, 0, 16}, - new Object[] {"textures/painting/aztec.png", 16, 0, 16}, - new Object[] {"textures/painting/alban.png", 32, 0, 16}, - new Object[] {"textures/painting/bomb.png", 64, 0, 16}, - new Object[] {"textures/painting/aztec2.png", 48, 0, 16}, - new Object[] {"textures/painting/plant.png", 80, 0, 16}, - new Object[] {"textures/painting/wasteland.png", 96, 0, 16}, - new Object[] {"textures/painting/back.png", 192, 0, 16}, - new Object[] {"textures/painting/back.png", 208, 0, 16}, - new Object[] {"textures/painting/back.png", 224, 0, 16}, - new Object[] {"textures/painting/back.png", 240, 0, 16}, - new Object[] {"textures/painting/back.png", 192, 16, 16}, - new Object[] {"textures/painting/back.png", 208, 16, 16}, - new Object[] {"textures/painting/back.png", 224, 16, 16}, - new Object[] {"textures/painting/back.png", 240, 16, 16}, - new Object[] {"textures/painting/back.png", 192, 32, 16}, - new Object[] {"textures/painting/back.png", 208, 32, 16}, - new Object[] {"textures/painting/back.png", 224, 32, 16}, - new Object[] {"textures/painting/back.png", 240, 32, 16}, - new Object[] {"textures/painting/back.png", 192, 48, 16}, - new Object[] {"textures/painting/back.png", 208, 48, 16}, - new Object[] {"textures/painting/back.png", 224, 48, 16}, - new Object[] {"textures/painting/back.png", 240, 48, 16}, - new Object[] {"textures/painting/pool.png", 0, 32, 32}, - new Object[] {"textures/painting/courbet.png", 32, 32, 32}, - new Object[] {"textures/painting/sea.png", 64, 32, 32}, - new Object[] {"textures/painting/sunset.png", 96, 32, 32}, - new Object[] {"textures/painting/creebet.png", 128, 32, 32}, - new Object[] {"textures/painting/wanderer.png", 0, 64, 16}, - new Object[] {"textures/painting/graham.png", 16, 64, 16}, - new Object[] {"textures/painting/fighters.png", 0, 96, 64}, - new Object[] {"textures/painting/skeleton.png", 192, 64, 64}, - new Object[] {"textures/painting/donkey_kong.png", 192, 112, 64}, - new Object[] {"textures/painting/match.png", 0, 128, 32}, - new Object[] {"textures/painting/bust.png", 32, 128, 32}, - new Object[] {"textures/painting/stage.png", 64, 128, 32}, - new Object[] {"textures/painting/void.png", 96, 128, 32}, - new Object[] {"textures/painting/skull_and_roses.png", 128, 128, 32}, - new Object[] {"textures/painting/wither.png", 160, 128, 32}, - new Object[] {"textures/painting/pointer.png", 0, 192, 64}, - new Object[] {"textures/painting/pigscene.png", 64, 192, 64}, - new Object[] {"textures/painting/burning_skull.png", 128, 192, 64} - }, "textures/painting/kz.png"}); - - // Particles - defaultData.add(new Object[] {128, 128, new Object[] { - new Object[] {"textures/particle/generic_0.png", 0, 0, 8}, - new Object[] {"textures/particle/generic_1.png", 8, 0, 8}, - new Object[] {"textures/particle/generic_2.png", 16, 0, 8}, - new Object[] {"textures/particle/generic_3.png", 24, 0, 8}, - new Object[] {"textures/particle/generic_4.png", 32, 0, 8}, - new Object[] {"textures/particle/generic_5.png", 40, 0, 8}, - new Object[] {"textures/particle/generic_6.png", 48, 0, 8}, - new Object[] {"textures/particle/generic_7.png", 56, 0, 8}, - new Object[] {"textures/particle/splash_0.png", 0, 8, 8}, - new Object[] {"textures/particle/splash_0.png", 24, 8, 8}, - new Object[] {"textures/particle/splash_1.png", 32, 8, 8}, - new Object[] {"textures/particle/splash_2.png", 40, 8, 8}, - new Object[] {"textures/particle/splash_3.png", 48, 8, 8}, - new Object[] {"textures/particle/bubble.png", 0, 16, 8}, - new Object[] {"textures/particle/flame.png", 0, 24, 8}, - new Object[] {"textures/particle/lava.png", 8, 24, 8}, - new Object[] {"textures/particle/soul_fire_flame.png", 16, 24, 8}, - new Object[] {"textures/particle/note.png", 0, 32, 8}, - new Object[] {"textures/particle/critical_hit.png", 8, 32, 8}, - new Object[] {"textures/particle/enchanted_hit.png", 16, 32, 8}, - new Object[] {"textures/particle/heart.png", 0, 40, 8}, - new Object[] {"textures/particle/angry.png", 8, 40, 8}, - new Object[] {"textures/particle/glint.png", 16, 40, 8}, - new Object[] {"textures/particle/flash.png", 32, 16, 32}, - new Object[] {"textures/particle/drip_hang.png", 0, 56, 8}, - new Object[] {"textures/particle/drip_fall.png", 8, 56, 8}, - new Object[] {"textures/particle/drip_land.png", 16, 58, 8}, - new Object[] {"textures/particle/effect_0.png", 0, 64, 8}, - new Object[] {"textures/particle/effect_1.png", 8, 64, 8}, - new Object[] {"textures/particle/effect_2.png", 16, 64, 8}, - new Object[] {"textures/particle/effect_3.png", 24, 64, 8}, - new Object[] {"textures/particle/effect_4.png", 32, 64, 8}, - new Object[] {"textures/particle/effect_5.png", 40, 64, 8}, - new Object[] {"textures/particle/effect_6.png", 48, 64, 8}, - new Object[] {"textures/particle/effect_7.png", 56, 64, 8}, - new Object[] {"textures/particle/spell_0.png", 0, 72, 8}, - new Object[] {"textures/particle/spell_1.png", 8, 72, 8}, - new Object[] {"textures/particle/spell_2.png", 16, 72, 8}, - new Object[] {"textures/particle/spell_3.png", 24, 72, 8}, - new Object[] {"textures/particle/spell_4.png", 32, 72, 8}, - new Object[] {"textures/particle/spell_5.png", 40, 72, 8}, - new Object[] {"textures/particle/spell_6.png", 48, 72, 8}, - new Object[] {"textures/particle/spell_7.png", 56, 72, 8}, - new Object[] {"textures/particle/explosion_0.png", 0, 80, 8}, - new Object[] {"textures/particle/explosion_1.png", 8, 80, 8}, - new Object[] {"textures/particle/explosion_2.png", 16, 80, 8}, - new Object[] {"textures/particle/explosion_3.png", 24, 80, 8}, - new Object[] {"textures/particle/explosion_4.png", 32, 80, 8}, - new Object[] {"textures/particle/explosion_5.png", 40, 80, 8}, - new Object[] {"textures/particle/explosion_6.png", 48, 80, 8}, - new Object[] {"textures/particle/explosion_7.png", 56, 80, 8}, - new Object[] {"textures/particle/explosion_8.png", 64, 80, 8}, - new Object[] {"textures/particle/explosion_9.png", 72, 80, 8}, - new Object[] {"textures/particle/explosion_10.png", 80, 80, 8}, - new Object[] {"textures/particle/explosion_11.png", 88, 80, 8}, - new Object[] {"textures/particle/explosion_12.png", 96, 80, 8}, - new Object[] {"textures/particle/explosion_13.png", 104, 80, 8}, - new Object[] {"textures/particle/explosion_14.png", 112, 80, 8}, - new Object[] {"textures/particle/explosion_15.png", 120, 80, 8}, - new Object[] {"textures/particle/glitter_0.png", 0, 88, 8}, - new Object[] {"textures/particle/glitter_1.png", 8, 88, 8}, - new Object[] {"textures/particle/glitter_2.png", 16, 88, 8}, - new Object[] {"textures/particle/glitter_3.png", 24, 88, 8}, - new Object[] {"textures/particle/glitter_4.png", 32, 88, 8}, - new Object[] {"textures/particle/glitter_5.png", 40, 88, 8}, - new Object[] {"textures/particle/glitter_6.png", 48, 88, 8}, - new Object[] {"textures/particle/glitter_7.png", 56, 88, 8}, - new Object[] {"textures/particle/spark_0.png", 0, 96, 8}, - new Object[] {"textures/particle/spark_1.png", 8, 96, 8}, - new Object[] {"textures/particle/spark_2.png", 16, 96, 8}, - new Object[] {"textures/particle/spark_3.png", 24, 96, 8}, - new Object[] {"textures/particle/spark_4.png", 32, 96, 8}, - new Object[] {"textures/particle/spark_5.png", 40, 96, 8}, - new Object[] {"textures/particle/spark_6.png", 48, 96, 8}, - new Object[] {"textures/particle/spark_7.png", 56, 96, 8}, - new Object[] {"textures/particle/sga_a.png", 8, 112, 8}, - new Object[] {"textures/particle/sga_b.png", 16, 112, 8}, - new Object[] {"textures/particle/sga_c.png", 24, 112, 8}, - new Object[] {"textures/particle/sga_d.png", 32, 112, 8}, - new Object[] {"textures/particle/sga_e.png", 40, 112, 8}, - new Object[] {"textures/particle/sga_f.png", 48, 112, 8}, - new Object[] {"textures/particle/sga_g.png", 56, 112, 8}, - new Object[] {"textures/particle/sga_h.png", 64, 112, 8}, - new Object[] {"textures/particle/sga_i.png", 72, 112, 8}, - new Object[] {"textures/particle/sga_j.png", 80, 112, 8}, - new Object[] {"textures/particle/sga_k.png", 88, 112, 8}, - new Object[] {"textures/particle/sga_l.png", 96, 112, 8}, - new Object[] {"textures/particle/sga_m.png", 104, 112, 8}, - new Object[] {"textures/particle/sga_n.png", 112, 112, 8}, - new Object[] {"textures/particle/sga_o.png", 120, 112, 8}, - new Object[] {"textures/particle/sga_p.png", 0, 120, 8}, - new Object[] {"textures/particle/sga_q.png", 8, 120, 8}, - new Object[] {"textures/particle/sga_r.png", 16, 120, 8}, - new Object[] {"textures/particle/sga_s.png", 24, 120, 8}, - new Object[] {"textures/particle/sga_t.png", 32, 120, 8}, - new Object[] {"textures/particle/sga_u.png", 40, 120, 8}, - new Object[] {"textures/particle/sga_v.png", 48, 120, 8}, - new Object[] {"textures/particle/sga_w.png", 56, 120, 8}, - new Object[] {"textures/particle/sga_x.png", 64, 120, 8}, - new Object[] {"textures/particle/sga_y.png", 72, 120, 8}, - new Object[] {"textures/particle/sga_z.png", 80, 120, 8} - }, "textures/particle/particles.png", 4 /* Needs a minimal 4x factor because the explosion images are bigger than the others */}); - - // 1.14 - defaultData.add(new Object[] {16, 192, new Object[] { - new Object[] {"textures/particle/big_smoke_0.png", 0, 0, 16}, - new Object[] {"textures/particle/big_smoke_1.png", 0, 16, 16}, - new Object[] {"textures/particle/big_smoke_2.png", 0, 32, 16}, - new Object[] {"textures/particle/big_smoke_3.png", 0, 48, 16}, - new Object[] {"textures/particle/big_smoke_4.png", 0, 64, 16}, - new Object[] {"textures/particle/big_smoke_5.png", 0, 80, 16}, - new Object[] {"textures/particle/big_smoke_6.png", 0, 96, 16}, - new Object[] {"textures/particle/big_smoke_7.png", 0, 112, 16}, - new Object[] {"textures/particle/big_smoke_8.png", 0, 128, 16}, - new Object[] {"textures/particle/big_smoke_9.png", 0, 144, 16}, - new Object[] {"textures/particle/big_smoke_10.png", 0, 160, 16}, - new Object[] {"textures/particle/big_smoke_11.png", 0, 176, 16} - }, "textures/particle/campfire_smoke.png"}); - defaultData.add(new Object[] {16, 176, new Object[]{ - new Object[]{"textures/particle/soul_0.png", 0, 0, 16}, - new Object[]{"textures/particle/soul_1.png", 0, 16, 16}, - new Object[]{"textures/particle/soul_2.png", 0, 32, 16}, - new Object[]{"textures/particle/soul_3.png", 0, 48, 16}, - new Object[]{"textures/particle/soul_4.png", 0, 64, 16}, - new Object[]{"textures/particle/soul_5.png", 0, 80, 16}, - new Object[]{"textures/particle/soul_6.png", 0, 96, 16}, - new Object[]{"textures/particle/soul_7.png", 0, 112, 16}, - new Object[]{"textures/particle/soul_8.png", 0, 128, 16}, - new Object[]{"textures/particle/soul_9.png", 0, 144, 16}, - new Object[]{"textures/particle/soul_10.png", 0, 160, 16}, - }, "textures/particle/soul.png"}); - } - - public SpriteConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - List delete = new ArrayList<>(); - - try { - int width = (int) context.data()[0]; - int height = (int) context.data()[1]; - Object[] sprites = (Object[]) context.data()[2]; - String to = (String) context.data()[3]; - int additional_factor = context.data().length > 4 ? (int) context.data()[4] : 1; - - File toFile = storage.resolve(to).toFile(); - - BufferedImage newImage = null; - int factor = 0; - List missingSprites = new ArrayList<>(); - - if (toFile.exists()) { - context.log(String.format("Convert sprite %s", to)); - - newImage = ImageIO.read(toFile); // Load already exists sprites image - Some texture packs have may a mix with sprites (1.13) and separate images (1.14) - - factor = (newImage.getWidth() / width); - } - - for (Object sprite : sprites) { - Object[] spriteArr = (Object[]) sprite; - String spritePath = (String) spriteArr[0]; - int x = (int) spriteArr[1]; - int y = (int) spriteArr[2]; - int factorDetect = (int) spriteArr[3]; - - File spriteFile = storage.resolve(spritePath).toFile(); - - if (!spriteFile.exists()) { - missingSprites.add(spritePath); - continue; - } - - BufferedImage imageSprite = ImageIO.read(spriteFile); - - if (factor == 0) { - factor = (imageSprite.getWidth() / factorDetect * additional_factor); // Take the factor of the first image - } - - if (newImage == null) { - context.log(String.format("Create sprite %s", to)); - - newImage = new BufferedImage((width * factor), (height * factor), BufferedImage.TYPE_INT_ARGB); - } - - BufferedImage imageSpritedScaled = ImageUtils.scale(imageSprite, ((factorDetect * factor) / imageSprite.getWidth())); - - Graphics g = newImage.getGraphics(); - - g.setColor(new Color(Color.TRANSLUCENT, true)); - g.fillRect((x * factor), (y * factor), imageSpritedScaled.getWidth(), imageSpritedScaled.getHeight()); // Delete previous area, if the sprite already exists - - g.drawImage(imageSpritedScaled, (x * factor), (y * factor), null); - - delete.add(new DeleteConverter(packConverter, storage, new Object[] {spritePath})); - } - - if (newImage != null) { - for (String sprite : missingSprites) { - context.log(String.format("Missing texture %s - May used a transparent image", sprite)); - } - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } - } catch (IOException e) { } - - return delete; - } -} diff --git a/legacy/TitleConverter.java b/legacy/TitleConverter.java deleted file mode 100644 index a3fe0c6..0000000 --- a/legacy/TitleConverter.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class TitleConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/gui/title/minecraft.png", "textures/ui/title.png"}); - } - - public TitleConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert title %s", from)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - int factor = fromImage.getWidth() / 255; - - BufferedImage newImage = new BufferedImage((273 * factor), (45 * factor), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - g.drawImage(ImageUtils.crop(fromImage, 0, 0, (155 * factor), (45 * factor)), 0, 0, null); - g.drawImage(ImageUtils.crop(fromImage, 0, (45 * factor), (119 * factor), (45 * factor)), (154 * factor), 0, null); - - newImage = ImageUtils.ensureMinHeight(newImage, 360); - - ImageUtils.write(newImage, "png", storage.resolve(to).toFile()); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/TurtleConverter.java b/legacy/TurtleConverter.java deleted file mode 100644 index 8670b79..0000000 --- a/legacy/TurtleConverter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters; - -import com.google.auto.service.AutoService; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.utils.ImageUtils; -import org.jetbrains.annotations.NotNull; - -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.ArrayList; -import java.util.List; - -@AutoService(Converter.class) -public class TurtleConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new Object[] {"textures/entity/sea_turtle.png"}); - } - - public TurtleConverter(PackConverter packConverter, Path storage, Object[] data) { - super(packConverter, storage, data); - } - - @Override - public List convert(@NotNull PackConversionContext context) { - try { - String from = (String) context.data()[0]; - - File fromFile = storage.resolve(from).toFile(); - - if (!fromFile.exists()) { - return new ArrayList<>(); - } - - context.log(String.format("Convert turtle %s", from)); - - BufferedImage fromImage = ImageIO.read(fromFile); - - int factor = fromImage.getWidth() / 128; - - BufferedImage newImage = new BufferedImage(fromImage.getWidth(), fromImage.getHeight(), BufferedImage.TYPE_INT_ARGB); - Graphics g = newImage.getGraphics(); - - g.drawImage(ImageUtils.crop(fromImage, factor, 0, (fromImage.getWidth() - factor), fromImage.getHeight()), 0, 0, null); - - ImageUtils.write(newImage, "png", fromFile); - } catch (IOException e) { } - - return new ArrayList<>(); - } -} diff --git a/legacy/custom/CustomModelDataConverter.java b/legacy/custom/CustomModelDataConverter.java deleted file mode 100644 index 0109ac5..0000000 --- a/legacy/custom/CustomModelDataConverter.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.packconverter.converters.custom; - -import com.fasterxml.jackson.core.util.DefaultPrettyPrinter; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; -import it.unimi.dsi.fastutil.ints.Int2ObjectMap; -import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; -import lombok.Getter; -import org.geysermc.packconverter.PackConversionContext; -import org.geysermc.packconverter.PackConverter; -import org.geysermc.packconverter.converters.AbstractConverter; -import org.geysermc.packconverter.utils.CustomModelDataHandler; -import org.jetbrains.annotations.NotNull; - -import java.io.File; -import java.io.FileInputStream; -import java.io.InputStream; -import java.io.OutputStream; -import java.nio.file.Files; -import java.nio.file.StandardOpenOption; -import java.util.ArrayList; -import java.util.List; - -// @AutoService(Converter.class) -public class CustomModelDataConverter extends AbstractConverter { - - @Getter - public static final List defaultData = new ArrayList<>(); - - static { - defaultData.add(new String[] {"assets/minecraft/models/item", "textures/item_texture.json"}); - } - - @Override - public void convert(@NotNull PackConversionContext context) { - context.log("Checking for custom model data"); - try { - PackConverter packConverter = context.packConverter(); - - String from = (String) context.data()[0]; - String to = (String) context.data()[1]; - - ObjectMapper mapper = new ObjectMapper(); - - // Create the texture_data file that will map all textures - ObjectNode textureData = mapper.createObjectNode(); - textureData.put("resource_pack_name", "geysercmd"); - textureData.put("texture_name", "atlas.items"); - ObjectNode allTextures = mapper.createObjectNode(); - for (File file : context.storage().resolve(from).toFile().listFiles()) { - InputStream stream = new FileInputStream(file); - - JsonNode node = mapper.readTree(stream); - if (node.has("overrides")) { - for (JsonNode override : node.get("overrides")) { - JsonNode predicate = override.get("predicate"); - // This is where the custom model data happens - each one is registered here under "predicate" - if (predicate.has("custom_model_data")) { - // The "ID" of the CustomModelData. If the ID is 1, then to get the custom model data - // You need to run in Java `/give @s stick{CustomModelData:1}` - int id = predicate.get("custom_model_data").asInt(); - // Get the identifier that we'll register the item with on Bedrock, and create the JSON file - String identifier = CustomModelDataHandler.handleItemData(mapper, context.storage(), override.get("model").asText()); - // See if we have registered the vanilla item already - Int2ObjectMap data = packConverter.getCustomModelData().getOrDefault(file.getName().replace(".json", ""), null); - if (data == null) { - // Create a fresh map of Java CustomModelData IDs to Bedrock string identifiers - Int2ObjectMap map = new Int2ObjectOpenHashMap<>(); - map.put(id, identifier); - // Put the vanilla item (stick) and the initialized map in the custom model data table - packConverter.getCustomModelData().put(file.getName().replace(".json", ""), map); - } else { - // Map exists, add the new CustomModelData ID and Bedrock string identifier - data.put(id, identifier); - } - - // Create the texture information - ObjectNode textureInfo = CustomModelDataHandler.handleItemTexture(mapper, context.storage(), override.get("model").asText()); - if (textureInfo != null) { - // If texture was created, add it to the file where Bedrock will read all textures - allTextures.setAll(textureInfo); - } - } - } - } - } - - textureData.set("texture_data", allTextures); - - if (!packConverter.getCustomModelData().isEmpty()) { - // We have custom model data, so let's write the textures - OutputStream outputStream = Files.newOutputStream(context.storage().resolve(to), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE); - mapper.writer(new DefaultPrettyPrinter()).writeValue(outputStream, textureData); - } - context.log(String.format("Converted models %s", from)); - } catch (Exception e) { - e.printStackTrace(); - } - } -} diff --git a/legacy/custom/CustomModelDataHandler.java b/legacy/custom/CustomModelDataHandler.java deleted file mode 100644 index 3ca772d..0000000 --- a/legacy/custom/CustomModelDataHandler.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * Copyright (c) 2019-2023 GeyserMC. http://geysermc.org - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * @author GeyserMC - * @link https://github.com/GeyserMC/PackConverter - * - */ - -package org.geysermc.pack.converter.util; - -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.node.ObjectNode; - -import java.io.*; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.StandardOpenOption; - -public class CustomModelDataHandler { - - public static String handleItemData(ObjectMapper mapper, Path storage, String filePath) { - // Start the creation of the JSON that registers the object - ObjectNode item = mapper.createObjectNode(); - // Standard JSON - item.put("format_version", "1.16.0"); - ObjectNode itemData = mapper.createObjectNode(); - ObjectNode itemDescription = mapper.createObjectNode(); - - // Full identifier with geysercmd prefix (cmd for CustomModelData - just in case it clashes with something we do in the future) - String identifier = "geysercmd:" + filePath.replace("item/", ""); - // Register the full identifier - itemDescription.put("identifier", identifier); - itemData.set("description", itemDescription); - ObjectNode itemComponent = mapper.createObjectNode(); - // Define which texture in item_texture.json this should use. We just set it to the "clean identifier" - itemComponent.put("minecraft:icon", identifier.replace("geysercmd:", "")); - // TODO: Apply components based off the original item - // TODO: Components tell Bedrock how the item operates, how much you can stack, can you eat it, etc - // TODO: We can probably generate this from the mappings-generator as the Bedrock vanilla behavior pack doesn't define every item - itemComponent.put("minecraft:render_offsets", "tools"); - itemData.set("components", itemComponent); - item.set("minecraft:item", itemData); - - // Create, if necessary, the folder that stores all item information - File itemJsonFile = storage.resolve("items").toFile(); - if (!itemJsonFile.exists()) { - itemJsonFile.mkdir(); - } - - // Write our item information - Path path = itemJsonFile.toPath().resolve(filePath.replace("item/", "") + ".json"); - try (OutputStream outputStream = Files.newOutputStream(path, - StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE)) { - mapper.writer().writeValue(outputStream, item); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - - return identifier; - } - - public static ObjectNode handleItemTexture(ObjectMapper mapper, Path storage, String filePath) { - String cleanIdentifier = filePath.replace("item/", ""); - - InputStream stream; - JsonNode textureFile; - try { - // Read the model information for the Java CustomModelData - stream = new FileInputStream(storage.resolve("assets/minecraft/models/" + filePath + ".json").toFile()); - textureFile = mapper.readTree(stream); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - - // TODO: This is called BSing it. It works but is it correct? - if (textureFile.has("textures")) { - if (textureFile.get("textures").has("0") || textureFile.get("textures").has("layer0")) { - String determine = textureFile.get("textures").has("0") ? "0" : "layer0"; - ObjectNode textureData = mapper.createObjectNode(); - ObjectNode textureName = mapper.createObjectNode(); - // Make JSON data for Bedrock pointing to where texture data for this item is stored - textureName.put("textures", textureFile.get("textures").get(determine).textValue().replace("item/", "textures/items/")); - // Have the identifier point to that texture data - textureData.set(cleanIdentifier, textureName); - return textureData; - } - } - - return null; - } - -}