mirror of
https://github.com/GeyserMC/PackConverter.git
synced 2025-12-21 07:49:17 +00:00
Outline texture data process
This commit is contained in:
@@ -85,6 +85,7 @@ public class CustomModelDataHandler {
|
|||||||
InputStream stream;
|
InputStream stream;
|
||||||
JsonNode textureFile;
|
JsonNode textureFile;
|
||||||
try {
|
try {
|
||||||
|
// Read the model information for the Java CustomModelData
|
||||||
stream = new FileInputStream(storage.resolve("assets/minecraft/models/" + filePath + ".json").toFile());
|
stream = new FileInputStream(storage.resolve("assets/minecraft/models/" + filePath + ".json").toFile());
|
||||||
textureFile = mapper.readTree(stream);
|
textureFile = mapper.readTree(stream);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
@@ -92,13 +93,15 @@ public class CustomModelDataHandler {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Don't rely on getting the 0 texture
|
// TODO: This is called BSing it. It works but is it correct?
|
||||||
if (textureFile.has("textures")) {
|
if (textureFile.has("textures")) {
|
||||||
if (textureFile.get("textures").has("0") || textureFile.get("textures").has("layer0")) {
|
if (textureFile.get("textures").has("0") || textureFile.get("textures").has("layer0")) {
|
||||||
String determine = textureFile.get("textures").has("0") ? "0" : "layer0";
|
String determine = textureFile.get("textures").has("0") ? "0" : "layer0";
|
||||||
ObjectNode textureData = mapper.createObjectNode();
|
ObjectNode textureData = mapper.createObjectNode();
|
||||||
ObjectNode textureName = mapper.createObjectNode();
|
ObjectNode textureName = mapper.createObjectNode();
|
||||||
|
// Make JSON data for Bedrock pointing to where texture data for this item is stored
|
||||||
textureName.put("textures", textureFile.get("textures").get(determine).textValue().replace("item/", "textures/items/"));
|
textureName.put("textures", textureFile.get("textures").get(determine).textValue().replace("item/", "textures/items/"));
|
||||||
|
// Have the identifier point to that texture data
|
||||||
textureData.set(cleanIdentifier, textureName);
|
textureData.set(cleanIdentifier, textureName);
|
||||||
return textureData;
|
return textureData;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user