mirror of
https://github.com/GeyserMC/PackConverter.git
synced 2025-12-19 14:59:21 +00:00
Add option to enforce pack.mcmeta check, off by default
This commit is contained in:
@@ -73,6 +73,7 @@ public class Main {
|
|||||||
System.setProperty("PackConverter.Debug", String.valueOf(debug));
|
System.setProperty("PackConverter.Debug", String.valueOf(debug));
|
||||||
|
|
||||||
new PackConverter()
|
new PackConverter()
|
||||||
|
.enforcePackCheck(true)
|
||||||
.input(Path.of(inputPath))
|
.input(Path.of(inputPath))
|
||||||
.output(Path.of(outputPath))
|
.output(Path.of(outputPath))
|
||||||
.packName(packName)
|
.packName(packName)
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ public class ThunderGUI extends JFrame {
|
|||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
try {
|
try {
|
||||||
new PackConverter()
|
new PackConverter()
|
||||||
|
.enforcePackCheck(true)
|
||||||
.input(inputPath)
|
.input(inputPath)
|
||||||
.output(outputPath)
|
.output(outputPath)
|
||||||
.packName(packName.getText().isBlank() ? inputPath.getFileName().toString() : packName.getText())
|
.packName(packName.getText().isBlank() ? inputPath.getFileName().toString() : packName.getText())
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ public final class PackConverter {
|
|||||||
private String textureSubdirectory;
|
private String textureSubdirectory;
|
||||||
|
|
||||||
private boolean compressed;
|
private boolean compressed;
|
||||||
|
private boolean enforcePackCheck = false;
|
||||||
|
|
||||||
private final Map<Class<?>, List<ActionListener<?>>> actionListeners = new IdentityHashMap<>();
|
private final Map<Class<?>, List<ActionListener<?>>> actionListeners = new IdentityHashMap<>();
|
||||||
|
|
||||||
@@ -169,6 +170,17 @@ public final class PackConverter {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets if PackConverter should enforce a check for `pack.mcmeta` in the input.
|
||||||
|
*
|
||||||
|
* @param enforcePackCheck whether the check should be done
|
||||||
|
* @return this instance
|
||||||
|
*/
|
||||||
|
public PackConverter enforcePackCheck(boolean enforcePackCheck) {
|
||||||
|
this.enforcePackCheck = enforcePackCheck;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a converter to the converter list.
|
* Adds a converter to the converter list.
|
||||||
*
|
*
|
||||||
@@ -294,10 +306,10 @@ public final class PackConverter {
|
|||||||
// Need to download the client jar, then use the
|
// Need to download the client jar, then use the
|
||||||
// client jar to get the vanilla models and textures, so we can
|
// client jar to get the vanilla models and textures, so we can
|
||||||
// ensure all parent models exist to convert them to Bedrock.
|
// ensure all parent models exist to convert them to Bedrock.
|
||||||
VanillaPackProvider.create(vanillaPackPath, this.logListener);
|
VanillaPackProvider.create(this.vanillaPackPath, this.logListener);
|
||||||
|
|
||||||
ZipUtils.openFileSystem(this.input, this.compressed, input -> {
|
ZipUtils.openFileSystem(this.input, this.compressed, input -> {
|
||||||
if (!Files.exists(input.resolve("pack.mcmeta"))) {
|
if (this.enforcePackCheck && !Files.exists(input.resolve("pack.mcmeta"))) {
|
||||||
logListener.error("Invalid Java Edition resource pack. No pack.mcmeta found.");
|
logListener.error("Invalid Java Edition resource pack. No pack.mcmeta found.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user