Get the block state generator to match what the client expects

This commit is contained in:
Ryan 2022-04-18 00:34:12 -07:00
parent b5a88be024
commit 064dcfbc0b

View file

@ -286,7 +286,7 @@ pub fn build() -> anyhow::Result<()> {
let finshed = quote! { let finshed = quote! {
/// Represents the state of a block, not including block entity data such as /// Represents the state of a block, not including block entity data such as
/// the text on a sign, the design on a banner, or the content of a spawner. /// the text on a sign, the design on a banner, or the content of a spawner.
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Hash, Debug)] #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Default, Hash)]
pub struct BlockState(u16); pub struct BlockState(u16);
impl BlockState { impl BlockState {
@ -566,6 +566,7 @@ fn parse_blocks_json() -> anyhow::Result<Vec<Block>> {
props: b props: b
.states .states
.into_iter() .into_iter()
.rev()
.map(|s| Prop { .map(|s| Prop {
name: match &s { name: match &s {
State::Enum { name, .. } => name.clone(), State::Enum { name, .. } => name.clone(),
@ -575,7 +576,7 @@ fn parse_blocks_json() -> anyhow::Result<Vec<Block>> {
vals: match &s { vals: match &s {
State::Enum { values, .. } => values.clone(), State::Enum { values, .. } => values.clone(),
State::Int { values, .. } => values.clone(), State::Int { values, .. } => values.clone(),
State::Bool { .. } => vec!["false".to_string(), "true".to_string()], State::Bool { .. } => vec!["true".to_string(), "false".to_string()],
}, },
}) })
.collect(), .collect(),