Skip to content

Commit 14cf848

Browse files
committed
Add overrides to models (for custom model data)
1 parent 6450275 commit 14cf848

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

packobf/src/resource_pack/files/model.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use crate::resource_pack::identifier::{Identifier, ModelId, TextureId};
2+
use crate::utils::clean_json_numbers;
23
use serde::{Deserialize, Serialize};
34
use std::collections::HashMap;
4-
use crate::utils::clean_json_numbers;
55

66
// models are referenced in `items` and `blockstates`
77
#[derive(Clone, Debug, Serialize, Deserialize)]
@@ -22,6 +22,8 @@ pub struct Model {
2222
#[serde(skip_serializing_if = "Option::is_none")]
2323
pub elements: Option<Vec<Element>>,
2424
#[serde(skip_serializing_if = "Option::is_none")]
25+
pub overrides: Option<Vec<Override>>,
26+
#[serde(skip_serializing_if = "Option::is_none")]
2527
pub gui_light: Option<String>,
2628
}
2729

@@ -122,8 +124,7 @@ pub struct Face {
122124
#[serde(skip_serializing_if = "Option::is_none")]
123125
pub uv: Option<[f32; 4]>,
124126

125-
#[serde(skip_serializing_if = "Option::is_none")]
126-
pub texture: Option<String>, // an id to textures in the model
127+
pub texture: String, // an id to textures in the model
127128

128129
#[serde(skip_serializing_if = "Option::is_none")]
129130
pub cullface: Option<String>,
@@ -134,3 +135,10 @@ pub struct Face {
134135
#[serde(skip_serializing_if = "Option::is_none")]
135136
pub rotation: Option<i32>,
136137
}
138+
139+
#[derive(Clone, Debug, Serialize, Deserialize)]
140+
pub struct Override {
141+
#[serde(skip_serializing_if = "Option::is_none")]
142+
pub predicate: Option<Vec<String>>,
143+
pub model: String,
144+
}

0 commit comments

Comments
 (0)