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,21 +391,27 @@ 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 blocks_hier.len() <= vanilla_id { /*
blocks_hier.resize(vanilla_id + 1, None); if offset.is_none() {
} println!("(no flat) block state = {:?} hierarchical {}:{}", block, vanilla_id >> 4, vanilla_id & 0xF);
if blocks_hier[vanilla_id].is_none() { }
blocks_hier[vanilla_id] = Some(block); */
} else {
panic!( if blocks_hier.len() <= vanilla_id {
"Tried to register {:#?} to {} but {:#?} was already registered", blocks_hier.resize(vanilla_id + 1, None);
block, }
id, if blocks_hier[vanilla_id].is_none() {
blocks_hier[vanilla_id] blocks_hier[vanilla_id] = Some(block);
); } else {
} panic!(
"Tried to register {:#?} to {} but {:#?} was already registered",
block,
vanilla_id,
blocks_hier[vanilla_id]
);
} }
} }
} }