1
0
mirror of https://github.com/GeyserMC/PackConverter.git synced 2025-12-19 14:59:21 +00:00

Print exceptions in UI, fix conversion under Linux/Mac, set tab size to 2

This commit is contained in:
Aurora
2025-08-02 15:21:13 +01:00
parent e65dbc1a9f
commit 64d3439c9e
3 changed files with 14 additions and 3 deletions

View File

@@ -30,6 +30,9 @@ import org.geysermc.pack.converter.util.LogListener;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.PrintWriter;
import java.io.StringWriter;
public class BootstrapLogListener implements LogListener {
private final ThunderGUI gui;
@@ -62,6 +65,14 @@ public class BootstrapLogListener implements LogListener {
@Override
public void error(@NotNull String message, @Nullable Throwable exception) {
appendText("ERROR: " + message);
if (exception != null) {
StringWriter writer = new StringWriter();
PrintWriter printWriter = new PrintWriter(writer);
exception.printStackTrace(printWriter);
appendText(writer.toString());
}
}
private void appendText(String text) {

View File

@@ -75,6 +75,7 @@ public class ThunderGUI extends JFrame {
this.outputArea.setEditable(false);
this.outputArea.setFocusable(false);
this.outputArea.setLineWrap(true);
this.outputArea.setTabSize(2);
JScrollPane scrollArea = new JScrollPane(this.outputArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollArea.setBounds(225, 90, 535, 125);

View File

@@ -110,11 +110,10 @@ public class TextureConverter implements Converter<TextureConversionData> {
String fallbackPath = bedrockRoot + "/" + relativePath.substring(relativePath.indexOf('/') + 1) + ".png";
if (mappingObject instanceof Map<?,?> keyMappings) { // Handles common subdirectories
String sanitizedName = input.substring(input.indexOf(File.separator) + 1);
String sanitizedName = input.substring(input.indexOf('/') + 1);
if (sanitizedName.endsWith(".png")) sanitizedName = sanitizedName.substring(0, sanitizedName.length() - 4);
String javaPath = sanitizedName.substring(rootPath.length() + 1);
Object bedrockOutput = keyMappings.get(javaPath);
Object bedrockOutput = keyMappings.get(sanitizedName);
if (bedrockOutput instanceof String bedrockPath) {
outputPaths.add(bedrockRoot + "/" + bedrockPath + ".png");
} else if (bedrockOutput instanceof List<?> paths) {