Really what happened was that this parameter you were passing:
worldIn.setBlock(pos, state, ... );
BlockState state = worldIn.getBlockState(pos);
when it should have been this:
The 1st parameter is the position to place at. The 2nd parameter is the block state to place. The 3rd parameter are the update flags (Constants.BlockFlags). The 4th parameter is recursion depth.
You really should not be using this overload. Use setBlockAndUpdate(BlockPos, BlockState) for most cases. If you need to set the flags, use setBlock(BlockPos, BlockState, int).
learn basic java, since Block is not and int
you need to pass in the BlockPos (as first parm), the BlockState (as second parm), the place flag (as second parm), you could use 3,
the fourth parm is not needed since there is a method with only these 3 parm