Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,8 @@ public BootstrapLogListener(ThunderGUI gui) {
}

@Override
public void debug(@NotNull String message) {
if (gui.debugMode.get()) {
appendText("DEBUG: " + message);
}

public void debugUnchecked(@NotNull String message) {
appendText("DEBUG: " + message);
super.debug(message);
}

Expand Down Expand Up @@ -82,6 +79,11 @@ public void error(@NotNull String message, @Nullable Throwable exception) {
super.error(message, exception);
}

@Override
public boolean isDebugEnabled() {
return gui.debugMode.get();
}

private void appendText(String text) {
if (gui.outputArea.getText().isEmpty()) {
gui.outputArea.setText(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,16 @@ public ThunderGUI(boolean debug) throws IOException {
convertButton.setEnabled(true);
if (debugCheckbox != null) debugCheckbox.setEnabled(true);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
} catch (IOException e) {
throw new RuntimeException(e);
} catch (Exception e) {
logListener.error("Error converting.", e);
converting.set(false);
convertButton.setEnabled(true);
if (debugCheckbox != null) debugCheckbox.setEnabled(true);
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
}
}).start();
} catch (Exception e) {
e.printStackTrace();
logListener.error("Error converting.", e);
converting.set(false);
convertButton.setEnabled(true);
if (debugCheckbox != null) debugCheckbox.setEnabled(true);
Expand Down Expand Up @@ -207,6 +211,7 @@ public ThunderGUI(boolean debug) throws IOException {
});
this.add(javaPackButton);

this.setLocationRelativeTo(null);
this.setVisible(true);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@
import team.unnamed.creative.part.ResourcePackPart;
import team.unnamed.creative.serialize.minecraft.ResourceCategory;
import team.unnamed.creative.serialize.minecraft.language.LanguageSerializer;
import team.unnamed.creative.serialize.minecraft.sound.SoundSerializer;
import team.unnamed.creative.sound.Sound;
import team.unnamed.creative.sound.SoundRegistry;
import team.unnamed.creative.texture.Texture;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,14 @@

import org.geysermc.pack.bedrock.resource.Manifest;
import org.geysermc.pack.bedrock.resource.manifest.Header;
import org.geysermc.pack.bedrock.resource.manifest.Metadata;
import org.geysermc.pack.bedrock.resource.manifest.Modules;
import org.geysermc.pack.converter.pipeline.AssetConverter;
import org.geysermc.pack.converter.pipeline.ConversionContext;
import team.unnamed.creative.metadata.pack.PackMeta;

import java.util.List;
import java.util.Map;
import java.util.UUID;

public class PackManifestConverter implements AssetConverter<PackMeta, Manifest> {
Expand All @@ -54,6 +56,11 @@ public Manifest convert(PackMeta packMeta, ConversionContext context) throws Exc

manifest.header(header);

Metadata metadata = new Metadata();
metadata.generatedWith(Map.of("PackConverter", new String[]{"GeyserMC"}));

manifest.metadata(metadata);

Modules module = new Modules();
module.description(packMeta.description());
module.type("resources");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SplashTextConverter implements AssetConverter<Writable, JsonElement
public JsonElement convert(Writable writable, ConversionContext context) throws Exception {
String[] splashes = writable.toUTF8String().split("\n");
JsonArray splashesArray = new JsonArray();
Arrays.stream(splashes).toList().forEach(splashesArray::add);
Arrays.stream(splashes).forEach(splashesArray::add);
JsonObject object = new JsonObject();
object.add("splashes", splashesArray);
return object;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ public final class PngToTgaMappings {
put("textures/entity/horse/armor/horse_armor_leather.png", new TgaMapping("textures/entity/horse/armor/horse_armor_leather.tga"));
put("textures/entity/horse2/armor/horse_armor_leather.png", new TgaMapping("textures/entity/horse2/armor/horse_armor_leather.tga"));
put("textures/entity/sheep/sheep.png", new TgaMapping("textures/entity/sheep/sheep.tga"));
put("textures/entity/sheep/sheep_baby.png", new TgaMapping("textures/entity/sheep/sheep_baby.tga"));
put("textures/entity/slime/magmacube.png", new TgaMapping("textures/entity/slime/magmacube.tga"));
put("textures/entity/spider/cave_spider.png", new TgaMapping("textures/entity/spider/cave_spider.tga"));
put("textures/entity/spider/spider.png", new TgaMapping("textures/entity/spider/spider.tga"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@

import net.kyori.adventure.key.Key;
import org.geysermc.pack.converter.util.ImageUtil;
import org.geysermc.pack.converter.util.KeyUtil;
import org.jetbrains.annotations.NotNull;
import team.unnamed.creative.texture.Texture;

Expand Down Expand Up @@ -58,6 +59,10 @@ default int order() {
return ORDER_NORMAL;
}

default void gridTransform(@NotNull TransformContext context, boolean poll, int rows, int columns, String bedrockOutput, String... javaInputs) throws IOException {
gridTransform(context, poll, rows, columns, KeyUtil.key(Key.MINECRAFT_NAMESPACE, bedrockOutput), Arrays.stream(javaInputs).map(str -> KeyUtil.key(Key.MINECRAFT_NAMESPACE, str)).toArray(Key[]::new));
}

// Adds images in rows and columns
default void gridTransform(@NotNull TransformContext context, boolean poll, int rows, int columns, Key bedrockOutput, Key... javaInputs) throws IOException {
if (rows * columns != javaInputs.length) {
Expand All @@ -67,6 +72,7 @@ default void gridTransform(@NotNull TransformContext context, boolean poll, int
boolean exists = false;

for (Key javaInput : javaInputs) {
if (javaInput == null) continue;
if (context.isTexturePresent(javaInput)) {
exists = true;
break;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
/*
* Copyright (c) 2026 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.type.texture.transformer;

import net.kyori.adventure.key.Key;
import org.geysermc.pack.converter.util.ImageUtil;
import org.geysermc.pack.converter.util.KeyUtil;

import java.awt.image.BufferedImage;
import java.io.IOException;

public class TransformGraphics {
private final TransformContext context;
private final String output;
private final float scale;

private final BufferedImage outputImg;

public static TransformGraphics of(TransformContext context, String output, int vanillaWidth, int vanillaHeight, float scale) {
return new TransformGraphics(context, output, vanillaWidth, vanillaHeight, scale);
}

private TransformGraphics(TransformContext context, String output, int vanillaWidth, int vanillaHeight, float scale) {
this.context = context;
this.output = output;
this.scale = scale;

this.outputImg = new BufferedImage((int) (vanillaWidth * scale), (int) (vanillaHeight * scale), BufferedImage.TYPE_INT_ARGB);
}

public TransformGraphics addImage(SourceImage source) {
this.outputImg.getGraphics().drawImage(source.texture, 0, 0, null);

return this;
}

public TransformGraphics addImage(SourceImage source, int desX, int desY) {
this.outputImg.getGraphics().drawImage(source.texture, desX, desY, null);

return this;
}

public TransformGraphics addImage(SourceImage source, int srcX, int srcY, int width, int height, int desX, int desY) {
this.outputImg.getGraphics().drawImage(ImageUtil.crop(
source.texture, source.x(srcX), source.y(srcY),
source.x(width), source.y(height)
), (int) (desX * scale), (int) (desY * scale), null);

return this;
}

public void finish() throws IOException {
context.offer(KeyUtil.key(Key.MINECRAFT_NAMESPACE, this.output), this.outputImg, "PNG");
}

public static class SourceImage {
private final BufferedImage texture;
private final int vanillaWidth, vanillaHeight;

public SourceImage(BufferedImage texture, int vanillaWidth, int vanillaHeight) {
this.texture = texture;
this.vanillaWidth = vanillaWidth;
this.vanillaHeight = vanillaHeight;
}

public float x(int srcX) {
return srcX * (this.texture.getWidth() / (float) vanillaWidth);
}

public float y(int srcY) {
return srcY * (this.texture.getHeight() / (float) vanillaHeight);
}
}
}
Loading