use of net.minecraft.world.level.block.RenderShape in project MC-Prefab by Brian-Wuest.
the class StructureRenderHandler method renderComponentInWorld.
private static boolean renderComponentInWorld(Level world, BuildBlock buildBlock, MultiBufferSource.BufferSource entityVertexConsumer, PoseStack matrixStack, BlockPos pos) {
// Don't render this block if it's going to overlay a non-air/water block.
BlockState targetBlock = world.getBlockState(pos);
if (targetBlock.getMaterial() != Material.AIR && targetBlock.getMaterial() != Material.WATER) {
return false;
}
StructureRenderHandler.doRenderComponent(world, buildBlock, pos, entityVertexConsumer, matrixStack);
if (buildBlock.getSubBlock() != null) {
Block foundBlock = Registry.BLOCK.get(buildBlock.getSubBlock().getResourceLocation());
BlockState blockState = foundBlock.defaultBlockState();
BuildBlock subBlock = BuildBlock.SetBlockState(StructureRenderHandler.currentConfiguration, StructureRenderHandler.currentConfiguration.pos, buildBlock.getSubBlock(), foundBlock, blockState, StructureRenderHandler.currentStructure.getClearSpace().getShape().getDirection());
BlockPos subBlockPos = subBlock.getStartingPosition().getRelativePosition(StructureRenderHandler.currentConfiguration.pos, StructureRenderHandler.currentStructure.getClearSpace().getShape().getDirection(), StructureRenderHandler.currentConfiguration.houseFacing);
RenderShape subBlockRenderType = subBlock.getBlockState().getRenderShape();
return StructureRenderHandler.renderComponentInWorld(world, subBlock, entityVertexConsumer, matrixStack, subBlockPos);
}
return true;
}
Aggregations