From 63716499f2b2890b1b783df7e80f010dd3bab6b6 Mon Sep 17 00:00:00 2001 From: iceiix <43691553+iceiix@users.noreply.github.com> Date: Sun, 10 Jan 2021 16:12:43 -0800 Subject: [PATCH] 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. --- blocks/src/lib.rs | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/blocks/src/lib.rs b/blocks/src/lib.rs index 01ff0f3..e6e0aeb 100644 --- a/blocks/src/lib.rs +++ b/blocks/src/lib.rs @@ -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)]