1.13.2+: fix TallGrassVariant block state offsets (#468)

Fixes tallgrass showing up as dead bushes and also ferns. The flattened
IDs are in a different order than the pre-flattening data values, as observed
by enabling the commented-out block state logging.
This commit is contained in:
iceiix 2021-01-10 16:12:43 -08:00 committed by GitHub
parent ac63ee5ece
commit 63716499f2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 12 additions and 3 deletions

View File

@ -419,9 +419,9 @@ macro_rules! define_blocks {
let id = *flat_id + offset;
/*
if let Some(vanilla_id) = vanilla_id {
debug!("{} block state = {:?} hierarchical {}:{} offset={}", id, block, vanilla_id >> 4, vanilla_id & 0xF, offset);
println!("{} block state = {:?} hierarchical {}:{} offset={}", id, block, vanilla_id >> 4, vanilla_id & 0xF, offset);
} else {
debug!("{} block state = {:?} hierarchical none, offset={}", id, block, offset);
println!("{} block state = {:?} hierarchical none, offset={}", id, block, offset);
}
*/
if offset as isize > last_offset {
@ -446,7 +446,7 @@ macro_rules! define_blocks {
if let Some(vanilla_id) = vanilla_id {
/*
if offset.is_none() {
debug!("(no flat) block state = {:?} hierarchical {}:{}", block, vanilla_id >> 4, vanilla_id & 0xF);
println!("(no flat) block state = {:?} hierarchical {}:{}", block, vanilla_id >> 4, vanilla_id & 0xF);
}
*/
@ -968,6 +968,7 @@ define_blocks! {
],
},
data Some(variant.data()),
offset Some(variant.offset()),
material material::NON_SOLID,
model { ("minecraft", variant.as_string() ) },
tint TintType::Grass,
@ -7289,6 +7290,14 @@ impl TallGrassVariant {
TallGrassVariant::Fern => 2,
}
}
fn offset(self) -> usize {
match self {
TallGrassVariant::TallGrass => 0,
TallGrassVariant::Fern => 1,
TallGrassVariant::DeadBush => 2,
}
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]