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:
@@ -30,6 +30,9 @@ import org.geysermc.pack.converter.util.LogListener;
|
|||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.io.StringWriter;
|
||||||
|
|
||||||
public class BootstrapLogListener implements LogListener {
|
public class BootstrapLogListener implements LogListener {
|
||||||
private final ThunderGUI gui;
|
private final ThunderGUI gui;
|
||||||
|
|
||||||
@@ -62,6 +65,14 @@ public class BootstrapLogListener implements LogListener {
|
|||||||
@Override
|
@Override
|
||||||
public void error(@NotNull String message, @Nullable Throwable exception) {
|
public void error(@NotNull String message, @Nullable Throwable exception) {
|
||||||
appendText("ERROR: " + message);
|
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) {
|
private void appendText(String text) {
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ public class ThunderGUI extends JFrame {
|
|||||||
this.outputArea.setEditable(false);
|
this.outputArea.setEditable(false);
|
||||||
this.outputArea.setFocusable(false);
|
this.outputArea.setFocusable(false);
|
||||||
this.outputArea.setLineWrap(true);
|
this.outputArea.setLineWrap(true);
|
||||||
|
this.outputArea.setTabSize(2);
|
||||||
|
|
||||||
JScrollPane scrollArea = new JScrollPane(this.outputArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
JScrollPane scrollArea = new JScrollPane(this.outputArea, ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||||
scrollArea.setBounds(225, 90, 535, 125);
|
scrollArea.setBounds(225, 90, 535, 125);
|
||||||
|
|||||||
@@ -110,11 +110,10 @@ public class TextureConverter implements Converter<TextureConversionData> {
|
|||||||
|
|
||||||
String fallbackPath = bedrockRoot + "/" + relativePath.substring(relativePath.indexOf('/') + 1) + ".png";
|
String fallbackPath = bedrockRoot + "/" + relativePath.substring(relativePath.indexOf('/') + 1) + ".png";
|
||||||
if (mappingObject instanceof Map<?,?> keyMappings) { // Handles common subdirectories
|
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);
|
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) {
|
if (bedrockOutput instanceof String bedrockPath) {
|
||||||
outputPaths.add(bedrockRoot + "/" + bedrockPath + ".png");
|
outputPaths.add(bedrockRoot + "/" + bedrockPath + ".png");
|
||||||
} else if (bedrockOutput instanceof List<?> paths) {
|
} else if (bedrockOutput instanceof List<?> paths) {
|
||||||
|
|||||||
Reference in New Issue
Block a user