maruohon / litematica

A modern client-side schematic mod for Minecraft
GNU Lesser General Public License v3.0
689 stars 191 forks source link

Bug in experimental "visible blocks only" setting #713

Open MichaelVolk opened 1 year ago

MichaelVolk commented 1 year ago

Minecraft Version 1.19.3 I know it's just an experimental setting, but with visible blocks only the following bug occurs: If you put a bottom slab on top of an otherwise completely covered block, the blocks still gets added to the schematic. (expected behavior: the block should not be added). But when you put an top slab above the block (so the block is visible), the block does not get added even though it is visible below the slab. The same applies for other adjacent blocks like slabs from below or stairs from any side.

This happens due to a bug in the isExposed() function in LitematicaSchematic.java: the check stateAdj.isSideSolidFullSquare(world, posAdj, dir) == false checks in the direction of the adjacent block itself. i.e., when the top block is checked, it is checked if the top of this block is a complete square. But we are interested in the bottom side of this block. So it is necessary to check in the opposite direction like stateAdj.isSideSolidFullSquare(world, posAdj, oppositeDir) == false where oppositeDir is the opposite direction of dir ( dir = NORTH => oppositeDir = SOUTH...)

maruohon commented 1 year ago

Thanks. I now fixed this for the 1.20.x releases. I'll add the fix to older MC versions later via the main development code from 1.12.2.