44import net .minecraft .core .BlockPos ;
55import net .minecraft .world .entity .player .Player ;
66import net .minecraft .world .level .BlockGetter ;
7- import net .minecraft .world .level .block . AbstractGlassBlock ;
7+ import net .minecraft .world .level .LevelAccessor ;
88import net .minecraft .world .level .block .Block ;
99import net .minecraft .world .level .block .Blocks ;
10+ import net .minecraft .world .level .block .LiquidBlockContainer ;
1011import net .minecraft .world .level .block .SoundType ;
1112import net .minecraft .world .level .block .state .BlockState ;
13+ import net .minecraft .world .level .material .Fluid ;
14+ import net .minecraft .world .level .material .FluidState ;
1215import net .minecraft .world .level .material .MapColor ;
1316import net .minecraft .world .phys .shapes .CollisionContext ;
1417import net .minecraft .world .phys .shapes .EntityCollisionContext ;
1922 * This block is used as a substitution block for the Builder. Every solid block can be substituted by this block in schematics. This helps make schematics independent from
2023 * location and ground.
2124 */
22- public class BlockSubstitution extends Block
25+ public class BlockSubstitution extends Block implements LiquidBlockContainer
2326{
2427 /**
2528 * Constructor for the Substitution block. sets the creative tab, as well as the resistance and the hardness.
2629 */
2730 public BlockSubstitution ()
2831 {
29- super (defaultSubstitutionProperties ());
32+ super (defaultSubstitutionProperties ()
33+ .forceSolidOff ()); // don't kill farmland and path blocks underneath
3034 }
3135
3236 public static Properties defaultSubstitutionProperties ()
@@ -36,8 +40,7 @@ public static Properties defaultSubstitutionProperties()
3640 .sound (SoundType .WOOD )
3741 .instabreak () // must be before explosionResistance
3842 .explosionResistance (Blocks .OAK_PLANKS .getExplosionResistance ())
39- .noOcclusion ()
40- .forceSolidOff ();
43+ .noOcclusion ();
4144 }
4245
4346 @ Override
@@ -66,4 +69,17 @@ public VoxelShape getBlockSupportShape(BlockState state, BlockGetter worldIn, Bl
6669 // Allow torches etc to be placed on the faces regardless of collision shape
6770 return Shapes .block ();
6871 }
72+
73+ @ Override
74+ public boolean canPlaceLiquid (BlockGetter worldIn , BlockPos pos , BlockState state , Fluid fluid )
75+ {
76+ // Don't allow water to flow inside despite being non-solid
77+ return false ;
78+ }
79+
80+ @ Override
81+ public boolean placeLiquid (LevelAccessor worldIn , BlockPos pos , BlockState state , FluidState fluid )
82+ {
83+ return false ;
84+ }
6985}
0 commit comments