Fix missing pre-flattening blocks (deadbush, etc.). Closes #89

Blocks not present after "the flattening" (1.13.2) were not registered
for older versions (hierarchical, pre-1.13). This wasn't noticed when
implementing #67 since almost all blocks pre-flattening also have
flattened IDs. The exceptions are when the blocks were removed or moved,
such as dead bush - hierarchical id 32, which is now a block state of
tallgrass instead. But it is still needed pre-flattening, due a logic
error these were skipped.

Fix pre-flattening block ID registration by moving the conditional
clause for vanilla_id outside of the offset conditional.
This commit is contained in:
ice_iix 2019-01-12 10:40:57 -08:00
parent ddd0897fee
commit 67841f9b2e
1 changed files with 20 additions and 14 deletions

View File

@ -391,8 +391,15 @@ macro_rules! define_blocks {
blocks_flat[id] blocks_flat[id]
); );
} }
}
if let Some(vanilla_id) = vanilla_id { if let Some(vanilla_id) = vanilla_id {
/*
if offset.is_none() {
println!("(no flat) block state = {:?} hierarchical {}:{}", block, vanilla_id >> 4, vanilla_id & 0xF);
}
*/
if blocks_hier.len() <= vanilla_id { if blocks_hier.len() <= vanilla_id {
blocks_hier.resize(vanilla_id + 1, None); blocks_hier.resize(vanilla_id + 1, None);
} }
@ -402,13 +409,12 @@ macro_rules! define_blocks {
panic!( panic!(
"Tried to register {:#?} to {} but {:#?} was already registered", "Tried to register {:#?} to {} but {:#?} was already registered",
block, block,
id, vanilla_id,
blocks_hier[vanilla_id] blocks_hier[vanilla_id]
); );
} }
} }
} }
}
#[allow(unused_assignments)] #[allow(unused_assignments)]
{ {