diff --git a/converter/src/main/java/org/geysermc/pack/converter/converter/texture/transformer/type/entity/DolphinTransformer.java b/converter/src/main/java/org/geysermc/pack/converter/converter/texture/transformer/type/entity/DolphinTransformer.java new file mode 100644 index 0000000..ece8afb --- /dev/null +++ b/converter/src/main/java/org/geysermc/pack/converter/converter/texture/transformer/type/entity/DolphinTransformer.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2025 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.converter.texture.transformer.type.entity; + +import com.google.auto.service.AutoService; +import net.kyori.adventure.key.Key; +import org.geysermc.pack.converter.PackConverter; +import org.geysermc.pack.converter.converter.texture.transformer.TextureTransformer; +import org.geysermc.pack.converter.converter.texture.transformer.TransformContext; +import org.jetbrains.annotations.NotNull; + +import java.io.IOException; +import java.io.InputStream; + +@AutoService(TextureTransformer.class) +public class DolphinTransformer implements TextureTransformer { + @Override + public void transform(@NotNull TransformContext context) throws IOException { + if (context.isTexturePresent(Key.key(Key.MINECRAFT_NAMESPACE, "entity/dolphin.png"))) { + InputStream stream = PackConverter.class.getResourceAsStream("/dolphin.geo.json"); + + if (stream == null) { + context.error("Dolphin geo file not found."); + return; + } + + byte[] bytes = new byte[stream.available()]; + + stream.read(bytes); + + context.bedrockResourcePack().addExtraFile(bytes, "models/entity/dolphin.geo.json"); + } + } +} diff --git a/converter/src/main/resources/dolphin.geo.json b/converter/src/main/resources/dolphin.geo.json new file mode 100644 index 0000000..f925f9d --- /dev/null +++ b/converter/src/main/resources/dolphin.geo.json @@ -0,0 +1,174 @@ +{ + "format_version": "1.21.0", + "minecraft:geometry": [ + { + "description": { + "identifier": "geometry.dolphin", + "texture_width": 64, + "texture_height": 64, + "visible_bounds_width": 5, + "visible_bounds_height": 2.5, + "visible_bounds_offset": [0, 0.75, 0] + }, + "bones": [ + { + "name": "body", + "pivot": [0, 0, -3], + "cubes": [ + { + "origin": [-4, 0, -3], + "size": [8, 7, 13], + "uv": { + "north": {"uv": [35, 13], "uv_size": [8, 7]}, + "east": {"uv": [22, 13], "uv_size": [13, 7]}, + "south": {"uv": [56, 13], "uv_size": [8, 7]}, + "west": {"uv": [43, 13], "uv_size": [13, 7]}, + "up": {"uv": [35, 0], "uv_size": [8, 13]}, + "down": {"uv": [43, 13], "uv_size": [8, -13]} + } + } + ] + }, + { + "name": "head", + "parent": "body", + "pivot": [0, 0, -3], + "cubes": [ + { + "origin": [-4, 0, -9], + "size": [8, 7, 6], + "uv": { + "north": {"uv": [6, 6], "uv_size": [8, 7]}, + "east": {"uv": [0, 6], "uv_size": [6, 7]}, + "south": {"uv": [20, 6], "uv_size": [8, 7]}, + "west": {"uv": [14, 6], "uv_size": [6, 7]}, + "up": {"uv": [6, 0], "uv_size": [8, 6]}, + "down": {"uv": [14, 6], "uv_size": [8, -6]} + } + } + ], + "locators": { + "lead": [0, 0, 0] + } + }, + { + "name": "nose", + "parent": "head", + "pivot": [0, 0, -13], + "cubes": [ + { + "origin": [-1, 0, -13], + "size": [2, 2, 4], + "uv": { + "north": {"uv": [4, 17], "uv_size": [2, 2]}, + "east": {"uv": [0, 17], "uv_size": [4, 2]}, + "south": {"uv": [10, 17], "uv_size": [2, 2]}, + "west": {"uv": [6, 17], "uv_size": [4, 2]}, + "up": {"uv": [4, 13], "uv_size": [2, 4]}, + "down": {"uv": [6, 17], "uv_size": [2, -4]} + } + } + ] + }, + { + "name": "tail", + "parent": "body", + "pivot": [0, 2.5, 11], + "cubes": [ + { + "origin": [-2, 0, 10], + "size": [4, 5, 11], + "uv": { + "north": {"uv": [11, 30], "uv_size": [4, 5]}, + "east": {"uv": [0, 30], "uv_size": [11, 5]}, + "south": {"uv": [26, 30], "uv_size": [4, 5]}, + "west": {"uv": [15, 30], "uv_size": [11, 5]}, + "up": {"uv": [11, 19], "uv_size": [4, 11]}, + "down": {"uv": [15, 30], "uv_size": [4, -11]} + } + } + ] + }, + { + "name": "tail_fin", + "parent": "tail", + "pivot": [0, 2.5, 20], + "cubes": [ + { + "origin": [-5, 2, 19], + "size": [10, 1, 6], + "uv": { + "north": {"uv": [25, 26], "uv_size": [10, 1]}, + "east": {"uv": [19, 26], "uv_size": [6, 1]}, + "south": {"uv": [41, 26], "uv_size": [10, 1]}, + "west": {"uv": [35, 26], "uv_size": [6, 1]}, + "up": {"uv": [25, 20], "uv_size": [10, 6]}, + "down": {"uv": [35, 26], "uv_size": [10, -6]} + } + } + ] + }, + { + "name": "back_fin", + "parent": "body", + "pivot": [0, 7, 2], + "rotation": [-30, 0, 0], + "cubes": [ + { + "origin": [-0.5, 6.25, 1], + "size": [1, 5, 4], + "uv": { + "north": {"uv": [57, 0], "uv_size": [1, 5]}, + "east": {"uv": [51, 5], "uv_size": [5, 4]}, + "south": {"uv": [56, 0], "uv_size": [1, 5]}, + "west": {"uv": [57, 5], "uv_size": [5, 4]}, + "up": {"uv": [56, 5], "uv_size": [1, 4]}, + "down": {"uv": [62, 9], "uv_size": [1, -4]} + } + } + ] + }, + { + "name": "left_fin", + "parent": "body", + "pivot": [3, 1, -1], + "rotation": [0, -25, 20], + "cubes": [ + { + "origin": [3, 1, -2.5], + "size": [7, 1, 4], + "uv": { + "north": {"uv": [56, 27], "uv_size": [1, -7], "uv_rotation": 90}, + "east": {"uv": [55, 27], "uv_size": [1, 4], "uv_rotation": 90}, + "south": {"uv": [55, 27], "uv_size": [1, -7], "uv_rotation": 90}, + "west": {"uv": [63, 27], "uv_size": [1, 4], "uv_rotation": 90}, + "up": {"uv": [55, 27], "uv_size": [-7, 4]}, + "down": {"uv": [56, 31], "uv_size": [7, -4]} + } + } + ] + }, + { + "name": "right_fin", + "parent": "body", + "pivot": [-3, 1, -1], + "rotation": [0, 25, -20], + "cubes": [ + { + "origin": [-10, 1, -2.5], + "size": [7, 1, 4], + "uv": { + "north": {"uv": [56, 20], "uv_size": [1, 7], "uv_rotation": 90}, + "east": {"uv": [63, 31], "uv_size": [1, -4], "uv_rotation": 90}, + "south": {"uv": [55, 20], "uv_size": [1, 7], "uv_rotation": 90}, + "west": {"uv": [55, 27], "uv_size": [1, 4], "uv_rotation": 90}, + "up": {"uv": [48, 27], "uv_size": [7, 4]}, + "down": {"uv": [56, 31], "uv_size": [7, -4]} + } + } + ] + } + ] + } + ] +} \ No newline at end of file