22
33import ca .fxco .moreculling .api .block .MoreBlockCulling ;
44import ca .fxco .moreculling .api .blockstate .MoreStateCulling ;
5+ import ca .fxco .moreculling .api .model .BakedOpacity ;
56import ca .fxco .moreculling .utils .BitUtils ;
7+ import net .minecraft .client .Minecraft ;
68import net .minecraft .core .BlockPos ;
79import net .minecraft .core .Direction ;
810import net .minecraft .world .level .BlockGetter ;
911import net .minecraft .world .level .block .Block ;
1012import net .minecraft .world .level .block .state .BlockBehaviour ;
1113import net .minecraft .world .level .block .state .BlockState ;
1214import org .jetbrains .annotations .Nullable ;
15+ import org .spongepowered .asm .mixin .Final ;
1316import org .spongepowered .asm .mixin .Mixin ;
1417import org .spongepowered .asm .mixin .Shadow ;
1518import org .spongepowered .asm .mixin .Unique ;
1619
1720import java .util .Optional ;
1821
22+ import static ca .fxco .moreculling .MoreCulling .blockRenderManager ;
23+
1924@ Mixin (BlockBehaviour .BlockStateBase .class )
2025public abstract class BlockStateBase_moreMixin implements MoreStateCulling {
2126
2227 @ Unique
23- private byte moreculling$emptyFaces = 0 ;
28+ private byte moreculling$emptyFaces = - 1 ;
2429 @ Unique
2530 private boolean moreculling$hasTextureTranslucency = true ;
2631
@@ -30,8 +35,18 @@ public abstract class BlockStateBase_moreMixin implements MoreStateCulling {
3035 @ Shadow
3136 protected abstract BlockState asState ();
3237
38+ @ Shadow
39+ @ Final
40+ private boolean canOcclude ;
41+
3342 @ Override
3443 public boolean moreculling$hasQuadsOnSide (@ Nullable Direction direction ) {
44+ if (moreculling$emptyFaces == -1 ) {
45+ moreculling$emptyFaces = 0 ;
46+ if (!canOcclude && blockRenderManager != null ) {
47+ ((BakedOpacity ) blockRenderManager .getBlockModel (asState ())).moreculling$resetTranslucencyCache (asState ());
48+ }
49+ }
3550 if (direction == null ) {
3651 return moreculling$emptyFaces != BitUtils .ALL_DIRECTIONS ;
3752 }
0 commit comments