mirror of
https://github.com/GeyserMC/PackConverter.git
synced 2025-12-19 14:59:21 +00:00
Rewrite pack converter code and add pack schemas
Java POJO's are now generated from JSON schemas meaning they should always be up-to-date. The legacy converters have been moved into a separate package until they get converted. This new structure and systems/supporting APIs backing it makes the library far more powerful and will allow for much greater potential going forward.
This commit is contained in:
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
[submodule "pack-schema/generator/src/main/resources/schema"]
|
||||||
|
path = pack-schema/generator/src/main/resources/schema
|
||||||
|
url = https://github.com/Blockception/Minecraft-bedrock-json-schemas
|
||||||
@@ -7,7 +7,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
|
|
||||||
application {
|
application {
|
||||||
mainClass.set("org.geysermc.packconverter.boostrap.Main")
|
mainClass.set("org.geysermc.pack.converter.boostrap.Main")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||||
|
|||||||
@@ -26,7 +26,8 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.bootstrap;
|
package org.geysermc.packconverter.bootstrap;
|
||||||
|
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.pack.converter.PackConverter;
|
||||||
|
import org.geysermc.pack.converter.converters.Converters;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -52,10 +53,11 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
PackConverter packConverter = new PackConverter(packFile, Paths.get(packFile.toString().replaceFirst("[.][^.]+$", ".mcpack")));
|
new PackConverter()
|
||||||
packConverter.convert();
|
.input(packFile)
|
||||||
packConverter.pack();
|
.output(Paths.get(packFile.toString().replaceFirst("[.][^.]+$", ".mcpack")))
|
||||||
packConverter.cleanup();
|
.converters(Converters.defaultConverters())
|
||||||
|
.convert();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,6 +22,9 @@ allprojects {
|
|||||||
// Geyser, Floodgate, Cumulus etc.
|
// Geyser, Floodgate, Cumulus etc.
|
||||||
maven("https://repo.opencollab.dev/main")
|
maven("https://repo.opencollab.dev/main")
|
||||||
maven("https://repo.opencollab.dev/maven-snapshots")
|
maven("https://repo.opencollab.dev/maven-snapshots")
|
||||||
|
|
||||||
|
// Java pack library
|
||||||
|
maven("https://repo.unnamed.team/repository/unnamed-public/")
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "org.geysermc"
|
group = "org.geysermc"
|
||||||
|
|||||||
@@ -1,10 +1,16 @@
|
|||||||
dependencies {
|
dependencies {
|
||||||
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.0")
|
api(project(":pack-schema-api"))
|
||||||
|
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2")
|
||||||
implementation("com.twelvemonkeys.imageio:imageio-tga:3.5")
|
implementation("com.twelvemonkeys.imageio:imageio-tga:3.5")
|
||||||
implementation("com.nukkitx.fastutil:fastutil-int-object-maps:8.5.3")
|
implementation("com.nukkitx.fastutil:fastutil-int-object-maps:8.5.3")
|
||||||
implementation("net.kyori:adventure-api:4.13.1")
|
implementation("net.kyori:adventure-api:4.13.1")
|
||||||
implementation("net.kyori:adventure-text-serializer-gson:4.13.1")
|
implementation("net.kyori:adventure-text-serializer-gson:4.13.1")
|
||||||
implementation("net.kyori:adventure-text-serializer-legacy:4.13.1")
|
implementation("net.kyori:adventure-text-serializer-legacy:4.13.1")
|
||||||
|
implementation("team.unnamed:creative-api:0.7.1-SNAPSHOT")
|
||||||
|
implementation("team.unnamed:creative-serializer-minecraft:0.7.1-SNAPSHOT")
|
||||||
|
|
||||||
|
compileOnly("com.google.auto.service:auto-service:1.0.1")
|
||||||
|
annotationProcessor("com.google.auto.service:auto-service:1.0.1")
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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;
|
||||||
|
|
||||||
|
import org.geysermc.pack.bedrock.resource.BedrockResourcePack;
|
||||||
|
import org.geysermc.pack.converter.utils.LogListener;
|
||||||
|
import org.geysermc.pack.converter.data.ConversionData;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import team.unnamed.creative.ResourcePack;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public record PackConversionContext<T extends ConversionData>(
|
||||||
|
@NotNull T data,
|
||||||
|
@NotNull PackConverter packConverter,
|
||||||
|
@NotNull ResourcePack javaResourcePack,
|
||||||
|
@NotNull BedrockResourcePack bedrockResourcePack,
|
||||||
|
@NotNull LogListener logListener) {
|
||||||
|
|
||||||
|
public Path inputDirectory() {
|
||||||
|
return data.inputDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Path outputDirectory() {
|
||||||
|
return data.outputDirectory();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void info(@NotNull String message) {
|
||||||
|
logListener.info(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void warn(@NotNull String message) {
|
||||||
|
logListener.warn(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(@NotNull String message) {
|
||||||
|
logListener.error(message);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void error(@NotNull String message, @NotNull Throwable exception) {
|
||||||
|
logListener.error(message, exception);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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;
|
||||||
|
|
||||||
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
import org.geysermc.pack.bedrock.resource.BedrockResourcePack;
|
||||||
|
import org.geysermc.pack.converter.converters.Converter;
|
||||||
|
import org.geysermc.pack.converter.data.ConversionData;
|
||||||
|
import org.geysermc.pack.converter.utils.DefaultLogListener;
|
||||||
|
import org.geysermc.pack.converter.utils.LogListener;
|
||||||
|
import org.geysermc.pack.converter.utils.ZipUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import team.unnamed.creative.ResourcePack;
|
||||||
|
import team.unnamed.creative.serialize.minecraft.MinecraftResourcePackReader;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class PackConverter {
|
||||||
|
private Path input;
|
||||||
|
private Path output;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
private final Map<String, Int2ObjectMap<String>> customModelData = new HashMap<>();
|
||||||
|
|
||||||
|
private final List<Converter<?>> converters = new ArrayList<>();
|
||||||
|
|
||||||
|
private Path tmpDir;
|
||||||
|
|
||||||
|
@Setter
|
||||||
|
private LogListener logListener = new DefaultLogListener();
|
||||||
|
|
||||||
|
public PackConverter input(@NotNull Path input) {
|
||||||
|
this.input = input;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackConverter output(@NotNull Path output) {
|
||||||
|
this.output = output;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackConverter converter(@NotNull Converter<?> converter) {
|
||||||
|
this.converters.add(converter);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackConverter converters(@NotNull List<Converter<?>> converters) {
|
||||||
|
this.converters.addAll(converters);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PackConverter logListener(@NotNull LogListener logListener) {
|
||||||
|
this.logListener = logListener;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert all resources in the pack using the converters
|
||||||
|
*/
|
||||||
|
public void convert() throws IOException {
|
||||||
|
if (this.input == null) {
|
||||||
|
throw new NullPointerException("Input cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.output == null) {
|
||||||
|
throw new NullPointerException("Output cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Load any image plugins
|
||||||
|
ImageIO.scanForPlugins();
|
||||||
|
|
||||||
|
this.tmpDir = this.input.toAbsolutePath().getParent().resolve(this.output.getFileName() + "_mcpack/");
|
||||||
|
|
||||||
|
if (this.converters.isEmpty()) {
|
||||||
|
throw new IllegalStateException("No converters have been added");
|
||||||
|
}
|
||||||
|
|
||||||
|
ResourcePack javaResourcePack = MinecraftResourcePackReader.minecraft().readFromZipFile(this.input);
|
||||||
|
BedrockResourcePack bedrockResourcePack = new BedrockResourcePack(this.tmpDir);
|
||||||
|
|
||||||
|
int errors = 0;
|
||||||
|
for (Converter converter : this.converters) {
|
||||||
|
ConversionData data = converter.createConversionData(this, this.input, this.output);
|
||||||
|
PackConversionContext<?> context = new PackConversionContext<>(data, this, javaResourcePack, bedrockResourcePack, this.logListener);
|
||||||
|
|
||||||
|
try {
|
||||||
|
converter.convert(context);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
this.logListener.error("Error converting pack!", t);
|
||||||
|
errors++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bedrockResourcePack.export();
|
||||||
|
|
||||||
|
if (errors > 0) {
|
||||||
|
this.logListener.warn("Pack conversion completed with " + errors + " errors!");
|
||||||
|
} else {
|
||||||
|
this.logListener.info("Pack conversion completed successfully!");
|
||||||
|
}
|
||||||
|
|
||||||
|
this.pack();
|
||||||
|
this.cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert the temporary folder into the output zip
|
||||||
|
*/
|
||||||
|
public void pack() {
|
||||||
|
ZipUtils zipUtils = new ZipUtils(this, this.tmpDir.toFile());
|
||||||
|
zipUtils.generateFileList();
|
||||||
|
zipUtils.zipIt(this.logListener, this.output.toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the temporary folder generated by the converter.
|
||||||
|
* Silently fails.
|
||||||
|
*/
|
||||||
|
public void cleanup() {
|
||||||
|
try {
|
||||||
|
Files.delete(tmpDir);
|
||||||
|
} catch (IOException ignored) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.converters;
|
||||||
|
|
||||||
|
import org.geysermc.pack.converter.PackConverter;
|
||||||
|
import org.geysermc.pack.converter.data.BaseConversionData;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public abstract class BaseConverter implements Converter<BaseConversionData> {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BaseConversionData createConversionData(@NotNull PackConverter converter, @NotNull Path inputDirectory, @NotNull Path outputDirectory) {
|
||||||
|
return new BaseConversionData(inputDirectory, outputDirectory);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.converters;
|
||||||
|
|
||||||
|
import org.geysermc.pack.converter.PackConversionContext;
|
||||||
|
import org.geysermc.pack.converter.PackConverter;
|
||||||
|
import org.geysermc.pack.converter.data.ConversionData;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public interface Converter<T extends ConversionData> {
|
||||||
|
|
||||||
|
void convert(@NotNull PackConversionContext<T> context) throws Exception;
|
||||||
|
|
||||||
|
T createConversionData(@NotNull PackConverter converter, @NotNull Path inputDirectory, @NotNull Path outputDirectory);
|
||||||
|
|
||||||
|
default boolean isExperimental() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.converters;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.ServiceLoader;
|
||||||
|
|
||||||
|
public class Converters {
|
||||||
|
|
||||||
|
public static List<Converter<?>> defaultConverters() {
|
||||||
|
return defaultConverters(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||||
|
public static List<Converter<?>> defaultConverters(boolean experimental) {
|
||||||
|
return (List) ServiceLoader.load(Converter.class).stream()
|
||||||
|
.map(ServiceLoader.Provider::get)
|
||||||
|
.filter(converter -> experimental || !converter.isExperimental())
|
||||||
|
.toList();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,72 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.converters.base;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
|
import org.geysermc.pack.bedrock.resource.Manifest;
|
||||||
|
import org.geysermc.pack.bedrock.resource.manifest.Header;
|
||||||
|
import org.geysermc.pack.bedrock.resource.manifest.Modules;
|
||||||
|
import org.geysermc.pack.converter.PackConversionContext;
|
||||||
|
import org.geysermc.pack.converter.converters.BaseConverter;
|
||||||
|
import org.geysermc.pack.converter.converters.Converter;
|
||||||
|
import org.geysermc.pack.converter.data.BaseConversionData;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import team.unnamed.creative.ResourcePack;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
|
public class PackManifestConverter extends BaseConverter {
|
||||||
|
private static final int FORMAT_VERSION = 2;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void convert(@NotNull PackConversionContext<BaseConversionData> context) throws Exception {
|
||||||
|
ResourcePack javaPack = context.javaResourcePack();
|
||||||
|
|
||||||
|
Manifest manifest = new Manifest();
|
||||||
|
manifest.formatVersion(FORMAT_VERSION);
|
||||||
|
|
||||||
|
Header header = new Header();
|
||||||
|
header.description(javaPack.description());
|
||||||
|
header.name(context.inputDirectory().getFileName().toString().split("\\.")[0]);
|
||||||
|
header.version(new float[] { 1, 0, 0 });
|
||||||
|
header.minEngineVersion(new float[] { 1, 16, 0 });
|
||||||
|
header.uuid(UUID.randomUUID().toString());
|
||||||
|
|
||||||
|
manifest.header(header);
|
||||||
|
|
||||||
|
Modules module = new Modules();
|
||||||
|
module.description(javaPack.description());
|
||||||
|
module.type("resources");
|
||||||
|
module.uuid(UUID.randomUUID().toString());
|
||||||
|
module.version(new float[] { 1, 0, 0 });
|
||||||
|
|
||||||
|
manifest.modules(List.of(module));
|
||||||
|
context.bedrockResourcePack().manifest(manifest);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.data;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public class BaseConversionData implements ConversionData {
|
||||||
|
private final Path inputDirectory;
|
||||||
|
private final Path outputDirectory;
|
||||||
|
|
||||||
|
public BaseConversionData(@NotNull Path inputDirectory, @NotNull Path outputDirectory) {
|
||||||
|
this.inputDirectory = inputDirectory;
|
||||||
|
this.outputDirectory = outputDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Path inputDirectory() {
|
||||||
|
return this.inputDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public @NotNull Path outputDirectory() {
|
||||||
|
return this.outputDirectory;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,8 +24,17 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.utils;
|
package org.geysermc.pack.converter.data;
|
||||||
|
|
||||||
public interface OnLogListener {
|
import org.jetbrains.annotations.NotNull;
|
||||||
void onLog();
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
public interface ConversionData {
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
Path inputDirectory();
|
||||||
|
|
||||||
|
@NotNull
|
||||||
|
Path outputDirectory();
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.utils;
|
package org.geysermc.pack.converter.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.utils;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
public class DefaultLogListener implements LogListener {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void info(@NotNull String message) {
|
||||||
|
System.out.println("[INFO] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void warn(@NotNull String message) {
|
||||||
|
System.out.println("[WARN] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(@NotNull String message) {
|
||||||
|
System.out.println("[ERROR] " + message);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void error(@NotNull String message, @Nullable Throwable exception) {
|
||||||
|
this.error(message);
|
||||||
|
if (exception != null) {
|
||||||
|
exception.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.utils;
|
package org.geysermc.pack.converter.utils;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -24,24 +24,17 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.pack.converter.utils;
|
||||||
|
|
||||||
import lombok.AllArgsConstructor;
|
import org.jetbrains.annotations.NotNull;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import java.nio.file.Path;
|
public interface LogListener {
|
||||||
import java.util.ArrayList;
|
void info(@NotNull String message);
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@AllArgsConstructor
|
void warn(@NotNull String message);
|
||||||
public abstract class AbstractConverter {
|
|
||||||
PackConverter packConverter;
|
|
||||||
Path storage;
|
|
||||||
Object[] data;
|
|
||||||
|
|
||||||
public static List<Object[]> getDefaultData() {
|
void error(@NotNull String message);
|
||||||
return new ArrayList<>();
|
|
||||||
};
|
|
||||||
|
|
||||||
public abstract List<AbstractConverter> convert();
|
void error(@NotNull String message, @Nullable Throwable exception);
|
||||||
}
|
}
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.utils;
|
package org.geysermc.pack.converter.utils;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
@@ -24,9 +24,9 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.utils;
|
package org.geysermc.pack.converter.utils;
|
||||||
|
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.pack.converter.PackConverter;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
@@ -52,7 +52,7 @@ public class ZipUtils {
|
|||||||
this.sourceFolder = sourceFolder;
|
this.sourceFolder = sourceFolder;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void zipIt(String zipFile) {
|
public void zipIt(LogListener listener, String zipFile) {
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
String source = sourceFolder.getName();
|
String source = sourceFolder.getName();
|
||||||
FileOutputStream fos = null;
|
FileOutputStream fos = null;
|
||||||
@@ -61,11 +61,11 @@ public class ZipUtils {
|
|||||||
fos = new FileOutputStream(zipFile);
|
fos = new FileOutputStream(zipFile);
|
||||||
zos = new ZipOutputStream(fos);
|
zos = new ZipOutputStream(fos);
|
||||||
|
|
||||||
packConverter.log("Output to zip " + zipFile);
|
listener.info("Output to zip " + zipFile);
|
||||||
FileInputStream in = null;
|
FileInputStream in = null;
|
||||||
|
|
||||||
for (String file: this.fileList) {
|
for (String file: this.fileList) {
|
||||||
packConverter.log("File added " + file);
|
listener.info("File added " + file);
|
||||||
ZipEntry ze = new ZipEntry(file);
|
ZipEntry ze = new ZipEntry(file);
|
||||||
zos.putNextEntry(ze);
|
zos.putNextEntry(ze);
|
||||||
try {
|
try {
|
||||||
@@ -81,8 +81,7 @@ public class ZipUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
zos.closeEntry();
|
zos.closeEntry();
|
||||||
packConverter.log("Folder successfully compressed");
|
listener.info("Folder successfully compressed");
|
||||||
|
|
||||||
} catch (IOException ex) {
|
} catch (IOException ex) {
|
||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019-2023 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.packconverter;
|
|
||||||
|
|
||||||
import org.geysermc.packconverter.converters.AbstractConverter;
|
|
||||||
import org.geysermc.packconverter.converters.AtlasConverter;
|
|
||||||
import org.geysermc.packconverter.converters.BannerPatternBlackConverter;
|
|
||||||
import org.geysermc.packconverter.converters.BannerPatternConverter;
|
|
||||||
import org.geysermc.packconverter.converters.BannerPatternPreviewMaxSizeConverter;
|
|
||||||
import org.geysermc.packconverter.converters.BarConverter;
|
|
||||||
import org.geysermc.packconverter.converters.BedConverter;
|
|
||||||
import org.geysermc.packconverter.converters.BeeConverter;
|
|
||||||
import org.geysermc.packconverter.converters.ChestFrontConverter;
|
|
||||||
import org.geysermc.packconverter.converters.ChestLeftRightDoubleConverter;
|
|
||||||
import org.geysermc.packconverter.converters.ChestNormalConverter;
|
|
||||||
import org.geysermc.packconverter.converters.ChestSideConverter;
|
|
||||||
import org.geysermc.packconverter.converters.ColorizeOverlayConverter;
|
|
||||||
import org.geysermc.packconverter.converters.CopyConverter;
|
|
||||||
import org.geysermc.packconverter.converters.CustomModelDataConverter;
|
|
||||||
import org.geysermc.packconverter.converters.DeleteConverter;
|
|
||||||
import org.geysermc.packconverter.converters.DespriteConverter;
|
|
||||||
import org.geysermc.packconverter.converters.DespriteExperimentalConverter;
|
|
||||||
import org.geysermc.packconverter.converters.DestroyStageConverter;
|
|
||||||
import org.geysermc.packconverter.converters.DolphinConverter;
|
|
||||||
import org.geysermc.packconverter.converters.DrownedConverter;
|
|
||||||
import org.geysermc.packconverter.converters.EnchantedItemGlintConverter;
|
|
||||||
import org.geysermc.packconverter.converters.FireworksConverter;
|
|
||||||
import org.geysermc.packconverter.converters.FishHookConverter;
|
|
||||||
import org.geysermc.packconverter.converters.FixWrongRootFolderConverter;
|
|
||||||
import org.geysermc.packconverter.converters.FoxConverter;
|
|
||||||
import org.geysermc.packconverter.converters.HorseConverter;
|
|
||||||
import org.geysermc.packconverter.converters.IconsConverter;
|
|
||||||
import org.geysermc.packconverter.converters.MapIconsConverter;
|
|
||||||
import org.geysermc.packconverter.converters.MetadataConverter;
|
|
||||||
import org.geysermc.packconverter.converters.NineSliceConverter;
|
|
||||||
import org.geysermc.packconverter.converters.OpaqueConverter;
|
|
||||||
import org.geysermc.packconverter.converters.OverlayToTranslateConverter;
|
|
||||||
import org.geysermc.packconverter.converters.Particles1_13Converter;
|
|
||||||
import org.geysermc.packconverter.converters.PistonArmConverter;
|
|
||||||
import org.geysermc.packconverter.converters.PlaceholderConverter;
|
|
||||||
import org.geysermc.packconverter.converters.PngToTgaConverter;
|
|
||||||
import org.geysermc.packconverter.converters.RedstoneDustConverter;
|
|
||||||
import org.geysermc.packconverter.converters.RenameConverter;
|
|
||||||
import org.geysermc.packconverter.converters.SheepConverter;
|
|
||||||
import org.geysermc.packconverter.converters.SideRotateConverter;
|
|
||||||
import org.geysermc.packconverter.converters.SpriteConverter;
|
|
||||||
import org.geysermc.packconverter.converters.TitleConverter;
|
|
||||||
import org.geysermc.packconverter.converters.TurtleConverter;
|
|
||||||
import org.geysermc.packconverter.converters.VillagerConverter;
|
|
||||||
import org.geysermc.packconverter.converters.WaterConverter;
|
|
||||||
import org.geysermc.packconverter.converters.WeatherConverter;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class ConverterHandler {
|
|
||||||
public static final List<Class<? extends AbstractConverter>> converterList = new ArrayList<>();
|
|
||||||
|
|
||||||
public static boolean enableExperimental = false;
|
|
||||||
|
|
||||||
static {
|
|
||||||
converterList.add(FixWrongRootFolderConverter.class);
|
|
||||||
converterList.add(MetadataConverter.class);
|
|
||||||
converterList.add(RenameConverter.class);
|
|
||||||
converterList.add(AtlasConverter.class);
|
|
||||||
converterList.add(BannerPatternConverter.class);
|
|
||||||
converterList.add(BedConverter.class);
|
|
||||||
converterList.add(ChestNormalConverter.class);
|
|
||||||
converterList.add(ChestLeftRightDoubleConverter.class);
|
|
||||||
converterList.add(ChestFrontConverter.class);
|
|
||||||
converterList.add(ChestSideConverter.class);
|
|
||||||
converterList.add(DrownedConverter.class);
|
|
||||||
converterList.add(DolphinConverter.class);
|
|
||||||
converterList.add(FireworksConverter.class);
|
|
||||||
converterList.add(FishHookConverter.class);
|
|
||||||
converterList.add(FoxConverter.class);
|
|
||||||
converterList.add(HorseConverter.class);
|
|
||||||
converterList.add(IconsConverter.class);
|
|
||||||
converterList.add(BannerPatternBlackConverter.class);
|
|
||||||
converterList.add(MapIconsConverter.class);
|
|
||||||
converterList.add(PistonArmConverter.class);
|
|
||||||
converterList.add(RedstoneDustConverter.class);
|
|
||||||
converterList.add(SheepConverter.class);
|
|
||||||
converterList.add(VillagerConverter.class);
|
|
||||||
converterList.add(TurtleConverter.class);
|
|
||||||
converterList.add(WeatherConverter.class);
|
|
||||||
converterList.add(OpaqueConverter.class);
|
|
||||||
converterList.add(WaterConverter.class);
|
|
||||||
converterList.add(BeeConverter.class);
|
|
||||||
converterList.add(TitleConverter.class);
|
|
||||||
converterList.add(DespriteConverter.class);
|
|
||||||
if (enableExperimental) { converterList.add(DespriteExperimentalConverter.class); } // Experimental
|
|
||||||
converterList.add(BarConverter.class);
|
|
||||||
if (enableExperimental) { converterList.add(NineSliceConverter.class); } // Experimental
|
|
||||||
//if (enableExperimental) { converterList.add(DialogConverter.class); } // Experimental TODO: Finish
|
|
||||||
converterList.add(OverlayToTranslateConverter.class);
|
|
||||||
converterList.add(ColorizeOverlayConverter.class);
|
|
||||||
converterList.add(PlaceholderConverter.class);
|
|
||||||
converterList.add(SideRotateConverter.class);
|
|
||||||
//converterList.add(ArrowConverter.class); // This is disabled as its broken and the intended output it just the original
|
|
||||||
converterList.add(Particles1_13Converter.class);
|
|
||||||
converterList.add(SpriteConverter.class);
|
|
||||||
converterList.add(DestroyStageConverter.class);
|
|
||||||
converterList.add(EnchantedItemGlintConverter.class);
|
|
||||||
converterList.add(BannerPatternPreviewMaxSizeConverter.class);
|
|
||||||
converterList.add(PngToTgaConverter.class);
|
|
||||||
converterList.add(CopyConverter.class);
|
|
||||||
|
|
||||||
// Custom, not part of the original lib
|
|
||||||
converterList.add(CustomModelDataConverter.class);
|
|
||||||
|
|
||||||
converterList.add(DeleteConverter.class);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2019-2023 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.packconverter;
|
|
||||||
|
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
|
||||||
import lombok.Getter;
|
|
||||||
import lombok.Setter;
|
|
||||||
import org.geysermc.packconverter.utils.OnLogListener;
|
|
||||||
import org.geysermc.packconverter.utils.ZipUtils;
|
|
||||||
import org.geysermc.packconverter.converters.AbstractConverter;
|
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.lang.reflect.InvocationTargetException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.zip.ZipEntry;
|
|
||||||
import java.util.zip.ZipFile;
|
|
||||||
|
|
||||||
public class PackConverter {
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
private final Map<String, Int2ObjectMap<String>> customModelData = new HashMap<>();
|
|
||||||
|
|
||||||
private Path input;
|
|
||||||
private Path output;
|
|
||||||
|
|
||||||
private Path tmpDir;
|
|
||||||
|
|
||||||
@Setter
|
|
||||||
private OnLogListener onLogListener;
|
|
||||||
|
|
||||||
public PackConverter(Path input, Path output) throws IOException {
|
|
||||||
this.input = input;
|
|
||||||
this.output = output;
|
|
||||||
|
|
||||||
// Load any image plugins
|
|
||||||
ImageIO.scanForPlugins();
|
|
||||||
|
|
||||||
// Extract the zip to a temp location
|
|
||||||
// This is quite slow, maybe try and find a faster method?
|
|
||||||
tmpDir = input.toAbsolutePath().getParent().resolve(input.getFileName() + "_mcpack/");
|
|
||||||
ZipFile zipFile = new ZipFile(input.toFile());
|
|
||||||
|
|
||||||
ZipEntry entry;
|
|
||||||
final Enumeration<? extends ZipEntry> entries = zipFile.entries();
|
|
||||||
while (entries.hasMoreElements()) {
|
|
||||||
entry = entries.nextElement();
|
|
||||||
|
|
||||||
if (!entry.isDirectory()) {
|
|
||||||
File newFile = tmpDir.resolve(entry.getName()).toFile();
|
|
||||||
newFile.getParentFile().mkdirs();
|
|
||||||
|
|
||||||
InputStream fileStream = zipFile.getInputStream(entry);
|
|
||||||
FileOutputStream outStream = new FileOutputStream(newFile);
|
|
||||||
|
|
||||||
byte[] buf = new byte[fileStream.available()];
|
|
||||||
int length;
|
|
||||||
while ((length = fileStream.read(buf)) != -1) {
|
|
||||||
outStream.write(buf, 0, length);
|
|
||||||
}
|
|
||||||
|
|
||||||
outStream.flush();
|
|
||||||
outStream.close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert all resources in the pack using the converters
|
|
||||||
*/
|
|
||||||
public void convert() {
|
|
||||||
List<AbstractConverter> additionalConverters = new ArrayList<>();
|
|
||||||
|
|
||||||
for (Class<? extends AbstractConverter> converterClass : ConverterHandler.converterList) {
|
|
||||||
try {
|
|
||||||
List<Object[]> defaultData = (List<Object[]>) converterClass.getMethod("getDefaultData").invoke(null);
|
|
||||||
|
|
||||||
AbstractConverter converter;
|
|
||||||
for (Object[] data : defaultData) {
|
|
||||||
converter = converterClass.getDeclaredConstructor(PackConverter.class, Path.class, Object[].class).newInstance(this, tmpDir, data);
|
|
||||||
|
|
||||||
additionalConverters.addAll(converter.convert());
|
|
||||||
}
|
|
||||||
} catch (InstantiationException | IllegalAccessException | NoSuchMethodException | InvocationTargetException e) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
for (AbstractConverter converter : additionalConverters) {
|
|
||||||
converter.convert();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Convert the temporary folder into the output zip
|
|
||||||
*/
|
|
||||||
public void pack() {
|
|
||||||
ZipUtils zipUtils = new ZipUtils(this, tmpDir.toFile());
|
|
||||||
zipUtils.generateFileList();
|
|
||||||
zipUtils.zipIt(output.toString());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Remove the temporary folder generated by the converter.
|
|
||||||
* Silently fails.
|
|
||||||
*/
|
|
||||||
public void cleanup() {
|
|
||||||
try {
|
|
||||||
Files.delete(tmpDir);
|
|
||||||
} catch (IOException ignored) { }
|
|
||||||
}
|
|
||||||
|
|
||||||
public void log(String message) {
|
|
||||||
if (onLogListener != null) {
|
|
||||||
onLogListener.onLog();
|
|
||||||
} else {
|
|
||||||
System.out.println(message);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -27,11 +27,14 @@
|
|||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.Color;
|
||||||
|
import java.awt.Graphics;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
// @AutoService(Converter.class)
|
||||||
public class ArrowConverter extends AbstractConverter {
|
public class ArrowConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -48,23 +52,19 @@ public class ArrowConverter extends AbstractConverter {
|
|||||||
defaultData.add(new Object[] {"textures/entity/projectiles/arrow.png", "textures/entity/arrows.png"});
|
defaultData.add(new Object[] {"textures/entity/projectiles/arrow.png", "textures/entity/arrows.png"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public ArrowConverter(PackConverter packConverter, Path storage, Object[] data) {
|
|
||||||
super(packConverter, storage, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public void convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = context.storage().resolve(from).toFile();
|
||||||
|
|
||||||
if (!fromFile.exists()) {
|
if (!fromFile.exists()) {
|
||||||
return new ArrayList<>();
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert arrow %s", to));
|
context.log(String.format("Convert arrow %s", to));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -93,9 +93,7 @@ public class ArrowConverter extends AbstractConverter {
|
|||||||
|
|
||||||
g.drawImage(fromImage, 0, 10 * factor, null);
|
g.drawImage(fromImage, 0, 10 * factor, null);
|
||||||
|
|
||||||
ImageUtils.write(newArrowImage, "png", storage.resolve(to).toFile());
|
ImageUtils.write(newArrowImage, "png", context.storage().resolve(to).toFile());
|
||||||
} catch (IOException e) { }
|
} catch (IOException e) { }
|
||||||
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class AtlasConverter extends AbstractConverter {
|
public class AtlasConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -48,24 +52,20 @@ public class AtlasConverter extends AbstractConverter {
|
|||||||
defaultData.add(new Object[] {"textures/items/compass_", 31, "textures/items/compass_atlas.png"});
|
defaultData.add(new Object[] {"textures/items/compass_", 31, "textures/items/compass_atlas.png"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public AtlasConverter(PackConverter packConverter, Path storage, Object[] data) {
|
|
||||||
super(packConverter, storage, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public void convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String base = (String) this.data[0];
|
String base = (String) context.data()[0];
|
||||||
int count = (int) this.data[1];
|
int count = (int) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
|
|
||||||
BufferedImage atlasImage = null;
|
BufferedImage atlasImage = null;
|
||||||
|
|
||||||
for (int i = 0; i <= count; i++) {
|
for (int i = 0; i <= count; i++) {
|
||||||
String step = base + String.format("%1$2s", i).replace(" ", "0") + ".png";
|
String step = base + String.format("%1$2s", i).replace(" ", "0") + ".png";
|
||||||
File stepFile = storage.resolve(step).toFile();
|
File stepFile = context.storage().resolve(step).toFile();
|
||||||
|
|
||||||
if (!stepFile.exists()) {
|
if (!stepFile.exists()) {
|
||||||
continue;
|
continue;
|
||||||
@@ -74,7 +74,7 @@ public class AtlasConverter extends AbstractConverter {
|
|||||||
BufferedImage stepImage = ImageIO.read(stepFile);
|
BufferedImage stepImage = ImageIO.read(stepFile);
|
||||||
|
|
||||||
if (atlasImage == null) {
|
if (atlasImage == null) {
|
||||||
packConverter.log(String.format("Create atlas %s", to));
|
context.log(String.format("Create atlas %s", to));
|
||||||
|
|
||||||
atlasImage = new BufferedImage(stepImage.getWidth(), stepImage.getHeight() * (count + 1), BufferedImage.TYPE_INT_ARGB);
|
atlasImage = new BufferedImage(stepImage.getWidth(), stepImage.getHeight() * (count + 1), BufferedImage.TYPE_INT_ARGB);
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class BannerPatternBlackConverter extends AbstractConverter {
|
public class BannerPatternBlackConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -91,16 +95,16 @@ public class BannerPatternBlackConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File patternFile = storage.resolve(from).toFile();
|
File patternFile = storage.resolve(from).toFile();
|
||||||
if (!patternFile.exists()) {
|
if (!patternFile.exists()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Fix banner pattern black %s", from));
|
context.log(String.format("Fix banner pattern black %s", from));
|
||||||
|
|
||||||
BufferedImage patternImage = ImageIO.read(patternFile);
|
BufferedImage patternImage = ImageIO.read(patternFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class BannerPatternConverter extends AbstractConverter {
|
public class BannerPatternConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -64,11 +68,11 @@ public class BannerPatternConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String base = (String) this.data[0];
|
String base = (String) context.data()[0];
|
||||||
Object[] patterns = (Object[]) this.data[1];
|
Object[] patterns = (Object[]) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
|
|
||||||
BufferedImage bannerImage = null;
|
BufferedImage bannerImage = null;
|
||||||
|
|
||||||
@@ -85,7 +89,7 @@ public class BannerPatternConverter extends AbstractConverter {
|
|||||||
BufferedImage patternImage = ImageIO.read(patternFile);
|
BufferedImage patternImage = ImageIO.read(patternFile);
|
||||||
|
|
||||||
if (bannerImage == null) {
|
if (bannerImage == null) {
|
||||||
packConverter.log(String.format("Convert pattern banner %s", to));
|
context.log(String.format("Convert pattern banner %s", to));
|
||||||
|
|
||||||
bannerImage = ImageIO.read(storage.resolve(base).toFile());
|
bannerImage = ImageIO.read(storage.resolve(base).toFile());
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class BannerPatternPreviewMaxSizeConverter extends AbstractConverter {
|
public class BannerPatternPreviewMaxSizeConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -91,17 +95,17 @@ public class BannerPatternPreviewMaxSizeConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
Integer max_width = (Integer) this.data[1];
|
Integer max_width = (Integer) context.data()[1];
|
||||||
|
|
||||||
File patternFile = storage.resolve(from).toFile();
|
File patternFile = storage.resolve(from).toFile();
|
||||||
if (!patternFile.exists()) {
|
if (!patternFile.exists()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Fix banner pattern preview max size %s", from));
|
context.log(String.format("Fix banner pattern preview max size %s", from));
|
||||||
|
|
||||||
BufferedImage patternImage = ImageIO.read(patternFile);
|
BufferedImage patternImage = ImageIO.read(patternFile);
|
||||||
|
|
||||||
@@ -29,9 +29,12 @@ package org.geysermc.packconverter.converters;
|
|||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -42,6 +45,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class BarConverter extends AbstractConverter {
|
public class BarConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -84,12 +88,12 @@ public class BarConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
int factorDetect = (int) this.data[1];
|
int factorDetect = (int) context.data()[1];
|
||||||
Object[] bars = (Object[]) this.data[2];
|
Object[] bars = (Object[]) context.data()[2];
|
||||||
String[] nubs = (String[]) this.data[3];
|
String[] nubs = (String[]) context.data()[3];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
if (!fromFile.exists()) {
|
if (!fromFile.exists()) {
|
||||||
@@ -117,7 +121,7 @@ public class BarConverter extends AbstractConverter {
|
|||||||
String toPath = (String) toArr[0];
|
String toPath = (String) toArr[0];
|
||||||
Color color = toArr.length > 1 && toArr[1] != null ? (Color) toArr[1] : Color.white;
|
Color color = toArr.length > 1 && toArr[1] != null ? (Color) toArr[1] : Color.white;
|
||||||
|
|
||||||
packConverter.log(String.format("Convert bar %s", toPath));
|
context.log(String.format("Convert bar %s", toPath));
|
||||||
|
|
||||||
ImageUtils.write(ImageUtils.colorize(toImage, color), "png", storage.resolve(toPath + ".png").toFile());
|
ImageUtils.write(ImageUtils.colorize(toImage, color), "png", storage.resolve(toPath + ".png").toFile());
|
||||||
|
|
||||||
@@ -127,7 +131,7 @@ public class BarConverter extends AbstractConverter {
|
|||||||
|
|
||||||
BufferedImage transparentImage = new BufferedImage(factor, (5 * factor), BufferedImage.TYPE_INT_ARGB);
|
BufferedImage transparentImage = new BufferedImage(factor, (5 * factor), BufferedImage.TYPE_INT_ARGB);
|
||||||
for (String nub : nubs) {
|
for (String nub : nubs) {
|
||||||
packConverter.log(String.format("Convert bar %s", nub));
|
context.log(String.format("Convert bar %s", nub));
|
||||||
|
|
||||||
ImageUtils.write(transparentImage, "png", storage.resolve(nub).toFile());
|
ImageUtils.write(transparentImage, "png", storage.resolve(nub).toFile());
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class BedConverter extends AbstractConverter {
|
public class BedConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -68,9 +72,9 @@ public class BedConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String bed = (String) this.data[0];
|
String bed = (String) context.data()[0];
|
||||||
|
|
||||||
File bedFile = storage.resolve(bed).toFile();
|
File bedFile = storage.resolve(bed).toFile();
|
||||||
|
|
||||||
@@ -78,7 +82,7 @@ public class BedConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert bed %s", bed));
|
context.log(String.format("Convert bed %s", bed));
|
||||||
|
|
||||||
BufferedImage bedImage = ImageIO.read(bedFile);
|
BufferedImage bedImage = ImageIO.read(bedFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class BeeConverter extends AbstractConverter {
|
public class BeeConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -56,9 +60,9 @@ public class BeeConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@ public class BeeConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert bee %s", from));
|
context.log(String.format("Convert bee %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class ChestFrontConverter extends AbstractConverter {
|
public class ChestFrontConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -55,10 +59,10 @@ public class ChestFrontConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@ public class ChestFrontConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create chest front %s", to));
|
context.log(String.format("Create chest front %s", to));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class ChestLeftRightDoubleConverter extends AbstractConverter {
|
public class ChestLeftRightDoubleConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -55,13 +59,13 @@ public class ChestLeftRightDoubleConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String fromLeft = (String) this.data[0];
|
String fromLeft = (String) context.data()[0];
|
||||||
String fromRight = (String) this.data[1];
|
String fromRight = (String) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
|
|
||||||
File leftFile = storage.resolve(fromLeft).toFile();
|
File leftFile = storage.resolve(fromLeft).toFile();
|
||||||
File rightFile = storage.resolve(fromRight).toFile();
|
File rightFile = storage.resolve(fromRight).toFile();
|
||||||
@@ -70,7 +74,7 @@ public class ChestLeftRightDoubleConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert double chest %s", to));
|
context.log(String.format("Convert double chest %s", to));
|
||||||
|
|
||||||
BufferedImage leftImage = ImageIO.read(leftFile);
|
BufferedImage leftImage = ImageIO.read(leftFile);
|
||||||
BufferedImage rightImage = ImageIO.read(rightFile);
|
BufferedImage rightImage = ImageIO.read(rightFile);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class ChestNormalConverter extends AbstractConverter {
|
public class ChestNormalConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -56,9 +60,9 @@ public class ChestNormalConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String chest = (String) this.data[0];
|
String chest = (String) context.data()[0];
|
||||||
|
|
||||||
File chestFile = storage.resolve(chest).toFile();
|
File chestFile = storage.resolve(chest).toFile();
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@ public class ChestNormalConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert normal chest %s", chest));
|
context.log(String.format("Convert normal chest %s", chest));
|
||||||
|
|
||||||
BufferedImage chestImage = ImageIO.read(chestFile);
|
BufferedImage chestImage = ImageIO.read(chestFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class ChestSideConverter extends AbstractConverter {
|
public class ChestSideConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -54,10 +58,10 @@ public class ChestSideConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -65,7 +69,7 @@ public class ChestSideConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create chest side %s", to));
|
context.log(String.format("Create chest side %s", to));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class ColorizeOverlayConverter extends AbstractConverter {
|
public class ColorizeOverlayConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -251,12 +255,12 @@ public class ColorizeOverlayConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Object[] overlays = (Object[]) this.data[0];
|
Object[] overlays = (Object[]) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
BufferedImage finalImage = null;
|
BufferedImage finalImage = null;
|
||||||
|
|
||||||
@@ -274,7 +278,7 @@ public class ColorizeOverlayConverter extends AbstractConverter {
|
|||||||
BufferedImage overlayImage = ImageIO.read(overlayFile);
|
BufferedImage overlayImage = ImageIO.read(overlayFile);
|
||||||
|
|
||||||
if (finalImage == null) {
|
if (finalImage == null) {
|
||||||
packConverter.log(String.format("Colorize and overlay %s", to));
|
context.log(String.format("Colorize and overlay %s", to));
|
||||||
|
|
||||||
finalImage = new BufferedImage(overlayImage.getWidth(), overlayImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
|
finalImage = new BufferedImage(overlayImage.getWidth(), overlayImage.getHeight(), BufferedImage.TYPE_INT_ARGB);
|
||||||
}
|
}
|
||||||
@@ -26,8 +26,11 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -35,6 +38,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class CopyConverter extends AbstractConverter {
|
public class CopyConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -112,16 +116,16 @@ public class CopyConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
if (!storage.resolve(from).toFile().exists()) {
|
if (!storage.resolve(from).toFile().exists()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Copy %s to %s", from, to));
|
context.log(String.format("Copy %s to %s", from, to));
|
||||||
|
|
||||||
Files.copy(storage.resolve(from), storage.resolve(to));
|
Files.copy(storage.resolve(from), storage.resolve(to));
|
||||||
} catch (IOException e) { }
|
} catch (IOException e) { }
|
||||||
@@ -26,8 +26,11 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -36,6 +39,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class DeleteConverter extends AbstractConverter {
|
public class DeleteConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -57,9 +61,9 @@ public class DeleteConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -67,7 +71,7 @@ public class DeleteConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Delete %s", from));
|
context.log(String.format("Delete %s", from));
|
||||||
|
|
||||||
if (fromFile.isDirectory()) {
|
if (fromFile.isDirectory()) {
|
||||||
deleteDirectory(fromFile);
|
deleteDirectory(fromFile);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class DespriteConverter extends AbstractConverter {
|
public class DespriteConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -94,11 +98,11 @@ public class DespriteConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
int factorDetect = (int) this.data[1];
|
int factorDetect = (int) context.data()[1];
|
||||||
Object[] sprites = (Object[]) this.data[2];
|
Object[] sprites = (Object[]) context.data()[2];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
if (!fromFile.exists()) {
|
if (!fromFile.exists()) {
|
||||||
@@ -119,7 +123,7 @@ public class DespriteConverter extends AbstractConverter {
|
|||||||
String to = (String) spriteArr[4];
|
String to = (String) spriteArr[4];
|
||||||
int[] emptyOverlay = spriteArr.length > 5 ? (int[]) spriteArr[5] : null;
|
int[] emptyOverlay = spriteArr.length > 5 ? (int[]) spriteArr[5] : null;
|
||||||
|
|
||||||
packConverter.log(String.format("Desprite %s", to));
|
context.log(String.format("Desprite %s", to));
|
||||||
|
|
||||||
BufferedImage spriteImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor));
|
BufferedImage spriteImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor));
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class DespriteExperimentalConverter extends AbstractConverter {
|
public class DespriteExperimentalConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -171,11 +175,11 @@ public class DespriteExperimentalConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
int factorDetect = (int) this.data[1];
|
int factorDetect = (int) context.data()[1];
|
||||||
Object[] sprites = (Object[]) this.data[2];
|
Object[] sprites = (Object[]) context.data()[2];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
if (!fromFile.exists()) {
|
if (!fromFile.exists()) {
|
||||||
@@ -197,7 +201,7 @@ public class DespriteExperimentalConverter extends AbstractConverter {
|
|||||||
int[] emptyOverlayAlt = spriteArr.length > 5 ? (int[]) spriteArr[5] : null;
|
int[] emptyOverlayAlt = spriteArr.length > 5 ? (int[]) spriteArr[5] : null;
|
||||||
int[] emptyOverlay = spriteArr.length > 6 ? (int[]) spriteArr[6] : null;
|
int[] emptyOverlay = spriteArr.length > 6 ? (int[]) spriteArr[6] : null;
|
||||||
|
|
||||||
packConverter.log(String.format("Desprite %s (Experimental)", to));
|
context.log(String.format("Desprite %s (Experimental)", to));
|
||||||
|
|
||||||
BufferedImage spriteImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor));
|
BufferedImage spriteImage = ImageUtils.crop(fromImage, (x * factor), (y * factor), (width * factor), (height * factor));
|
||||||
|
|
||||||
@@ -217,4 +221,9 @@ public class DespriteExperimentalConverter extends AbstractConverter {
|
|||||||
|
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isExperimental() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class DestroyStageConverter extends AbstractConverter {
|
public class DestroyStageConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -62,9 +66,9 @@ public class DestroyStageConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -72,7 +76,7 @@ public class DestroyStageConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert destroy stage %s", from));
|
context.log(String.format("Convert destroy stage %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -30,11 +30,13 @@ import com.fasterxml.jackson.core.JsonParser;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.Graphics;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -42,6 +44,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
// @AutoService(Converter.class)
|
||||||
public class DialogConverter extends AbstractConverter {
|
public class DialogConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -77,11 +80,11 @@ public class DialogConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
int factorDetect = (int) this.data[1];
|
int factorDetect = (int) context.data()[1];
|
||||||
Object[] dialogs = (Object[]) this.data[2];
|
Object[] dialogs = (Object[]) context.data()[2];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
if (!fromFile.exists()) {
|
if (!fromFile.exists()) {
|
||||||
@@ -127,7 +130,7 @@ public class DialogConverter extends AbstractConverter {
|
|||||||
|
|
||||||
JsonNode metadata = mapper.readTree("{nineslice_size: " + mapper.writeValueAsString(toSizes) + ", base_size: [" + (toImage.getWidth() / factor) + ", " + (toImage.getHeight() / factor) + "]}");
|
JsonNode metadata = mapper.readTree("{nineslice_size: " + mapper.writeValueAsString(toSizes) + ", base_size: [" + (toImage.getWidth() / factor) + ", " + (toImage.getHeight() / factor) + "]}");
|
||||||
|
|
||||||
packConverter.log(String.format("Convert dialog %s (Experimental)", toPath));
|
context.log(String.format("Convert dialog %s (Experimental)", toPath));
|
||||||
|
|
||||||
ImageUtils.write(toImage, "png", storage.resolve(toPath + ".png").toFile());
|
ImageUtils.write(toImage, "png", storage.resolve(toPath + ".png").toFile());
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class DolphinConverter extends AbstractConverter {
|
public class DolphinConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,11 +57,11 @@ public class DolphinConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -65,7 +69,7 @@ public class DolphinConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert dolphin");
|
context.log("Convert dolphin");
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class DrownedConverter extends AbstractConverter {
|
public class DrownedConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,13 +57,13 @@ public class DrownedConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String overlay = (String) this.data[1];
|
String overlay = (String) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
File overlayFile = storage.resolve(overlay).toFile();
|
File overlayFile = storage.resolve(overlay).toFile();
|
||||||
@@ -68,7 +72,7 @@ public class DrownedConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert drowned");
|
context.log("Convert drowned");
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
BufferedImage overlayImage = ImageIO.read(overlayFile);
|
BufferedImage overlayImage = ImageIO.read(overlayFile);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class EnchantedItemGlintConverter extends AbstractConverter {
|
public class EnchantedItemGlintConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -52,9 +56,9 @@ public class EnchantedItemGlintConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -62,7 +66,7 @@ public class EnchantedItemGlintConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert enchanted item glint %s", from));
|
context.log(String.format("Convert enchanted item glint %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class FireworksConverter extends AbstractConverter {
|
public class FireworksConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,12 +57,12 @@ public class FireworksConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@ public class FireworksConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert fireworks");
|
context.log("Convert fireworks");
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class FishHookConverter extends AbstractConverter {
|
public class FishHookConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,12 +57,12 @@ public class FishHookConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -66,7 +70,7 @@ public class FishHookConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert fishhook");
|
context.log("Convert fishhook");
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,8 +26,11 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -35,6 +38,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class FixWrongRootFolderConverter extends AbstractConverter {
|
public class FixWrongRootFolderConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -49,16 +53,16 @@ public class FixWrongRootFolderConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String packMcmeta = (String) this.data[0];
|
String packMcmeta = (String) context.data()[0];
|
||||||
String[] moveFiles = (String[]) this.data[1];
|
String[] moveFiles = (String[]) context.data()[1];
|
||||||
|
|
||||||
if (storage.resolve(packMcmeta).toFile().exists()) {
|
if (storage.resolve(packMcmeta).toFile().exists()) {
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("%s not found in root folder (But are needed in the root folder, even in the Java version) - Try to lookup in sub folders ...", packMcmeta));
|
context.log(String.format("%s not found in root folder (But are needed in the root folder, even in the Java version) - Try to lookup in sub folders ...", packMcmeta));
|
||||||
|
|
||||||
Path rootPath = null;
|
Path rootPath = null;
|
||||||
for (Path filePath : Files.walk(storage).filter(Files::isRegularFile).collect(Collectors.toList())) {
|
for (Path filePath : Files.walk(storage).filter(Files::isRegularFile).collect(Collectors.toList())) {
|
||||||
@@ -72,7 +76,7 @@ public class FixWrongRootFolderConverter extends AbstractConverter {
|
|||||||
throw new AssertionError(String.format("%s not found! Is this really a Java texture pack?", packMcmeta));
|
throw new AssertionError(String.format("%s not found! Is this really a Java texture pack?", packMcmeta));
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Root folder found in sub folder %s", rootPath.relativize(storage).toString()));
|
context.log(String.format("Root folder found in sub folder %s", rootPath.relativize(storage).toString()));
|
||||||
|
|
||||||
List<String> moveFilesList = new ArrayList<>();
|
List<String> moveFilesList = new ArrayList<>();
|
||||||
moveFilesList.add(packMcmeta);
|
moveFilesList.add(packMcmeta);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class FoxConverter extends AbstractConverter {
|
public class FoxConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -54,13 +58,13 @@ public class FoxConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String fromSleep = (String) this.data[1];
|
String fromSleep = (String) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
File fromSleepFile = storage.resolve(fromSleep).toFile();
|
File fromSleepFile = storage.resolve(fromSleep).toFile();
|
||||||
@@ -69,7 +73,7 @@ public class FoxConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert fox %s", to));
|
context.log(String.format("Convert fox %s", to));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
BufferedImage fromSleepImage = ImageIO.read(fromSleepFile);
|
BufferedImage fromSleepImage = ImageIO.read(fromSleepFile);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class HorseConverter extends AbstractConverter {
|
public class HorseConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -71,12 +75,12 @@ public class HorseConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -84,7 +88,7 @@ public class HorseConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert horse %s", to));
|
context.log(String.format("Convert horse %s", to));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class IconsConverter extends AbstractConverter {
|
public class IconsConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,9 +57,9 @@ public class IconsConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File iconsFile = storage.resolve(from).toFile();
|
File iconsFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ public class IconsConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert icons %s", from));
|
context.log(String.format("Convert icons %s", from));
|
||||||
|
|
||||||
BufferedImage iconsImage = ImageIO.read(iconsFile);
|
BufferedImage iconsImage = ImageIO.read(iconsFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class MapIconsConverter extends AbstractConverter {
|
public class MapIconsConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,10 +57,10 @@ public class MapIconsConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File iconsFile = storage.resolve(from).toFile();
|
File iconsFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -64,7 +68,7 @@ public class MapIconsConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert map icons %s", to));
|
context.log(String.format("Convert map icons %s", to));
|
||||||
|
|
||||||
BufferedImage iconsImage = ImageIO.read(iconsFile);
|
BufferedImage iconsImage = ImageIO.read(iconsFile);
|
||||||
|
|
||||||
@@ -31,13 +31,16 @@ import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
|
|||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
import com.fasterxml.jackson.databind.ObjectWriter;
|
import com.fasterxml.jackson.databind.ObjectWriter;
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import com.google.gson.JsonSyntaxException;
|
import com.google.gson.JsonSyntaxException;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
|
||||||
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ResourcePackManifest;
|
import org.geysermc.packconverter.utils.ResourcePackManifest;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@@ -47,6 +50,7 @@ import java.util.Collection;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class MetadataConverter extends AbstractConverter {
|
public class MetadataConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -61,14 +65,14 @@ public class MetadataConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
packConverter.log(String.format("Create metadata %s", to));
|
context.log(String.format("Create metadata %s", to));
|
||||||
|
|
||||||
if (!storage.resolve(from).toFile().exists()) {
|
if (!storage.resolve(from).toFile().exists()) {
|
||||||
throw new FileNotFoundException(String.format("Missing %s! Is this really a Java texture pack?", from));
|
throw new FileNotFoundException(String.format("Missing %s! Is this really a Java texture pack?", from));
|
||||||
@@ -29,9 +29,12 @@ package org.geysermc.packconverter.converters;
|
|||||||
import com.fasterxml.jackson.core.JsonParser;
|
import com.fasterxml.jackson.core.JsonParser;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -41,6 +44,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class NineSliceConverter extends AbstractConverter {
|
public class NineSliceConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -240,12 +244,12 @@ public class NineSliceConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
int factorDetect = (int) this.data[1];
|
int factorDetect = (int) context.data()[1];
|
||||||
Object[] buttons = (Object[]) this.data[2];
|
Object[] buttons = (Object[]) context.data()[2];
|
||||||
String[] borders = (String[]) this.data[3];
|
String[] borders = (String[]) context.data()[3];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
if (!fromFile.exists()) {
|
if (!fromFile.exists()) {
|
||||||
@@ -275,7 +279,7 @@ public class NineSliceConverter extends AbstractConverter {
|
|||||||
JsonNode metadata = mapper.readTree("{nineslice_size: " + size + ", base_size: [" + width + ", " + height + "]}");
|
JsonNode metadata = mapper.readTree("{nineslice_size: " + size + ", base_size: [" + width + ", " + height + "]}");
|
||||||
|
|
||||||
for (String toPath : tos) {
|
for (String toPath : tos) {
|
||||||
packConverter.log(String.format("Convert button %s (Experimental)", toPath));
|
context.log(String.format("Convert button %s (Experimental)", toPath));
|
||||||
|
|
||||||
ImageUtils.write(toImage, "png", storage.resolve(toPath + ".png").toFile());
|
ImageUtils.write(toImage, "png", storage.resolve(toPath + ".png").toFile());
|
||||||
|
|
||||||
@@ -286,7 +290,7 @@ public class NineSliceConverter extends AbstractConverter {
|
|||||||
BufferedImage transparentImage = new BufferedImage(factor, factor, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage transparentImage = new BufferedImage(factor, factor, BufferedImage.TYPE_INT_ARGB);
|
||||||
JsonNode metadata = mapper.readTree("{nineslice_size: 0, base_size: [1, 1]}");
|
JsonNode metadata = mapper.readTree("{nineslice_size: 0, base_size: [1, 1]}");
|
||||||
for (String border : borders) {
|
for (String border : borders) {
|
||||||
packConverter.log(String.format("Convert button %s (Experimental)", border));
|
context.log(String.format("Convert button %s (Experimental)", border));
|
||||||
|
|
||||||
ImageUtils.write(transparentImage, "png", storage.resolve(border + ".png").toFile());
|
ImageUtils.write(transparentImage, "png", storage.resolve(border + ".png").toFile());
|
||||||
|
|
||||||
@@ -297,4 +301,9 @@ public class NineSliceConverter extends AbstractConverter {
|
|||||||
|
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isExperimental() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class OpaqueConverter extends AbstractConverter {
|
public class OpaqueConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -59,10 +63,10 @@ public class OpaqueConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -70,7 +74,7 @@ public class OpaqueConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create opaque %s", to));
|
context.log(String.format("Create opaque %s", to));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class OverlayToTranslateConverter extends AbstractConverter {
|
public class OverlayToTranslateConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -92,15 +96,15 @@ public class OverlayToTranslateConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String overlay = (String) this.data[1];
|
String overlay = (String) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
boolean reverse = (boolean) this.data[3];
|
boolean reverse = (boolean) context.data()[3];
|
||||||
boolean dontDelete = this.data.length > 4 && (boolean) this.data[4];
|
boolean dontDelete = context.data().length > 4 && (boolean) context.data()[4];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
File overlayFile = storage.resolve(overlay).toFile();
|
File overlayFile = storage.resolve(overlay).toFile();
|
||||||
@@ -109,7 +113,7 @@ public class OverlayToTranslateConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create translated overlay %s", to));
|
context.log(String.format("Create translated overlay %s", to));
|
||||||
|
|
||||||
BufferedImage image = ImageIO.read(fromFile);
|
BufferedImage image = ImageIO.read(fromFile);
|
||||||
BufferedImage imageOverlay = ImageIO.read(overlayFile);
|
BufferedImage imageOverlay = ImageIO.read(overlayFile);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class Particles1_13Converter extends AbstractConverter {
|
public class Particles1_13Converter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -52,10 +56,10 @@ public class Particles1_13Converter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ public class Particles1_13Converter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert particles %s", from));
|
context.log(String.format("Convert particles %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class PistonArmConverter extends AbstractConverter {
|
public class PistonArmConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -54,14 +58,14 @@ public class PistonArmConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String top1 = (String) this.data[0];
|
String top1 = (String) context.data()[0];
|
||||||
String top2 = (String) this.data[1];
|
String top2 = (String) context.data()[1];
|
||||||
String side = (String) this.data[2];
|
String side = (String) context.data()[2];
|
||||||
String to = (String) this.data[3];
|
String to = (String) context.data()[3];
|
||||||
|
|
||||||
File top1File = storage.resolve(top1).toFile();
|
File top1File = storage.resolve(top1).toFile();
|
||||||
File top2File = storage.resolve(top2).toFile();
|
File top2File = storage.resolve(top2).toFile();
|
||||||
@@ -71,7 +75,7 @@ public class PistonArmConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create piston arm %s", to));
|
context.log(String.format("Create piston arm %s", to));
|
||||||
|
|
||||||
BufferedImage top1Image = ImageIO.read(top1File);
|
BufferedImage top1Image = ImageIO.read(top1File);
|
||||||
BufferedImage top2Image = ImageIO.read(top2File);
|
BufferedImage top2Image = ImageIO.read(top2File);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class PlaceholderConverter extends AbstractConverter {
|
public class PlaceholderConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -130,17 +134,17 @@ public class PlaceholderConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
int x = (int) this.data[1];
|
int x = (int) context.data()[1];
|
||||||
int y = (int) this.data[2];
|
int y = (int) context.data()[2];
|
||||||
int width = (int) this.data[3];
|
int width = (int) context.data()[3];
|
||||||
int height = (int) this.data[4];
|
int height = (int) context.data()[4];
|
||||||
int factorDetect = (int) this.data[5];
|
int factorDetect = (int) context.data()[5];
|
||||||
String to = (String) this.data[6];
|
String to = (String) context.data()[6];
|
||||||
int squareMode = this.data.length > 7 ? (int) this.data[7] : 0;
|
int squareMode = context.data().length > 7 ? (int) context.data()[7] : 0;
|
||||||
int minPackFormat = this.data.length > 8 ? (int) this.data[8] : -1;
|
int minPackFormat = context.data().length > 8 ? (int) context.data()[8] : -1;
|
||||||
|
|
||||||
if (minPackFormat > -1) {
|
if (minPackFormat > -1) {
|
||||||
// TODO: Add support for min pack format
|
// TODO: Add support for min pack format
|
||||||
@@ -152,7 +156,7 @@ public class PlaceholderConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create placeholder %s", to));
|
context.log(String.format("Create placeholder %s", to));
|
||||||
|
|
||||||
BufferedImage placeholderImage = ImageUtils.ensureMinWidth(ImageIO.read(placeholderFile), factorDetect);
|
BufferedImage placeholderImage = ImageUtils.ensureMinWidth(ImageIO.read(placeholderFile), factorDetect);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class PngToTgaConverter extends AbstractConverter {
|
public class PngToTgaConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -200,13 +204,13 @@ public class PngToTgaConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
boolean dont_delete = this.data.length > 2 ? (boolean) this.data[2] : false;
|
boolean dont_delete = context.data().length > 2 ? (boolean) context.data()[2] : false;
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -214,7 +218,7 @@ public class PngToTgaConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create tga %s", from));
|
context.log(String.format("Create tga %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
ImageUtils.write(fromImage, "tga", storage.resolve(to).toFile());
|
ImageUtils.write(fromImage, "tga", storage.resolve(to).toFile());
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class RedstoneDustConverter extends AbstractConverter {
|
public class RedstoneDustConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -52,15 +56,15 @@ public class RedstoneDustConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String dot = (String) this.data[0];
|
String dot = (String) context.data()[0];
|
||||||
String line0 = (String) this.data[1];
|
String line0 = (String) context.data()[1];
|
||||||
String line1 = (String) this.data[2];
|
String line1 = (String) context.data()[2];
|
||||||
String to_cross = (String) this.data[3];
|
String to_cross = (String) context.data()[3];
|
||||||
String to_line = (String) this.data[4];
|
String to_line = (String) context.data()[4];
|
||||||
|
|
||||||
File dotFile = storage.resolve(dot).toFile();
|
File dotFile = storage.resolve(dot).toFile();
|
||||||
File line0File = storage.resolve(line0).toFile();
|
File line0File = storage.resolve(line0).toFile();
|
||||||
@@ -70,7 +74,7 @@ public class RedstoneDustConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert redstone dust");
|
context.log("Convert redstone dust");
|
||||||
|
|
||||||
BufferedImage newImage = ImageIO.read(line0File);
|
BufferedImage newImage = ImageIO.read(line0File);
|
||||||
newImage = ImageUtils.rotate(newImage, 90);
|
newImage = ImageUtils.rotate(newImage, 90);
|
||||||
@@ -26,8 +26,11 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
@@ -35,6 +38,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class RenameConverter extends AbstractConverter {
|
public class RenameConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -1064,10 +1068,10 @@ public class RenameConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
Path fromPath = storage.resolve(from);
|
Path fromPath = storage.resolve(from);
|
||||||
|
|
||||||
@@ -1075,7 +1079,7 @@ public class RenameConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Rename %s to %s", from, to));
|
context.log(String.format("Rename %s to %s", from, to));
|
||||||
|
|
||||||
Files.move(fromPath, storage.resolve(to));
|
Files.move(fromPath, storage.resolve(to));
|
||||||
} catch (IOException e) { }
|
} catch (IOException e) { }
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class SheepConverter extends AbstractConverter {
|
public class SheepConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,12 +57,12 @@ public class SheepConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String sheep = (String) this.data[0];
|
String sheep = (String) context.data()[0];
|
||||||
String sheepFur = (String) this.data[1];
|
String sheepFur = (String) context.data()[1];
|
||||||
|
|
||||||
File sheepFile = storage.resolve(sheep).toFile();
|
File sheepFile = storage.resolve(sheep).toFile();
|
||||||
File sheepFurFile = storage.resolve(sheepFur).toFile();
|
File sheepFurFile = storage.resolve(sheepFur).toFile();
|
||||||
@@ -67,7 +71,7 @@ public class SheepConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert sheep");
|
context.log("Convert sheep");
|
||||||
|
|
||||||
BufferedImage sheepImage = ImageIO.read(sheepFile);
|
BufferedImage sheepImage = ImageIO.read(sheepFile);
|
||||||
BufferedImage sheepFurImage = ImageIO.read(sheepFurFile);
|
BufferedImage sheepFurImage = ImageIO.read(sheepFurFile);
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class SideRotateConverter extends AbstractConverter {
|
public class SideRotateConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -54,10 +58,10 @@ public class SideRotateConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -65,7 +69,7 @@ public class SideRotateConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Create side rotate %s", from));
|
context.log(String.format("Create side rotate %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class SpriteConverter extends AbstractConverter {
|
public class SpriteConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -274,15 +278,15 @@ public class SpriteConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
int width = (int) this.data[0];
|
int width = (int) context.data()[0];
|
||||||
int height = (int) this.data[1];
|
int height = (int) context.data()[1];
|
||||||
Object[] sprites = (Object[]) this.data[2];
|
Object[] sprites = (Object[]) context.data()[2];
|
||||||
String to = (String) this.data[3];
|
String to = (String) context.data()[3];
|
||||||
int additional_factor = this.data.length > 4 ? (int) this.data[4] : 1;
|
int additional_factor = context.data().length > 4 ? (int) context.data()[4] : 1;
|
||||||
|
|
||||||
File toFile = storage.resolve(to).toFile();
|
File toFile = storage.resolve(to).toFile();
|
||||||
|
|
||||||
@@ -291,7 +295,7 @@ public class SpriteConverter extends AbstractConverter {
|
|||||||
List<String> missingSprites = new ArrayList<>();
|
List<String> missingSprites = new ArrayList<>();
|
||||||
|
|
||||||
if (toFile.exists()) {
|
if (toFile.exists()) {
|
||||||
packConverter.log(String.format("Convert sprite %s", to));
|
context.log(String.format("Convert sprite %s", to));
|
||||||
|
|
||||||
newImage = ImageIO.read(toFile); // Load already exists sprites image - Some texture packs have may a mix with sprites (1.13) and separate images (1.14)
|
newImage = ImageIO.read(toFile); // Load already exists sprites image - Some texture packs have may a mix with sprites (1.13) and separate images (1.14)
|
||||||
|
|
||||||
@@ -319,7 +323,7 @@ public class SpriteConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (newImage == null) {
|
if (newImage == null) {
|
||||||
packConverter.log(String.format("Create sprite %s", to));
|
context.log(String.format("Create sprite %s", to));
|
||||||
|
|
||||||
newImage = new BufferedImage((width * factor), (height * factor), BufferedImage.TYPE_INT_ARGB);
|
newImage = new BufferedImage((width * factor), (height * factor), BufferedImage.TYPE_INT_ARGB);
|
||||||
}
|
}
|
||||||
@@ -338,7 +342,7 @@ public class SpriteConverter extends AbstractConverter {
|
|||||||
|
|
||||||
if (newImage != null) {
|
if (newImage != null) {
|
||||||
for (String sprite : missingSprites) {
|
for (String sprite : missingSprites) {
|
||||||
packConverter.log(String.format("Missing texture %s - May used a transparent image", sprite));
|
context.log(String.format("Missing texture %s - May used a transparent image", sprite));
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageUtils.write(newImage, "png", storage.resolve(to).toFile());
|
ImageUtils.write(newImage, "png", storage.resolve(to).toFile());
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class TitleConverter extends AbstractConverter {
|
public class TitleConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,10 +57,10 @@ public class TitleConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -64,7 +68,7 @@ public class TitleConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert title %s", from));
|
context.log(String.format("Convert title %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class TurtleConverter extends AbstractConverter {
|
public class TurtleConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -53,9 +57,9 @@ public class TurtleConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -63,7 +67,7 @@ public class TurtleConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert turtle %s", from));
|
context.log(String.format("Convert turtle %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class VillagerConverter extends AbstractConverter {
|
public class VillagerConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -81,9 +85,9 @@ public class VillagerConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
|
|
||||||
File fromFile = storage.resolve(from).toFile();
|
File fromFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -91,7 +95,7 @@ public class VillagerConverter extends AbstractConverter {
|
|||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert villager %s", from));
|
context.log(String.format("Convert villager %s", from));
|
||||||
|
|
||||||
BufferedImage fromImage = ImageIO.read(fromFile);
|
BufferedImage fromImage = ImageIO.read(fromFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
@@ -38,6 +41,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class WaterConverter extends AbstractConverter {
|
public class WaterConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -55,14 +59,14 @@ public class WaterConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
String from = (String) context.data()[0];
|
||||||
String to = (String) this.data[1];
|
String to = (String) context.data()[1];
|
||||||
int minWidth = (int) this.data[2];
|
int minWidth = (int) context.data()[2];
|
||||||
boolean grayscale = this.data.length > 3 ? (boolean) this.data[3] : false;
|
boolean grayscale = context.data().length > 3 ? (boolean) context.data()[3] : false;
|
||||||
|
|
||||||
File waterFile = storage.resolve(from).toFile();
|
File waterFile = storage.resolve(from).toFile();
|
||||||
|
|
||||||
@@ -70,7 +74,7 @@ public class WaterConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log(String.format("Convert water %s", from));
|
context.log(String.format("Convert water %s", from));
|
||||||
|
|
||||||
BufferedImage waterImage = ImageIO.read(waterFile);
|
BufferedImage waterImage = ImageIO.read(waterFile);
|
||||||
|
|
||||||
@@ -26,9 +26,12 @@
|
|||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters;
|
||||||
|
|
||||||
|
import com.google.auto.service.AutoService;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
import org.geysermc.packconverter.utils.ImageUtils;
|
import org.geysermc.packconverter.utils.ImageUtils;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
@@ -39,6 +42,7 @@ import java.nio.file.Path;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
@AutoService(Converter.class)
|
||||||
public class WeatherConverter extends AbstractConverter {
|
public class WeatherConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -54,13 +58,13 @@ public class WeatherConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public List<AbstractConverter> convert(@NotNull PackConversionContext context) {
|
||||||
List<AbstractConverter> delete = new ArrayList<>();
|
List<AbstractConverter> delete = new ArrayList<>();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
String snow = (String) this.data[0];
|
String snow = (String) context.data()[0];
|
||||||
String rain = (String) this.data[1];
|
String rain = (String) context.data()[1];
|
||||||
String to = (String) this.data[2];
|
String to = (String) context.data()[2];
|
||||||
|
|
||||||
File snowFile = storage.resolve(snow).toFile();
|
File snowFile = storage.resolve(snow).toFile();
|
||||||
File rainFile = storage.resolve(rain).toFile();
|
File rainFile = storage.resolve(rain).toFile();
|
||||||
@@ -69,7 +73,7 @@ public class WeatherConverter extends AbstractConverter {
|
|||||||
return delete;
|
return delete;
|
||||||
}
|
}
|
||||||
|
|
||||||
packConverter.log("Convert weather");
|
context.log("Convert weather");
|
||||||
|
|
||||||
BufferedImage snowImage = ImageIO.read(snowFile);
|
BufferedImage snowImage = ImageIO.read(snowFile);
|
||||||
BufferedImage rainImage = ImageIO.read(rainFile);
|
BufferedImage rainImage = ImageIO.read(rainFile);
|
||||||
@@ -24,7 +24,7 @@
|
|||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package org.geysermc.packconverter.converters;
|
package org.geysermc.packconverter.converters.custom;
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
|
import com.fasterxml.jackson.core.util.DefaultPrettyPrinter;
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
import com.fasterxml.jackson.databind.JsonNode;
|
||||||
@@ -33,16 +33,22 @@ import com.fasterxml.jackson.databind.node.ObjectNode;
|
|||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
import org.geysermc.packconverter.PackConversionContext;
|
||||||
import org.geysermc.packconverter.PackConverter;
|
import org.geysermc.packconverter.PackConverter;
|
||||||
|
import org.geysermc.packconverter.converters.AbstractConverter;
|
||||||
import org.geysermc.packconverter.utils.CustomModelDataHandler;
|
import org.geysermc.packconverter.utils.CustomModelDataHandler;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.OutputStream;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.StandardOpenOption;
|
import java.nio.file.StandardOpenOption;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
// @AutoService(Converter.class)
|
||||||
public class CustomModelDataConverter extends AbstractConverter {
|
public class CustomModelDataConverter extends AbstractConverter {
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@@ -52,16 +58,14 @@ public class CustomModelDataConverter extends AbstractConverter {
|
|||||||
defaultData.add(new String[] {"assets/minecraft/models/item", "textures/item_texture.json"});
|
defaultData.add(new String[] {"assets/minecraft/models/item", "textures/item_texture.json"});
|
||||||
}
|
}
|
||||||
|
|
||||||
public CustomModelDataConverter(PackConverter packConverter, Path storage, Object[] data) {
|
|
||||||
super(packConverter, storage, data);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AbstractConverter> convert() {
|
public void convert(@NotNull PackConversionContext context) {
|
||||||
packConverter.log("Checking for custom model data");
|
context.log("Checking for custom model data");
|
||||||
try {
|
try {
|
||||||
String from = (String) this.data[0];
|
PackConverter packConverter = context.packConverter();
|
||||||
String to = (String) this.data[1];
|
|
||||||
|
String from = (String) context.data()[0];
|
||||||
|
String to = (String) context.data()[1];
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
ObjectMapper mapper = new ObjectMapper();
|
||||||
|
|
||||||
@@ -70,7 +74,7 @@ public class CustomModelDataConverter extends AbstractConverter {
|
|||||||
textureData.put("resource_pack_name", "geysercmd");
|
textureData.put("resource_pack_name", "geysercmd");
|
||||||
textureData.put("texture_name", "atlas.items");
|
textureData.put("texture_name", "atlas.items");
|
||||||
ObjectNode allTextures = mapper.createObjectNode();
|
ObjectNode allTextures = mapper.createObjectNode();
|
||||||
for (File file : storage.resolve(from).toFile().listFiles()) {
|
for (File file : context.storage().resolve(from).toFile().listFiles()) {
|
||||||
InputStream stream = new FileInputStream(file);
|
InputStream stream = new FileInputStream(file);
|
||||||
|
|
||||||
JsonNode node = mapper.readTree(stream);
|
JsonNode node = mapper.readTree(stream);
|
||||||
@@ -83,7 +87,7 @@ public class CustomModelDataConverter extends AbstractConverter {
|
|||||||
// You need to run in Java `/give @s stick{CustomModelData:1}`
|
// You need to run in Java `/give @s stick{CustomModelData:1}`
|
||||||
int id = predicate.get("custom_model_data").asInt();
|
int id = predicate.get("custom_model_data").asInt();
|
||||||
// Get the identifier that we'll register the item with on Bedrock, and create the JSON file
|
// Get the identifier that we'll register the item with on Bedrock, and create the JSON file
|
||||||
String identifier = CustomModelDataHandler.handleItemData(mapper, storage, override.get("model").asText());
|
String identifier = CustomModelDataHandler.handleItemData(mapper, context.storage(), override.get("model").asText());
|
||||||
// See if we have registered the vanilla item already
|
// See if we have registered the vanilla item already
|
||||||
Int2ObjectMap<String> data = packConverter.getCustomModelData().getOrDefault(file.getName().replace(".json", ""), null);
|
Int2ObjectMap<String> data = packConverter.getCustomModelData().getOrDefault(file.getName().replace(".json", ""), null);
|
||||||
if (data == null) {
|
if (data == null) {
|
||||||
@@ -98,7 +102,7 @@ public class CustomModelDataConverter extends AbstractConverter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create the texture information
|
// Create the texture information
|
||||||
ObjectNode textureInfo = CustomModelDataHandler.handleItemTexture(mapper, storage, override.get("model").asText());
|
ObjectNode textureInfo = CustomModelDataHandler.handleItemTexture(mapper, context.storage(), override.get("model").asText());
|
||||||
if (textureInfo != null) {
|
if (textureInfo != null) {
|
||||||
// If texture was created, add it to the file where Bedrock will read all textures
|
// If texture was created, add it to the file where Bedrock will read all textures
|
||||||
allTextures.setAll(textureInfo);
|
allTextures.setAll(textureInfo);
|
||||||
@@ -112,14 +116,12 @@ public class CustomModelDataConverter extends AbstractConverter {
|
|||||||
|
|
||||||
if (!packConverter.getCustomModelData().isEmpty()) {
|
if (!packConverter.getCustomModelData().isEmpty()) {
|
||||||
// We have custom model data, so let's write the textures
|
// We have custom model data, so let's write the textures
|
||||||
OutputStream outputStream = Files.newOutputStream(storage.resolve(to), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
|
OutputStream outputStream = Files.newOutputStream(context.storage().resolve(to), StandardOpenOption.TRUNCATE_EXISTING, StandardOpenOption.CREATE);
|
||||||
mapper.writer(new DefaultPrettyPrinter()).writeValue(outputStream, textureData);
|
mapper.writer(new DefaultPrettyPrinter()).writeValue(outputStream, textureData);
|
||||||
}
|
}
|
||||||
packConverter.log(String.format("Converted models %s", from));
|
context.log(String.format("Converted models %s", from));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ArrayList<>();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
5
pack-schema/api/build.gradle.kts
Normal file
5
pack-schema/api/build.gradle.kts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
dependencies {
|
||||||
|
api(project(":bedrock-pack-schema"))
|
||||||
|
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2")
|
||||||
|
implementation("org.jetbrains:annotations:24.0.1")
|
||||||
|
}
|
||||||
@@ -0,0 +1,227 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.bedrock.resource;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import com.fasterxml.jackson.databind.SerializationFeature;
|
||||||
|
import org.geysermc.pack.bedrock.resource.attachables.Attachables;
|
||||||
|
import org.geysermc.pack.bedrock.resource.textures.ItemTexture;
|
||||||
|
import org.geysermc.pack.bedrock.resource.textures.TerrainTexture;
|
||||||
|
import org.geysermc.pack.bedrock.resource.textures.itemtexture.TextureData;
|
||||||
|
import org.geysermc.pack.bedrock.resource.textures.terraintexture.texturedata.Textures;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import static org.geysermc.pack.bedrock.resource.util.FileUtil.exportJson;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Represents a Bedrock resource pack.
|
||||||
|
*/
|
||||||
|
public class BedrockResourcePack {
|
||||||
|
private static final ObjectMapper MAPPER = new ObjectMapper()
|
||||||
|
.enable(SerializationFeature.INDENT_OUTPUT)
|
||||||
|
.setSerializationInclusion(JsonInclude.Include.NON_NULL)
|
||||||
|
.setSerializationInclusion(JsonInclude.Include.NON_EMPTY);
|
||||||
|
|
||||||
|
private final Path directory;
|
||||||
|
private Manifest manifest;
|
||||||
|
|
||||||
|
private ItemTexture itemTexture;
|
||||||
|
private TerrainTexture terrainTexture;
|
||||||
|
private Map<String, Attachables> attachables;
|
||||||
|
|
||||||
|
public BedrockResourcePack(@NotNull Path directory) {
|
||||||
|
this(directory, null, null, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BedrockResourcePack(@NotNull Path directory, @Nullable Manifest manifest, @Nullable ItemTexture itemTexture, @Nullable TerrainTexture terrainTexture) {
|
||||||
|
this.directory = directory;
|
||||||
|
this.manifest = manifest;
|
||||||
|
this.itemTexture = itemTexture;
|
||||||
|
this.terrainTexture = terrainTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the manifest of the resource pack.
|
||||||
|
*
|
||||||
|
* @return the manifest of the resource pack
|
||||||
|
*/
|
||||||
|
@NotNull
|
||||||
|
public Manifest manifest() {
|
||||||
|
return this.manifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the manifest of the resource pack.
|
||||||
|
*
|
||||||
|
* @param manifest the manifest of the resource pack
|
||||||
|
*/
|
||||||
|
public void manifest(@NotNull Manifest manifest) {
|
||||||
|
this.manifest = manifest;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the item texture of the resource pack.
|
||||||
|
*
|
||||||
|
* @return the item texture of the resource pack
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public ItemTexture itemTexture() {
|
||||||
|
return this.itemTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the item texture of the resource pack.
|
||||||
|
*
|
||||||
|
* @param itemTexture the item texture of the resource pack
|
||||||
|
*/
|
||||||
|
public void itemTexture(@Nullable ItemTexture itemTexture) {
|
||||||
|
this.itemTexture = itemTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the terrain texture of the resource pack.
|
||||||
|
*
|
||||||
|
* @return the terrain texture of the resource pack
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public TerrainTexture terrainTexture() {
|
||||||
|
return this.terrainTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the terrain texture of the resource pack.
|
||||||
|
*
|
||||||
|
* @param terrainTexture the terrain texture of the resource pack
|
||||||
|
*/
|
||||||
|
public void terrainTexture(@Nullable TerrainTexture terrainTexture) {
|
||||||
|
this.terrainTexture = terrainTexture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the attachables of the resource pack.
|
||||||
|
*
|
||||||
|
* @return the attachables of the resource pack
|
||||||
|
*/
|
||||||
|
@Nullable
|
||||||
|
public Map<String, Attachables> attachables() {
|
||||||
|
return this.attachables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the attachables of the resource pack.
|
||||||
|
*
|
||||||
|
* @param attachables the attachables of the resource pack
|
||||||
|
*/
|
||||||
|
public void attachables(@Nullable Map<String, Attachables> attachables) {
|
||||||
|
this.attachables = attachables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an item to the resource pack.
|
||||||
|
*
|
||||||
|
* @param id the id of the item
|
||||||
|
* @param textureLocation the location of the texture
|
||||||
|
*/
|
||||||
|
public void addItemTexture(@NotNull String id, @NotNull String textureLocation) {
|
||||||
|
if (this.itemTexture == null) {
|
||||||
|
this.itemTexture = new ItemTexture();
|
||||||
|
this.itemTexture.resourcePackName(this.manifest.header().name());
|
||||||
|
this.itemTexture.textureName("atlas.items");
|
||||||
|
}
|
||||||
|
|
||||||
|
TextureData data = new TextureData();
|
||||||
|
data.textures(textureLocation);
|
||||||
|
|
||||||
|
this.itemTexture.textureData().put(id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a block texture to the resource pack.
|
||||||
|
*
|
||||||
|
* @param id the id of the block texture
|
||||||
|
* @param textureLocation the location of the texture
|
||||||
|
*/
|
||||||
|
public void addBlockTexture(@NotNull String id, @NotNull String textureLocation) {
|
||||||
|
if (this.terrainTexture == null) {
|
||||||
|
this.terrainTexture = new TerrainTexture();
|
||||||
|
this.terrainTexture.resourcePackName(this.manifest.header().name());
|
||||||
|
this.terrainTexture.textureName("atlas.terrain");
|
||||||
|
this.terrainTexture.padding(8);
|
||||||
|
this.terrainTexture.numMipLevels(4);
|
||||||
|
}
|
||||||
|
|
||||||
|
org.geysermc.pack.bedrock.resource.textures.terraintexture.TextureData data = new org.geysermc.pack.bedrock.resource.textures.terraintexture.TextureData();
|
||||||
|
Textures textures = new Textures();
|
||||||
|
textures.path(textureLocation);
|
||||||
|
data.textures(textures);
|
||||||
|
|
||||||
|
this.terrainTexture.textureData().put(id, data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add an attachable to the resource pack.
|
||||||
|
*
|
||||||
|
* @param armorAttachable the data of the attachable
|
||||||
|
* @param location the location of the final json
|
||||||
|
*/
|
||||||
|
public void addAttachable(@NotNull Attachables armorAttachable, @NotNull String location) {
|
||||||
|
if (this.attachables == null) {
|
||||||
|
this.attachables = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.attachables.put(location, armorAttachable);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the resource pack to the specified directory.
|
||||||
|
*
|
||||||
|
* @throws IOException if an error occurs while exporting the resource pack
|
||||||
|
*/
|
||||||
|
public void export() throws IOException {
|
||||||
|
if (this.manifest == null) {
|
||||||
|
throw new NullPointerException("Pack manifest cannot be null");
|
||||||
|
}
|
||||||
|
|
||||||
|
exportJson(MAPPER, this.directory.resolve("manifest.json"), this.manifest);
|
||||||
|
|
||||||
|
if (this.itemTexture != null) {
|
||||||
|
exportJson(MAPPER, this.directory.resolve("textures/item_texture.json"), this.itemTexture);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.terrainTexture != null) {
|
||||||
|
exportJson(MAPPER, this.directory.resolve("textures/terrain_texture.json"), this.terrainTexture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,63 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2019-2023 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.bedrock.resource.util;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
|
import java.io.BufferedWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Utility class for files.
|
||||||
|
*/
|
||||||
|
public class FileUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Exports the specified object to the given location as JSON.
|
||||||
|
*
|
||||||
|
* @param mapper the object mapper to use
|
||||||
|
* @param location the location to export the object to
|
||||||
|
* @param object the object to export
|
||||||
|
* @throws IOException if an I/O error occurs
|
||||||
|
*/
|
||||||
|
public static void exportJson(@NotNull ObjectMapper mapper, @NotNull Path location, @NotNull Object object) throws IOException {
|
||||||
|
if (Files.notExists(location.getParent())) {
|
||||||
|
Files.createDirectories(location.getParent());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Files.notExists(location)) {
|
||||||
|
Files.createFile(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
try (BufferedWriter writer = Files.newBufferedWriter(location)) {
|
||||||
|
mapper.writeValue(writer, object);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
4
pack-schema/bedrock/README.md
Normal file
4
pack-schema/bedrock/README.md
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# Bedrock Pack Schema
|
||||||
|
The Java classes in this module are auto-generated from the `generator` module. **No changes should be made in this module as they will be overridden.**
|
||||||
|
|
||||||
|
The JSON schema used to construct these Java objects can be found at [Blockception/Minecraft-bedrock-json-schemas](https://github.com/Blockception/Minecraft-bedrock-json-schemas)
|
||||||
3
pack-schema/bedrock/build.gradle.kts
Normal file
3
pack-schema/bedrock/build.gradle.kts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
dependencies {
|
||||||
|
implementation("com.fasterxml.jackson.core:jackson-databind:2.14.2")
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource;
|
||||||
|
|
||||||
|
import org.geysermc.pack.bedrock.resource.biomesclient.Biomes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biomes Client
|
||||||
|
* <p>
|
||||||
|
* The minecraft biomes definition file.
|
||||||
|
*/
|
||||||
|
public class BiomesClient {
|
||||||
|
public Biomes biomes;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of predefined biomes.
|
||||||
|
*
|
||||||
|
* @return Biomes
|
||||||
|
*/
|
||||||
|
public Biomes biomes() {
|
||||||
|
return this.biomes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of predefined biomes.
|
||||||
|
*
|
||||||
|
* @param biomes Biomes
|
||||||
|
*/
|
||||||
|
public void biomes(Biomes biomes) {
|
||||||
|
this.biomes = biomes;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,107 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import org.geysermc.pack.bedrock.resource.blocks.CarriedTextures;
|
||||||
|
import org.geysermc.pack.bedrock.resource.blocks.Isotropic;
|
||||||
|
import org.geysermc.pack.bedrock.resource.blocks.Textures;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Blocks
|
||||||
|
* <p>
|
||||||
|
* The minecraft block definition file.
|
||||||
|
*/
|
||||||
|
public class Blocks {
|
||||||
|
@JsonProperty("format_version")
|
||||||
|
public int[] formatVersion;
|
||||||
|
|
||||||
|
@JsonProperty("brightness_gamma")
|
||||||
|
public float brightnessGamma;
|
||||||
|
|
||||||
|
@JsonProperty("carried_textures")
|
||||||
|
public CarriedTextures carriedTextures;
|
||||||
|
|
||||||
|
public Isotropic isotropic;
|
||||||
|
|
||||||
|
public String sound;
|
||||||
|
|
||||||
|
public Textures textures;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells Minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @return Format Version
|
||||||
|
*/
|
||||||
|
public int[] formatVersion() {
|
||||||
|
return this.formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells Minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @param formatVersion Format Version
|
||||||
|
*/
|
||||||
|
public void formatVersion(int[] formatVersion) {
|
||||||
|
this.formatVersion = formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the gamma brightness level to apply to the block texture.
|
||||||
|
*
|
||||||
|
* @return Brightness Gamma
|
||||||
|
*/
|
||||||
|
public float brightnessGamma() {
|
||||||
|
return this.brightnessGamma;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Specifies the gamma brightness level to apply to the block texture.
|
||||||
|
*
|
||||||
|
* @param brightnessGamma Brightness Gamma
|
||||||
|
*/
|
||||||
|
public void brightnessGamma(float brightnessGamma) {
|
||||||
|
this.brightnessGamma = brightnessGamma;
|
||||||
|
}
|
||||||
|
|
||||||
|
public CarriedTextures carriedTextures() {
|
||||||
|
return this.carriedTextures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void carriedTextures(CarriedTextures carriedTextures) {
|
||||||
|
this.carriedTextures = carriedTextures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Isotropic isotropic() {
|
||||||
|
return this.isotropic;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void isotropic(Isotropic isotropic) {
|
||||||
|
this.isotropic = isotropic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sound definition of this block.
|
||||||
|
*
|
||||||
|
* @return Sound
|
||||||
|
*/
|
||||||
|
public String sound() {
|
||||||
|
return this.sound;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The sound definition of this block.
|
||||||
|
*
|
||||||
|
* @param sound Sound
|
||||||
|
*/
|
||||||
|
public void sound(String sound) {
|
||||||
|
this.sound = sound;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Textures textures() {
|
||||||
|
return this.textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void textures(Textures textures) {
|
||||||
|
this.textures = textures;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import org.geysermc.pack.bedrock.resource.manifest.Capabilities;
|
||||||
|
import org.geysermc.pack.bedrock.resource.manifest.Dependencies;
|
||||||
|
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.bedrock.resource.manifest.Subpacks;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Manifest V2 Schema
|
||||||
|
* <p>
|
||||||
|
* The manifest file contains all the basic information about the pack that Minecraft needs to identify it. The tables below contain all the components of the manifest, their individual properties, and what they mean.
|
||||||
|
*/
|
||||||
|
public class Manifest {
|
||||||
|
@JsonProperty("format_version")
|
||||||
|
public float formatVersion;
|
||||||
|
|
||||||
|
public Capabilities capabilities;
|
||||||
|
|
||||||
|
public List<Dependencies> dependencies = new ArrayList<>();
|
||||||
|
|
||||||
|
public Header header;
|
||||||
|
|
||||||
|
public List<Modules> modules = new ArrayList<>();
|
||||||
|
|
||||||
|
public Metadata metadata;
|
||||||
|
|
||||||
|
public List<Subpacks> subpacks = new ArrayList<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This defines the current version of the manifest. Don't change this unless you have a good reason to
|
||||||
|
*
|
||||||
|
* @return Format Version
|
||||||
|
*/
|
||||||
|
public float formatVersion() {
|
||||||
|
return this.formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This defines the current version of the manifest. Don't change this unless you have a good reason to
|
||||||
|
*
|
||||||
|
* @param formatVersion Format Version
|
||||||
|
*/
|
||||||
|
public void formatVersion(float formatVersion) {
|
||||||
|
this.formatVersion = formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These are the different features that the pack makes use of that aren't necessarily enabled by default.
|
||||||
|
*
|
||||||
|
* @return Capabilities
|
||||||
|
*/
|
||||||
|
public Capabilities capabilities() {
|
||||||
|
return this.capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* These are the different features that the pack makes use of that aren't necessarily enabled by default.
|
||||||
|
*
|
||||||
|
* @param capabilities Capabilities
|
||||||
|
*/
|
||||||
|
public void capabilities(Capabilities capabilities) {
|
||||||
|
this.capabilities = capabilities;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing definitions for any other packs or modules that are required in order for this manifest.json file to work.
|
||||||
|
*
|
||||||
|
* @return Dependencies
|
||||||
|
*/
|
||||||
|
public List<Dependencies> dependencies() {
|
||||||
|
return this.dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing definitions for any other packs or modules that are required in order for this manifest.json file to work.
|
||||||
|
*
|
||||||
|
* @param dependencies Dependencies
|
||||||
|
*/
|
||||||
|
public void dependencies(List<Dependencies> dependencies) {
|
||||||
|
this.dependencies = dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing information regarding the name of the pack, description, and other features that are public facing.
|
||||||
|
*
|
||||||
|
* @return Header
|
||||||
|
*/
|
||||||
|
public Header header() {
|
||||||
|
return this.header;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing information regarding the name of the pack, description, and other features that are public facing.
|
||||||
|
*
|
||||||
|
* @param header Header
|
||||||
|
*/
|
||||||
|
public void header(Header header) {
|
||||||
|
this.header = header;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing information regarding the type of content that is being brought in.
|
||||||
|
*
|
||||||
|
* @return Modules
|
||||||
|
*/
|
||||||
|
public List<Modules> modules() {
|
||||||
|
return this.modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing information regarding the type of content that is being brought in.
|
||||||
|
*
|
||||||
|
* @param modules Modules
|
||||||
|
*/
|
||||||
|
public void modules(List<Modules> modules) {
|
||||||
|
this.modules = modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing the metadata about the file such as authors and licensing information.
|
||||||
|
*
|
||||||
|
* @return Metadata
|
||||||
|
*/
|
||||||
|
public Metadata metadata() {
|
||||||
|
return this.metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Section containing the metadata about the file such as authors and licensing information.
|
||||||
|
*
|
||||||
|
* @param metadata Metadata
|
||||||
|
*/
|
||||||
|
public void metadata(Metadata metadata) {
|
||||||
|
this.metadata = metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of subpacks that are applied per memory tier.
|
||||||
|
*
|
||||||
|
* @return Subpacks
|
||||||
|
*/
|
||||||
|
public List<Subpacks> subpacks() {
|
||||||
|
return this.subpacks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A list of subpacks that are applied per memory tier.
|
||||||
|
*
|
||||||
|
* @param subpacks Subpacks
|
||||||
|
*/
|
||||||
|
public void subpacks(List<Subpacks> subpacks) {
|
||||||
|
this.subpacks = subpacks;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.sounds.BlockSounds;
|
||||||
|
import org.geysermc.pack.bedrock.resource.sounds.EntitySounds;
|
||||||
|
import org.geysermc.pack.bedrock.resource.sounds.IndividualEventSounds;
|
||||||
|
import org.geysermc.pack.bedrock.resource.sounds.InteractiveSounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sounds.json
|
||||||
|
* <p>
|
||||||
|
* Sound definitions.
|
||||||
|
*/
|
||||||
|
public class Sounds {
|
||||||
|
@JsonProperty("block_sounds")
|
||||||
|
private Map<String, BlockSounds> blockSounds = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("entity_sounds")
|
||||||
|
public EntitySounds entitySounds;
|
||||||
|
|
||||||
|
@JsonProperty("individual_event_sounds")
|
||||||
|
public IndividualEventSounds individualEventSounds;
|
||||||
|
|
||||||
|
@JsonProperty("interactive_sounds")
|
||||||
|
public InteractiveSounds interactiveSounds;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block sound definitions.
|
||||||
|
*
|
||||||
|
* @return Block Sounds
|
||||||
|
*/
|
||||||
|
public Map<String, BlockSounds> blockSounds() {
|
||||||
|
return this.blockSounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Block sound definitions.
|
||||||
|
*
|
||||||
|
* @param blockSounds Block Sounds
|
||||||
|
*/
|
||||||
|
public void blockSounds(Map<String, BlockSounds> blockSounds) {
|
||||||
|
this.blockSounds = blockSounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity sounds definitions.
|
||||||
|
*
|
||||||
|
* @return Entity Sounds
|
||||||
|
*/
|
||||||
|
public EntitySounds entitySounds() {
|
||||||
|
return this.entitySounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity sounds definitions.
|
||||||
|
*
|
||||||
|
* @param entitySounds Entity Sounds
|
||||||
|
*/
|
||||||
|
public void entitySounds(EntitySounds entitySounds) {
|
||||||
|
this.entitySounds = entitySounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Individual event sounds definitions.
|
||||||
|
*
|
||||||
|
* @return Individual Event Sounds
|
||||||
|
*/
|
||||||
|
public IndividualEventSounds individualEventSounds() {
|
||||||
|
return this.individualEventSounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Individual event sounds definitions.
|
||||||
|
*
|
||||||
|
* @param individualEventSounds Individual Event Sounds
|
||||||
|
*/
|
||||||
|
public void individualEventSounds(IndividualEventSounds individualEventSounds) {
|
||||||
|
this.individualEventSounds = individualEventSounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interactive sounds definitions.
|
||||||
|
*
|
||||||
|
* @return Interactive Sounds
|
||||||
|
*/
|
||||||
|
public InteractiveSounds interactiveSounds() {
|
||||||
|
return this.interactiveSounds;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Interactive sounds definitions.
|
||||||
|
*
|
||||||
|
* @param interactiveSounds Interactive Sounds
|
||||||
|
*/
|
||||||
|
public void interactiveSounds(InteractiveSounds interactiveSounds) {
|
||||||
|
this.interactiveSounds = interactiveSounds;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* World X Pack Schema
|
||||||
|
*/
|
||||||
|
public class WorldXPacks {
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animation_controllers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.AnimationControllers;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation Controller
|
||||||
|
*/
|
||||||
|
public class AnimationController {
|
||||||
|
@JsonProperty("format_version")
|
||||||
|
public String formatVersion;
|
||||||
|
|
||||||
|
@JsonProperty("animation_controllers")
|
||||||
|
private Map<String, AnimationControllers> animationControllers = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @return Format Version
|
||||||
|
*/
|
||||||
|
public String formatVersion() {
|
||||||
|
return this.formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @param formatVersion Format Version
|
||||||
|
*/
|
||||||
|
public void formatVersion(String formatVersion) {
|
||||||
|
this.formatVersion = formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation controllers schema for.
|
||||||
|
*
|
||||||
|
* @return Animation Controllers Schema
|
||||||
|
*/
|
||||||
|
public Map<String, AnimationControllers> animationControllers() {
|
||||||
|
return this.animationControllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation controllers schema for.
|
||||||
|
*
|
||||||
|
* @param animationControllers Animation Controllers Schema
|
||||||
|
*/
|
||||||
|
public void animationControllers(Map<String, AnimationControllers> animationControllers) {
|
||||||
|
this.animationControllers = animationControllers;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.States;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animation Controllers Schema
|
||||||
|
* <p>
|
||||||
|
* The animation controllers schema for.
|
||||||
|
*/
|
||||||
|
public class AnimationControllers {
|
||||||
|
private Map<String, States> states = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("initial_state")
|
||||||
|
public String initialState;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The states of this animation controller.
|
||||||
|
*
|
||||||
|
* @return States
|
||||||
|
*/
|
||||||
|
public Map<String, States> states() {
|
||||||
|
return this.states;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The states of this animation controller.
|
||||||
|
*
|
||||||
|
* @param states States
|
||||||
|
*/
|
||||||
|
public void states(Map<String, States> states) {
|
||||||
|
this.states = states;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The state to start with, if not specified state at position 0 in the array is used.
|
||||||
|
*
|
||||||
|
* @return Initial State
|
||||||
|
*/
|
||||||
|
public String initialState() {
|
||||||
|
return this.initialState;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The state to start with, if not specified state at position 0 in the array is used.
|
||||||
|
*
|
||||||
|
* @param initialState Initial State
|
||||||
|
*/
|
||||||
|
public void initialState(String initialState) {
|
||||||
|
this.initialState = initialState;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,124 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states.SoundEffects;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states.Variables;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* States
|
||||||
|
* <p>
|
||||||
|
* The states of this animation controller.
|
||||||
|
*/
|
||||||
|
public class States {
|
||||||
|
@JsonProperty("blend_transition")
|
||||||
|
public float blendTransition;
|
||||||
|
|
||||||
|
@JsonProperty("blend_via_shortest_path")
|
||||||
|
public boolean blendViaShortestPath;
|
||||||
|
|
||||||
|
@JsonProperty("sound_effects")
|
||||||
|
public List<SoundEffects> soundEffects = new ArrayList<>();
|
||||||
|
|
||||||
|
private Map<String, Variables> variables = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("on_entry")
|
||||||
|
public String[] onEntry;
|
||||||
|
|
||||||
|
@JsonProperty("on_exit")
|
||||||
|
public String[] onExit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A short-hand version of blend_out that simply sets the amount of time to fade out if the animation is interrupted.
|
||||||
|
*/
|
||||||
|
public float blendTransition() {
|
||||||
|
return this.blendTransition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A short-hand version of blend_out that simply sets the amount of time to fade out if the animation is interrupted.
|
||||||
|
*/
|
||||||
|
public void blendTransition(float blendTransition) {
|
||||||
|
this.blendTransition = blendTransition;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When blending a transition to another state, animate each euler axis through the shortest rotation, instead of by value.
|
||||||
|
*
|
||||||
|
* @return Blend Via Shortest Path
|
||||||
|
*/
|
||||||
|
public boolean blendViaShortestPath() {
|
||||||
|
return this.blendViaShortestPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* When blending a transition to another state, animate each euler axis through the shortest rotation, instead of by value.
|
||||||
|
*
|
||||||
|
* @param blendViaShortestPath Blend Via Shortest Path
|
||||||
|
*/
|
||||||
|
public void blendViaShortestPath(boolean blendViaShortestPath) {
|
||||||
|
this.blendViaShortestPath = blendViaShortestPath;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection of sounds to trigger on entry to this animation state.
|
||||||
|
*/
|
||||||
|
public List<SoundEffects> soundEffects() {
|
||||||
|
return this.soundEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Collection of sounds to trigger on entry to this animation state.
|
||||||
|
*/
|
||||||
|
public void soundEffects(List<SoundEffects> soundEffects) {
|
||||||
|
this.soundEffects = soundEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Variables> variables() {
|
||||||
|
return this.variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void variables(Map<String, Variables> variables) {
|
||||||
|
this.variables = variables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets molang on data on entry.
|
||||||
|
*
|
||||||
|
* @return On Entry
|
||||||
|
*/
|
||||||
|
public String[] onEntry() {
|
||||||
|
return this.onEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets molang on data on entry.
|
||||||
|
*
|
||||||
|
* @param onEntry On Entry
|
||||||
|
*/
|
||||||
|
public void onEntry(String[] onEntry) {
|
||||||
|
this.onEntry = onEntry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets molang on data on exit.
|
||||||
|
*
|
||||||
|
* @return On Exit
|
||||||
|
*/
|
||||||
|
public String[] onExit() {
|
||||||
|
return this.onExit;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets molang on data on exit.
|
||||||
|
*
|
||||||
|
* @param onExit On Exit
|
||||||
|
*/
|
||||||
|
public void onExit(String[] onExit) {
|
||||||
|
this.onExit = onExit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states;
|
||||||
|
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
public class SoundEffects {
|
||||||
|
public String effect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid sound effect names should be listed in the entity's resource_definition json file.
|
||||||
|
*/
|
||||||
|
public String effect() {
|
||||||
|
return this.effect;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Valid sound effect names should be listed in the entity's resource_definition json file.
|
||||||
|
*/
|
||||||
|
public void effect(String effect) {
|
||||||
|
this.effect = effect;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animation_controllers.animationcontroller.animationcontrollers.states;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.Float;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class Variables {
|
||||||
|
public String input;
|
||||||
|
|
||||||
|
@JsonProperty("remap_curve")
|
||||||
|
private Map<String, Float> remapCurve = new HashMap<>();
|
||||||
|
|
||||||
|
public String input() {
|
||||||
|
return this.input;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void input(String input) {
|
||||||
|
this.input = input;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remap Curve
|
||||||
|
*/
|
||||||
|
public Map<String, Float> remapCurve() {
|
||||||
|
return this.remapCurve;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param remapCurve Remap Curve
|
||||||
|
*/
|
||||||
|
public void remapCurve(Map<String, Float> remapCurve) {
|
||||||
|
this.remapCurve = remapCurve;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animations;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animations.actoranimation.Animations;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actor Animation
|
||||||
|
* <p>
|
||||||
|
* The RP animation that changes an actors models, or molang data.
|
||||||
|
*/
|
||||||
|
public class ActorAnimation {
|
||||||
|
@JsonProperty("format_version")
|
||||||
|
public String formatVersion;
|
||||||
|
|
||||||
|
private Map<String, Animations> animations = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @return Format Version
|
||||||
|
*/
|
||||||
|
public String formatVersion() {
|
||||||
|
return this.formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @param formatVersion Format Version
|
||||||
|
*/
|
||||||
|
public void formatVersion(String formatVersion) {
|
||||||
|
this.formatVersion = formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation specification.
|
||||||
|
*
|
||||||
|
* @return Animations Schema
|
||||||
|
*/
|
||||||
|
public Map<String, Animations> animations() {
|
||||||
|
return this.animations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The animation specification.
|
||||||
|
*
|
||||||
|
* @param animations Animations Schema
|
||||||
|
*/
|
||||||
|
public void animations(Map<String, Animations> animations) {
|
||||||
|
this.animations = animations;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animations.actoranimation;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.Object;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animations.actoranimation.animations.Bones;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Animations Schema
|
||||||
|
* <p>
|
||||||
|
* The animation specification.
|
||||||
|
*/
|
||||||
|
public class Animations {
|
||||||
|
@JsonProperty("anim_time_update")
|
||||||
|
public String animTimeUpdate;
|
||||||
|
|
||||||
|
@JsonProperty("animation_length")
|
||||||
|
public float animationLength;
|
||||||
|
|
||||||
|
@JsonProperty("blend_weight")
|
||||||
|
public String blendWeight;
|
||||||
|
|
||||||
|
private Map<String, Bones> bones = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("loop_delay")
|
||||||
|
public String loopDelay;
|
||||||
|
|
||||||
|
@JsonProperty("override_previous_animation")
|
||||||
|
public boolean overridePreviousAnimation;
|
||||||
|
|
||||||
|
@JsonProperty("particle_effects")
|
||||||
|
private Map<String, Object> particleEffects = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("start_delay")
|
||||||
|
public String startDelay;
|
||||||
|
|
||||||
|
@JsonProperty("sound_effects")
|
||||||
|
private Map<String, Object> soundEffects = new HashMap<>();
|
||||||
|
|
||||||
|
private Map<String, Object> timeline = new HashMap<>();
|
||||||
|
|
||||||
|
public String animTimeUpdate() {
|
||||||
|
return this.animTimeUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void animTimeUpdate(String animTimeUpdate) {
|
||||||
|
this.animTimeUpdate = animTimeUpdate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override calculated value (set as the last keyframe time) and set animation length in seconds.
|
||||||
|
*
|
||||||
|
* @return Animation Length
|
||||||
|
*/
|
||||||
|
public float animationLength() {
|
||||||
|
return this.animationLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Override calculated value (set as the last keyframe time) and set animation length in seconds.
|
||||||
|
*
|
||||||
|
* @param animationLength Animation Length
|
||||||
|
*/
|
||||||
|
public void animationLength(float animationLength) {
|
||||||
|
this.animationLength = animationLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String blendWeight() {
|
||||||
|
return this.blendWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void blendWeight(String blendWeight) {
|
||||||
|
this.blendWeight = blendWeight;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines how the bones in an animation move or transform.
|
||||||
|
*
|
||||||
|
* @return Bones
|
||||||
|
*/
|
||||||
|
public Map<String, Bones> bones() {
|
||||||
|
return this.bones;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Defines how the bones in an animation move or transform.
|
||||||
|
*
|
||||||
|
* @param bones Bones
|
||||||
|
*/
|
||||||
|
public void bones(Map<String, Bones> bones) {
|
||||||
|
this.bones = bones;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String loopDelay() {
|
||||||
|
return this.loopDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void loopDelay(String loopDelay) {
|
||||||
|
this.loopDelay = loopDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset bones in this animation to the default pose before applying this animation.
|
||||||
|
*
|
||||||
|
* @return Override Previous Animation
|
||||||
|
*/
|
||||||
|
public boolean overridePreviousAnimation() {
|
||||||
|
return this.overridePreviousAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset bones in this animation to the default pose before applying this animation.
|
||||||
|
*
|
||||||
|
* @param overridePreviousAnimation Override Previous Animation
|
||||||
|
*/
|
||||||
|
public void overridePreviousAnimation(boolean overridePreviousAnimation) {
|
||||||
|
this.overridePreviousAnimation = overridePreviousAnimation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Particle Effects
|
||||||
|
*/
|
||||||
|
public Map<String, Object> particleEffects() {
|
||||||
|
return this.particleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param particleEffects Particle Effects
|
||||||
|
*/
|
||||||
|
public void particleEffects(Map<String, Object> particleEffects) {
|
||||||
|
this.particleEffects = particleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String startDelay() {
|
||||||
|
return this.startDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void startDelay(String startDelay) {
|
||||||
|
this.startDelay = startDelay;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Sound Effect
|
||||||
|
*/
|
||||||
|
public Map<String, Object> soundEffects() {
|
||||||
|
return this.soundEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param soundEffects Sound Effect
|
||||||
|
*/
|
||||||
|
public void soundEffects(Map<String, Object> soundEffects) {
|
||||||
|
this.soundEffects = soundEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The time line.
|
||||||
|
*
|
||||||
|
* @return Timeline
|
||||||
|
*/
|
||||||
|
public Map<String, Object> timeline() {
|
||||||
|
return this.timeline;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The time line.
|
||||||
|
*
|
||||||
|
* @param timeline Timeline
|
||||||
|
*/
|
||||||
|
public void timeline(Map<String, Object> timeline) {
|
||||||
|
this.timeline = timeline;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animations.actoranimation.animations;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.Object;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.animations.actoranimation.animations.bones.RelativeTo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Bones
|
||||||
|
* <p>
|
||||||
|
* Defines how the bones in an animation move or transform.
|
||||||
|
*/
|
||||||
|
public class Bones {
|
||||||
|
public String[] position;
|
||||||
|
|
||||||
|
public String[] rotation;
|
||||||
|
|
||||||
|
@JsonProperty("relative_to")
|
||||||
|
public RelativeTo relativeTo;
|
||||||
|
|
||||||
|
private Map<String, Object> scale = new HashMap<>();
|
||||||
|
|
||||||
|
public String[] position() {
|
||||||
|
return this.position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void position(String[] position) {
|
||||||
|
this.position = position;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] rotation() {
|
||||||
|
return this.rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void rotation(String[] rotation) {
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set, makes the bone rotation relative to the entity instead of the bone's parent.
|
||||||
|
*
|
||||||
|
* @return Relative To
|
||||||
|
*/
|
||||||
|
public RelativeTo relativeTo() {
|
||||||
|
return this.relativeTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set, makes the bone rotation relative to the entity instead of the bone's parent.
|
||||||
|
*
|
||||||
|
* @param relativeTo Relative To
|
||||||
|
*/
|
||||||
|
public void relativeTo(RelativeTo relativeTo) {
|
||||||
|
this.relativeTo = relativeTo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, Object> scale() {
|
||||||
|
return this.scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void scale(Map<String, Object> scale) {
|
||||||
|
this.scale = scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.animations.actoranimation.animations.bones;
|
||||||
|
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relative To
|
||||||
|
* <p>
|
||||||
|
* If set, makes the bone rotation relative to the entity instead of the bone's parent.
|
||||||
|
*/
|
||||||
|
public class RelativeTo {
|
||||||
|
public String rotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set, makes the bone rotation relative to the entity instead of the bone's parent.
|
||||||
|
*
|
||||||
|
* @return Rotation
|
||||||
|
*/
|
||||||
|
public String rotation() {
|
||||||
|
return this.rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If set, makes the bone rotation relative to the entity instead of the bone's parent.
|
||||||
|
*
|
||||||
|
* @param rotation Rotation
|
||||||
|
*/
|
||||||
|
public void rotation(String rotation) {
|
||||||
|
this.rotation = rotation;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.attachables;
|
||||||
|
|
||||||
|
import org.geysermc.pack.bedrock.resource.attachables.attachable.Description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Attachables
|
||||||
|
* <p>
|
||||||
|
* The attachables definition.
|
||||||
|
*/
|
||||||
|
public class Attachable {
|
||||||
|
public Description description;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Description
|
||||||
|
*/
|
||||||
|
public Description description() {
|
||||||
|
return this.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param description Description
|
||||||
|
*/
|
||||||
|
public void description(Description description) {
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.attachables;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Actor Animation 1.10.0
|
||||||
|
*/
|
||||||
|
public class Attachables {
|
||||||
|
@JsonProperty("format_version")
|
||||||
|
public String formatVersion;
|
||||||
|
|
||||||
|
@JsonProperty("minecraft:attachable")
|
||||||
|
public Attachable attachable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @return 1.10.0 Format Version
|
||||||
|
*/
|
||||||
|
public String formatVersion() {
|
||||||
|
return this.formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A version that tells minecraft what type of data format can be expected when reading this file.
|
||||||
|
*
|
||||||
|
* @param formatVersion 1.10.0 Format Version
|
||||||
|
*/
|
||||||
|
public void formatVersion(String formatVersion) {
|
||||||
|
this.formatVersion = formatVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attachables definition.
|
||||||
|
*
|
||||||
|
* @return Attachables
|
||||||
|
*/
|
||||||
|
public Attachable attachable() {
|
||||||
|
return this.attachable;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The attachables definition.
|
||||||
|
*
|
||||||
|
* @param attachable Attachables
|
||||||
|
*/
|
||||||
|
public void attachable(Attachable attachable) {
|
||||||
|
this.attachable = attachable;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,285 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.attachables.attachable;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import org.geysermc.pack.bedrock.resource.attachables.attachable.description.Scripts;
|
||||||
|
import org.geysermc.pack.bedrock.resource.attachables.attachable.description.SpawnEgg;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description
|
||||||
|
*/
|
||||||
|
public class Description {
|
||||||
|
private Map<String, String> animations = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("animation_controllers")
|
||||||
|
public String[] animationControllers;
|
||||||
|
|
||||||
|
@JsonProperty("enable_attachables")
|
||||||
|
public boolean enableAttachables;
|
||||||
|
|
||||||
|
private Map<String, String> geometry = new HashMap<>();
|
||||||
|
|
||||||
|
public String identifier;
|
||||||
|
|
||||||
|
private Map<String, String> item = new HashMap<>();
|
||||||
|
|
||||||
|
private Map<String, String> materials = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("min_engine_version")
|
||||||
|
public String minEngineVersion;
|
||||||
|
|
||||||
|
@JsonProperty("particle_effects")
|
||||||
|
private Map<String, String> particleEffects = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("particle_emitters")
|
||||||
|
private Map<String, String> particleEmitters = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("render_controllers")
|
||||||
|
public String[] renderControllers;
|
||||||
|
|
||||||
|
public Scripts scripts;
|
||||||
|
|
||||||
|
@JsonProperty("sound_effects")
|
||||||
|
public String[] soundEffects;
|
||||||
|
|
||||||
|
@JsonProperty("spawn_egg")
|
||||||
|
public SpawnEgg spawnEgg;
|
||||||
|
|
||||||
|
private Map<String, String> textures = new HashMap<>();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The collection of animations references.
|
||||||
|
*
|
||||||
|
* @return Animations
|
||||||
|
*/
|
||||||
|
public Map<String, String> animations() {
|
||||||
|
return this.animations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The collection of animations references.
|
||||||
|
*
|
||||||
|
* @param animations Animations
|
||||||
|
*/
|
||||||
|
public void animations(Map<String, String> animations) {
|
||||||
|
this.animations = animations;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The specification of animation controllers.
|
||||||
|
*
|
||||||
|
* @return Animation Controllers
|
||||||
|
*/
|
||||||
|
public String[] animationControllers() {
|
||||||
|
return this.animationControllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The specification of animation controllers.
|
||||||
|
*
|
||||||
|
* @param animationControllers Animation Controllers
|
||||||
|
*/
|
||||||
|
public void animationControllers(String[] animationControllers) {
|
||||||
|
this.animationControllers = animationControllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Enable Attachables
|
||||||
|
*/
|
||||||
|
public boolean enableAttachables() {
|
||||||
|
return this.enableAttachables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param enableAttachables Enable Attachables
|
||||||
|
*/
|
||||||
|
public void enableAttachables(boolean enableAttachables) {
|
||||||
|
this.enableAttachables = enableAttachables;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The geometry specification.
|
||||||
|
*
|
||||||
|
* @return Geometry
|
||||||
|
*/
|
||||||
|
public Map<String, String> geometry() {
|
||||||
|
return this.geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The geometry specification.
|
||||||
|
*
|
||||||
|
* @param geometry Geometry
|
||||||
|
*/
|
||||||
|
public void geometry(Map<String, String> geometry) {
|
||||||
|
this.geometry = geometry;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Identifier
|
||||||
|
*/
|
||||||
|
public String identifier() {
|
||||||
|
return this.identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param identifier Identifier
|
||||||
|
*/
|
||||||
|
public void identifier(String identifier) {
|
||||||
|
this.identifier = identifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Item
|
||||||
|
*/
|
||||||
|
public Map<String, String> item() {
|
||||||
|
return this.item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param item Item
|
||||||
|
*/
|
||||||
|
public void item(Map<String, String> item) {
|
||||||
|
this.item = item;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of material references.
|
||||||
|
*
|
||||||
|
* @return Materials
|
||||||
|
*/
|
||||||
|
public Map<String, String> materials() {
|
||||||
|
return this.materials;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of material references.
|
||||||
|
*
|
||||||
|
* @param materials Materials
|
||||||
|
*/
|
||||||
|
public void materials(Map<String, String> materials) {
|
||||||
|
this.materials = materials;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum engine needed to use this.
|
||||||
|
*
|
||||||
|
* @return Minimum Engine Version
|
||||||
|
*/
|
||||||
|
public String minEngineVersion() {
|
||||||
|
return this.minEngineVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The minimum engine needed to use this.
|
||||||
|
*
|
||||||
|
* @param minEngineVersion Minimum Engine Version
|
||||||
|
*/
|
||||||
|
public void minEngineVersion(String minEngineVersion) {
|
||||||
|
this.minEngineVersion = minEngineVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of particle effect references.
|
||||||
|
*
|
||||||
|
* @return Particle Effects
|
||||||
|
*/
|
||||||
|
public Map<String, String> particleEffects() {
|
||||||
|
return this.particleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A collection of particle effect references.
|
||||||
|
*
|
||||||
|
* @param particleEffects Particle Effects
|
||||||
|
*/
|
||||||
|
public void particleEffects(Map<String, String> particleEffects) {
|
||||||
|
this.particleEffects = particleEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Particle Emitters
|
||||||
|
*/
|
||||||
|
public Map<String, String> particleEmitters() {
|
||||||
|
return this.particleEmitters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param particleEmitters Particle Emitters
|
||||||
|
*/
|
||||||
|
public void particleEmitters(Map<String, String> particleEmitters) {
|
||||||
|
this.particleEmitters = particleEmitters;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Render Controllers
|
||||||
|
*/
|
||||||
|
public String[] renderControllers() {
|
||||||
|
return this.renderControllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param renderControllers Render Controllers
|
||||||
|
*/
|
||||||
|
public void renderControllers(String[] renderControllers) {
|
||||||
|
this.renderControllers = renderControllers;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Scripts
|
||||||
|
*/
|
||||||
|
public Scripts scripts() {
|
||||||
|
return this.scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scripts Scripts
|
||||||
|
*/
|
||||||
|
public void scripts(Scripts scripts) {
|
||||||
|
this.scripts = scripts;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Sound Effects
|
||||||
|
*/
|
||||||
|
public String[] soundEffects() {
|
||||||
|
return this.soundEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param soundEffects Sound Effects
|
||||||
|
*/
|
||||||
|
public void soundEffects(String[] soundEffects) {
|
||||||
|
this.soundEffects = soundEffects;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Spawn Egg
|
||||||
|
*/
|
||||||
|
public SpawnEgg spawnEgg() {
|
||||||
|
return this.spawnEgg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param spawnEgg Spawn Egg
|
||||||
|
*/
|
||||||
|
public void spawnEgg(SpawnEgg spawnEgg) {
|
||||||
|
this.spawnEgg = spawnEgg;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Textures
|
||||||
|
*/
|
||||||
|
public Map<String, String> textures() {
|
||||||
|
return this.textures;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param textures Textures
|
||||||
|
*/
|
||||||
|
public void textures(Map<String, String> textures) {
|
||||||
|
this.textures = textures;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.attachables.attachable.description;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scripts
|
||||||
|
*/
|
||||||
|
public class Scripts {
|
||||||
|
private Map<String, String> animate = new HashMap<>();
|
||||||
|
|
||||||
|
@JsonProperty("parent_setup")
|
||||||
|
public String parentSetup;
|
||||||
|
|
||||||
|
public String scale;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Animate
|
||||||
|
*/
|
||||||
|
public Map<String, String> animate() {
|
||||||
|
return this.animate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param animate Animate
|
||||||
|
*/
|
||||||
|
public void animate(Map<String, String> animate) {
|
||||||
|
this.animate = animate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Parent Setup
|
||||||
|
*/
|
||||||
|
public String parentSetup() {
|
||||||
|
return this.parentSetup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param parentSetup Parent Setup
|
||||||
|
*/
|
||||||
|
public void parentSetup(String parentSetup) {
|
||||||
|
this.parentSetup = parentSetup;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Scale
|
||||||
|
*/
|
||||||
|
public String scale() {
|
||||||
|
return this.scale;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param scale Scale
|
||||||
|
*/
|
||||||
|
public void scale(String scale) {
|
||||||
|
this.scale = scale;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,76 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.attachables.attachable.description;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn Egg
|
||||||
|
*/
|
||||||
|
public class SpawnEgg {
|
||||||
|
@JsonProperty("base_colour")
|
||||||
|
public String baseColour;
|
||||||
|
|
||||||
|
@JsonProperty("overlay_color")
|
||||||
|
public String overlayColor;
|
||||||
|
|
||||||
|
public String texture;
|
||||||
|
|
||||||
|
@JsonProperty("texture_index")
|
||||||
|
public int textureIndex;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Base Colour
|
||||||
|
*/
|
||||||
|
public String baseColour() {
|
||||||
|
return this.baseColour;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param baseColour Base Colour
|
||||||
|
*/
|
||||||
|
public void baseColour(String baseColour) {
|
||||||
|
this.baseColour = baseColour;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Overlay Color
|
||||||
|
*/
|
||||||
|
public String overlayColor() {
|
||||||
|
return this.overlayColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param overlayColor Overlay Color
|
||||||
|
*/
|
||||||
|
public void overlayColor(String overlayColor) {
|
||||||
|
this.overlayColor = overlayColor;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Texture
|
||||||
|
*/
|
||||||
|
public String texture() {
|
||||||
|
return this.texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param texture Texture
|
||||||
|
*/
|
||||||
|
public void texture(String texture) {
|
||||||
|
this.texture = texture;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Texture Index
|
||||||
|
*/
|
||||||
|
public int textureIndex() {
|
||||||
|
return this.textureIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param textureIndex Texture Index
|
||||||
|
*/
|
||||||
|
public void textureIndex(int textureIndex) {
|
||||||
|
this.textureIndex = textureIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,125 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.biomesclient.biomes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biome
|
||||||
|
* <p>
|
||||||
|
* The specification of colors in a given biome.
|
||||||
|
*/
|
||||||
|
public class BambooJungle {
|
||||||
|
@JsonProperty("fog_identifier")
|
||||||
|
public String fogIdentifier;
|
||||||
|
|
||||||
|
@JsonProperty("fog_ids_to_merge")
|
||||||
|
public String[] fogIdsToMerge;
|
||||||
|
|
||||||
|
@JsonProperty("inherit_from_prior_fog")
|
||||||
|
public boolean inheritFromPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("remove_all_prior_fog")
|
||||||
|
public boolean removeAllPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("water_fog_distance")
|
||||||
|
public int waterFogDistance;
|
||||||
|
|
||||||
|
@JsonProperty("water_surface_transparency")
|
||||||
|
public float waterSurfaceTransparency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @return Fog Identifier
|
||||||
|
*/
|
||||||
|
public String fogIdentifier() {
|
||||||
|
return this.fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @param fogIdentifier Fog Identifier
|
||||||
|
*/
|
||||||
|
public void fogIdentifier(String fogIdentifier) {
|
||||||
|
this.fogIdentifier = fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public String[] fogIdsToMerge() {
|
||||||
|
return this.fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fogIdsToMerge Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public void fogIdsToMerge(String[] fogIdsToMerge) {
|
||||||
|
this.fogIdsToMerge = fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean inheritFromPriorFog() {
|
||||||
|
return this.inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inheritFromPriorFog Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public void inheritFromPriorFog(boolean inheritFromPriorFog) {
|
||||||
|
this.inheritFromPriorFog = inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean removeAllPriorFog() {
|
||||||
|
return this.removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeAllPriorFog Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public void removeAllPriorFog(boolean removeAllPriorFog) {
|
||||||
|
this.removeAllPriorFog = removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @return Water Fog Distance
|
||||||
|
*/
|
||||||
|
public int waterFogDistance() {
|
||||||
|
return this.waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @param waterFogDistance Water Fog Distance
|
||||||
|
*/
|
||||||
|
public void waterFogDistance(int waterFogDistance) {
|
||||||
|
this.waterFogDistance = waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @return Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public float waterSurfaceTransparency() {
|
||||||
|
return this.waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @param waterSurfaceTransparency Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public void waterSurfaceTransparency(float waterSurfaceTransparency) {
|
||||||
|
this.waterSurfaceTransparency = waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.biomesclient.biomes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biome
|
||||||
|
* <p>
|
||||||
|
* The specification of colors in a given biome.
|
||||||
|
*/
|
||||||
|
public class BambooJungleHills {
|
||||||
|
@JsonProperty("fog_identifier")
|
||||||
|
public String fogIdentifier;
|
||||||
|
|
||||||
|
@JsonProperty("fog_ids_to_merge")
|
||||||
|
public String[] fogIdsToMerge;
|
||||||
|
|
||||||
|
@JsonProperty("inherit_from_prior_fog")
|
||||||
|
public boolean inheritFromPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("remove_all_prior_fog")
|
||||||
|
public boolean removeAllPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("water_fog_distance")
|
||||||
|
public int waterFogDistance;
|
||||||
|
|
||||||
|
@JsonProperty("water_surface_transparency")
|
||||||
|
public float waterSurfaceTransparency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @return Fog Identifier
|
||||||
|
*/
|
||||||
|
public String fogIdentifier() {
|
||||||
|
return this.fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @param fogIdentifier Fog Identifier
|
||||||
|
*/
|
||||||
|
public void fogIdentifier(String fogIdentifier) {
|
||||||
|
this.fogIdentifier = fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public String[] fogIdsToMerge() {
|
||||||
|
return this.fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fogIdsToMerge Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public void fogIdsToMerge(String[] fogIdsToMerge) {
|
||||||
|
this.fogIdsToMerge = fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean inheritFromPriorFog() {
|
||||||
|
return this.inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inheritFromPriorFog Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public void inheritFromPriorFog(boolean inheritFromPriorFog) {
|
||||||
|
this.inheritFromPriorFog = inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean removeAllPriorFog() {
|
||||||
|
return this.removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeAllPriorFog Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public void removeAllPriorFog(boolean removeAllPriorFog) {
|
||||||
|
this.removeAllPriorFog = removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @return Water Fog Distance
|
||||||
|
*/
|
||||||
|
public int waterFogDistance() {
|
||||||
|
return this.waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @param waterFogDistance Water Fog Distance
|
||||||
|
*/
|
||||||
|
public void waterFogDistance(int waterFogDistance) {
|
||||||
|
this.waterFogDistance = waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @return Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public float waterSurfaceTransparency() {
|
||||||
|
return this.waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @param waterSurfaceTransparency Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public void waterSurfaceTransparency(float waterSurfaceTransparency) {
|
||||||
|
this.waterSurfaceTransparency = waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.biomesclient.biomes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biome
|
||||||
|
* <p>
|
||||||
|
* The specification of colors in a given biome.
|
||||||
|
*/
|
||||||
|
public class BasaltDeltas {
|
||||||
|
@JsonProperty("fog_identifier")
|
||||||
|
public String fogIdentifier;
|
||||||
|
|
||||||
|
@JsonProperty("fog_ids_to_merge")
|
||||||
|
public String[] fogIdsToMerge;
|
||||||
|
|
||||||
|
@JsonProperty("inherit_from_prior_fog")
|
||||||
|
public boolean inheritFromPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("remove_all_prior_fog")
|
||||||
|
public boolean removeAllPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("water_fog_distance")
|
||||||
|
public int waterFogDistance;
|
||||||
|
|
||||||
|
@JsonProperty("water_surface_transparency")
|
||||||
|
public float waterSurfaceTransparency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @return Fog Identifier
|
||||||
|
*/
|
||||||
|
public String fogIdentifier() {
|
||||||
|
return this.fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @param fogIdentifier Fog Identifier
|
||||||
|
*/
|
||||||
|
public void fogIdentifier(String fogIdentifier) {
|
||||||
|
this.fogIdentifier = fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public String[] fogIdsToMerge() {
|
||||||
|
return this.fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fogIdsToMerge Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public void fogIdsToMerge(String[] fogIdsToMerge) {
|
||||||
|
this.fogIdsToMerge = fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean inheritFromPriorFog() {
|
||||||
|
return this.inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inheritFromPriorFog Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public void inheritFromPriorFog(boolean inheritFromPriorFog) {
|
||||||
|
this.inheritFromPriorFog = inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean removeAllPriorFog() {
|
||||||
|
return this.removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeAllPriorFog Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public void removeAllPriorFog(boolean removeAllPriorFog) {
|
||||||
|
this.removeAllPriorFog = removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @return Water Fog Distance
|
||||||
|
*/
|
||||||
|
public int waterFogDistance() {
|
||||||
|
return this.waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @param waterFogDistance Water Fog Distance
|
||||||
|
*/
|
||||||
|
public void waterFogDistance(int waterFogDistance) {
|
||||||
|
this.waterFogDistance = waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @return Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public float waterSurfaceTransparency() {
|
||||||
|
return this.waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @param waterSurfaceTransparency Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public void waterSurfaceTransparency(float waterSurfaceTransparency) {
|
||||||
|
this.waterSurfaceTransparency = waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.biomesclient.biomes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biome
|
||||||
|
* <p>
|
||||||
|
* The specification of colors in a given biome.
|
||||||
|
*/
|
||||||
|
public class Beach {
|
||||||
|
@JsonProperty("fog_identifier")
|
||||||
|
public String fogIdentifier;
|
||||||
|
|
||||||
|
@JsonProperty("fog_ids_to_merge")
|
||||||
|
public String[] fogIdsToMerge;
|
||||||
|
|
||||||
|
@JsonProperty("inherit_from_prior_fog")
|
||||||
|
public boolean inheritFromPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("remove_all_prior_fog")
|
||||||
|
public boolean removeAllPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("water_fog_distance")
|
||||||
|
public int waterFogDistance;
|
||||||
|
|
||||||
|
@JsonProperty("water_surface_transparency")
|
||||||
|
public float waterSurfaceTransparency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @return Fog Identifier
|
||||||
|
*/
|
||||||
|
public String fogIdentifier() {
|
||||||
|
return this.fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @param fogIdentifier Fog Identifier
|
||||||
|
*/
|
||||||
|
public void fogIdentifier(String fogIdentifier) {
|
||||||
|
this.fogIdentifier = fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public String[] fogIdsToMerge() {
|
||||||
|
return this.fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fogIdsToMerge Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public void fogIdsToMerge(String[] fogIdsToMerge) {
|
||||||
|
this.fogIdsToMerge = fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean inheritFromPriorFog() {
|
||||||
|
return this.inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inheritFromPriorFog Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public void inheritFromPriorFog(boolean inheritFromPriorFog) {
|
||||||
|
this.inheritFromPriorFog = inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean removeAllPriorFog() {
|
||||||
|
return this.removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeAllPriorFog Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public void removeAllPriorFog(boolean removeAllPriorFog) {
|
||||||
|
this.removeAllPriorFog = removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @return Water Fog Distance
|
||||||
|
*/
|
||||||
|
public int waterFogDistance() {
|
||||||
|
return this.waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @param waterFogDistance Water Fog Distance
|
||||||
|
*/
|
||||||
|
public void waterFogDistance(int waterFogDistance) {
|
||||||
|
this.waterFogDistance = waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @return Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public float waterSurfaceTransparency() {
|
||||||
|
return this.waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @param waterSurfaceTransparency Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public void waterSurfaceTransparency(float waterSurfaceTransparency) {
|
||||||
|
this.waterSurfaceTransparency = waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.biomesclient.biomes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biome
|
||||||
|
* <p>
|
||||||
|
* The specification of colors in a given biome.
|
||||||
|
*/
|
||||||
|
public class BirchForest {
|
||||||
|
@JsonProperty("fog_identifier")
|
||||||
|
public String fogIdentifier;
|
||||||
|
|
||||||
|
@JsonProperty("fog_ids_to_merge")
|
||||||
|
public String[] fogIdsToMerge;
|
||||||
|
|
||||||
|
@JsonProperty("inherit_from_prior_fog")
|
||||||
|
public boolean inheritFromPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("remove_all_prior_fog")
|
||||||
|
public boolean removeAllPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("water_fog_distance")
|
||||||
|
public int waterFogDistance;
|
||||||
|
|
||||||
|
@JsonProperty("water_surface_transparency")
|
||||||
|
public float waterSurfaceTransparency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @return Fog Identifier
|
||||||
|
*/
|
||||||
|
public String fogIdentifier() {
|
||||||
|
return this.fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @param fogIdentifier Fog Identifier
|
||||||
|
*/
|
||||||
|
public void fogIdentifier(String fogIdentifier) {
|
||||||
|
this.fogIdentifier = fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public String[] fogIdsToMerge() {
|
||||||
|
return this.fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fogIdsToMerge Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public void fogIdsToMerge(String[] fogIdsToMerge) {
|
||||||
|
this.fogIdsToMerge = fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean inheritFromPriorFog() {
|
||||||
|
return this.inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inheritFromPriorFog Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public void inheritFromPriorFog(boolean inheritFromPriorFog) {
|
||||||
|
this.inheritFromPriorFog = inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean removeAllPriorFog() {
|
||||||
|
return this.removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeAllPriorFog Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public void removeAllPriorFog(boolean removeAllPriorFog) {
|
||||||
|
this.removeAllPriorFog = removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @return Water Fog Distance
|
||||||
|
*/
|
||||||
|
public int waterFogDistance() {
|
||||||
|
return this.waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @param waterFogDistance Water Fog Distance
|
||||||
|
*/
|
||||||
|
public void waterFogDistance(int waterFogDistance) {
|
||||||
|
this.waterFogDistance = waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @return Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public float waterSurfaceTransparency() {
|
||||||
|
return this.waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @param waterSurfaceTransparency Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public void waterSurfaceTransparency(float waterSurfaceTransparency) {
|
||||||
|
this.waterSurfaceTransparency = waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,125 @@
|
|||||||
|
package org.geysermc.pack.bedrock.resource.biomesclient.biomes;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
|
import java.lang.String;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Biome
|
||||||
|
* <p>
|
||||||
|
* The specification of colors in a given biome.
|
||||||
|
*/
|
||||||
|
public class BirchForestHills {
|
||||||
|
@JsonProperty("fog_identifier")
|
||||||
|
public String fogIdentifier;
|
||||||
|
|
||||||
|
@JsonProperty("fog_ids_to_merge")
|
||||||
|
public String[] fogIdsToMerge;
|
||||||
|
|
||||||
|
@JsonProperty("inherit_from_prior_fog")
|
||||||
|
public boolean inheritFromPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("remove_all_prior_fog")
|
||||||
|
public boolean removeAllPriorFog;
|
||||||
|
|
||||||
|
@JsonProperty("water_fog_distance")
|
||||||
|
public int waterFogDistance;
|
||||||
|
|
||||||
|
@JsonProperty("water_surface_transparency")
|
||||||
|
public float waterSurfaceTransparency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @return Fog Identifier
|
||||||
|
*/
|
||||||
|
public String fogIdentifier() {
|
||||||
|
return this.fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A minecraft fog identifier.
|
||||||
|
*
|
||||||
|
* @param fogIdentifier Fog Identifier
|
||||||
|
*/
|
||||||
|
public void fogIdentifier(String fogIdentifier) {
|
||||||
|
this.fogIdentifier = fogIdentifier;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public String[] fogIdsToMerge() {
|
||||||
|
return this.fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param fogIdsToMerge Fog Ids To Merge
|
||||||
|
*/
|
||||||
|
public void fogIdsToMerge(String[] fogIdsToMerge) {
|
||||||
|
this.fogIdsToMerge = fogIdsToMerge;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean inheritFromPriorFog() {
|
||||||
|
return this.inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param inheritFromPriorFog Inherit From Prior Fog
|
||||||
|
*/
|
||||||
|
public void inheritFromPriorFog(boolean inheritFromPriorFog) {
|
||||||
|
this.inheritFromPriorFog = inheritFromPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public boolean removeAllPriorFog() {
|
||||||
|
return this.removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param removeAllPriorFog Remove All Prior Fog
|
||||||
|
*/
|
||||||
|
public void removeAllPriorFog(boolean removeAllPriorFog) {
|
||||||
|
this.removeAllPriorFog = removeAllPriorFog;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @return Water Fog Distance
|
||||||
|
*/
|
||||||
|
public int waterFogDistance() {
|
||||||
|
return this.waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The distance the water fog start at.
|
||||||
|
*
|
||||||
|
* @param waterFogDistance Water Fog Distance
|
||||||
|
*/
|
||||||
|
public void waterFogDistance(int waterFogDistance) {
|
||||||
|
this.waterFogDistance = waterFogDistance;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @return Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public float waterSurfaceTransparency() {
|
||||||
|
return this.waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The amount of transpareny the surface of the water has.
|
||||||
|
*
|
||||||
|
* @param waterSurfaceTransparency Water Surface Transparency
|
||||||
|
*/
|
||||||
|
public void waterSurfaceTransparency(float waterSurfaceTransparency) {
|
||||||
|
this.waterSurfaceTransparency = waterSurfaceTransparency;
|
||||||
|
}
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user